Guest User

Untitled

a guest
Jan 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using Microsoft.SharePoint;
  7. using BPAListViews.Utilities;
  8.  
  9. namespace BPAListViews.Utilities
  10. {
  11.     class IllnessIncidentSummaryFromInfoPath
  12.     {
  13.         //private const String TARGET_LIST = "Illness Incidents";
  14.  
  15.         public DataTable Data()
  16.         {
  17.  
  18.             SPList currentList = SPContext.Current.Web.Lists["Contract Modification Request and Justification Entry"];
  19.             SPQuery queryList = new SPQuery();
  20.  
  21.             queryList.Query = @"
  22.                            <OrderBy>
  23.                                <FieldRef Name='Report_x0020_Id' = 'FALSE' /> //CmrAssignedId
  24.                            </OrderBy>";
  25.             DataTable dt = new DataTable();
  26.             dt.Locale = System.Globalization.CultureInfo.InvariantCulture;
  27.             dt.Columns.Add(new DataColumn("CmrAssignedId", Type.GetType("System.String")));
  28.             dt.Columns.Add(new DataColumn("RfpAssignedId", Type.GetType("System.String")));
  29.             dt.Columns.Add(new DataColumn("MocAssignedId", Type.GetType("System.String")));
  30.             dt.Columns.Add(new DataColumn("OpenClosed", Type.GetType("System.String")));
  31.  
  32.             SPListItemCollection returnedItems = currentList.GetItems(queryList);
  33.             DataRow currentRow;
  34.             CAISUtilities.FormatUtilities fmt = new CAISUtilities.FormatUtilities();
  35.             foreach (SPListItem Item in returnedItems)
  36.             {
  37.                 currentRow = dt.NewRow();
  38.                 currentRow["CmrAssignedId"] = fmt.FormatAsString(Item["Report Id"]);
  39.                 dt.Rows.Add(currentRow);
  40.             }
  41.            
  42.             SPListItemCollection returnedItems = SPContext.Current.Web.Lists
  43.         ["Request For Proposal and Contract Modification Proposal Entry"];
  44.  
  45.             DataRow currentRow;
  46.             CAISUtilities.FormatUtilities fmt = new CAISUtilities.FormatUtilities();
  47.             foreach (SPListItem Item in returnedItems)
  48.             {
  49.                 currentRow = dt.NewRow();
  50.                 currentRow["RfpAssignedId"] = fmt.FormatAsString(Item["Report Id"]);
  51.                 currentRow["OpenClosed"] = fmt.FormatAsString(Item["Open Closed"]);
  52.                 dt.Rows.Add(currentRow);
  53.             }
  54.            
  55.             SPListItemCollection returnedItems = SPContext.Current.Web.Lists["MOC"];
  56.             DataRow currentRow;
  57.             CAISUtilities.FormatUtilities fmt = new CAISUtilities.FormatUtilities();
  58.             foreach (SPListItem Item in returnedItems)
  59.             {
  60.                 currentRow = dt.NewRow();
  61.                 currentRow["CmrAssignedId"] = fmt.FormatAsString(Item["Report Id"]);
  62.                 dt.Rows.Add(currentRow);
  63.             }
  64.            
  65.             return dt;
  66.         }
  67.     }
  68. }
Add Comment
Please, Sign In to add comment