//[-] static Int32 CreateExcelDocument_V3_CountItem( Str_DataTable Table , List<Str_DataTable> List_Tables , DataSet Ds_Source , DataRow Dr_SourceKey , Boolean IsIncludeCurrent = true) { String SourceKey = Table.SourceKey; String TargetKey = Table.TargetKey; String Condition = ""; String SourceKey_ID = "0"; if (SourceKey != "") { if (Dr_SourceKey != null) { if (Dr_SourceKey.Table.Columns.Contains(SourceKey)) { SourceKey_ID = ER_Common.Convert_String(Dr_SourceKey[SourceKey], "0"); Condition = TargetKey + @" = " + @"'" + SourceKey_ID + @"'"; } } } Int32 Rv = 0; Int32 Table_Ct = Table.Ct - 1; DataRow[] Arr_Data = Ds_Source.Tables[Table_Ct].Select(Condition); if (IsIncludeCurrent) { Rv = Rv + Arr_Data.Length; } var List = from O in List_Tables where O.GroupName == Table.Name select O; foreach (Str_DataTable Inner_Table in List) { foreach (DataRow Dr in Arr_Data) { Int32 Inner_Rv = CreateExcelDocument_V3_CountItem(Inner_Table, List_Tables, Ds_Source, Dr, true); Rv = Rv + Inner_Rv; } } return Rv; }
static List<Str_DataTable?> CreateExcelDocument_GetDataTables_PivotTables(IWorksheet Ws_Parameters) { List<Str_DataTable?> List_Dtp = new List<Str_DataTable?>(); Int32[] LineInfo = CreateExcelDocument_ReadLineInfo(Ws_Parameters, CnsExcelKeyword_DataTable_Pivot, CnsExcelKeyword_DataTable_Pivot_End); Int32 Ct_Start = LineInfo[0]; Int32 Ct_End = LineInfo[1]; if (Ct_Start == 0 && Ct_End == 0) { return List_Dtp; } Int32 DataTable_Ct = 0; for (Int32 Ct = Ct_Start; Ct <= Ct_End; Ct++) { String ExcelText = ""; try { ExcelText = Ws_Parameters.Range["A" + Ct.ToString()].Characters.Text; } catch { } String DataTable_Name = ""; String DataTable_ParentName = ""; String DataTable_SourceKey = ""; String DataTable_TargetKey = ""; String DataTable_Location = ""; if (!(Strings.InStr(ExcelText, "[") > 0)) { try { DataTable_Ct++; String[] Arr_ExcelText = Strings.Split(ExcelText, " "); DataTable_Name = Arr_ExcelText[0]; DataTable_Location = Arr_ExcelText[1]; try { if (Arr_ExcelText.Length > 2) { DataTable_ParentName = Arr_ExcelText[3]; DataTable_SourceKey = Arr_ExcelText[4]; DataTable_TargetKey = Arr_ExcelText[5]; } } catch { } Str_DataTable Dt_New = new Str_DataTable(); Dt_New.Ct = DataTable_Ct; Dt_New.Name = DataTable_Name; Dt_New.Location = DataTable_Location; Dt_New.ParentName = DataTable_ParentName; Dt_New.SourceKey = DataTable_SourceKey; Dt_New.TargetKey = DataTable_TargetKey; List_Dtp.Add(Dt_New); } catch { throw new Exception(@"Invalid Syntax in [#]DataTable_Pivot."); } } } return List_Dtp; }