Exemplo n.º 1
0
 private void LoadUserData()
 {
     try
     {
         var strColumn = AggregateColumn.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList();
         foreach (DataColumn dc in SourceTable.Columns)
         {
             if (dc.DataType != typeof(String) && dc.DataType != typeof(DateTime) && dc.DataType != typeof(Boolean))
             {
                 try
                 {
                     String strColumnWith_Agg_Type = strColumn.Find(item => item.Contains("[" + dc.ColumnName + "]:"));
                     if (strColumnWith_Agg_Type.IsNotNullOrEmpty())
                     {
                         String[] arrColumnWith_Agg_Type = strColumnWith_Agg_Type.Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                         if (arrColumnWith_Agg_Type[0].ToUpper() == "[" + dc.ColumnName.ToUpper() + "]")
                         {
                             Object val = SourceTable.Compute(arrColumnWith_Agg_Type[1] + "(" + dc.ColumnName + ")", String.Empty);
                             if (UserDataString.IsNotNullOrEmpty())
                             {
                                 UserDataString += String.Format(",\"{0}\":\"{1}\"", dc.ColumnName, val);
                             }
                             else
                             {
                                 UserDataString += String.Format("\"{0}\":\"{1}\"", dc.ColumnName, val);
                             }
                         }
                     }
                 }
                 catch
                 {
                 };
             }
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }