Esempio n. 1
0
        public static DataTable[] explodeForGroups(DataTable table, string[] colsArr)
        {
            List <DataTable> list = new List <DataTable>();

            table.DefaultView.Sort = ToolSqlText.getSortString(colsArr, ToolArray.create <SqlTypeRelations>(colsArr.Length, SqlTypeRelations.sortAsc));

            DataColumn[] colsObj = new DataColumn[colsArr.Length];
            for (int i = 0; i < colsArr.Length; ++i)
            {
                colsObj[i] = table.Columns[colsArr[i]];
            }

            object[] curValues = ToolArray.create <object>(colsArr.Length, null);

            DataTable tabTmp = null;

            foreach (DataRowView rowV in table.DefaultView)
            {
                object[] tmpValues = compareData(rowV, colsObj, curValues);
                if (tmpValues != null)
                {
                    curValues       = tmpValues;
                    list.Add(tabTmp = table.Clone());
                }

                tabTmp.Rows.Add(rowV.Row.ItemArray);
            }

            table.DefaultView.Sort = string.Empty;

            return(list.ToArray());
        }
Esempio n. 2
0
 Type[] checkAttrTypesArr(Type[] arr, int len)
 {
     if (arr == null || arr.Length == 0)
     {
         return(ToolArray.create <Type>(len, typeof(string)));
     }
     return(arr);
 }