Exemplo n.º 1
0
 public void Generate()
 {
     try
     {
         this.InitCostBudgetSet();
         this.SetRelationContract();
         this.SetRelationNoContract();
         string   subjectSetCode = ProjectRule.GetSubjectSetCodeByProject(this.ProjectCode);
         DataView view           = new DataView(SubjectDAO.GetSubjectBySubjectSet(subjectSetCode).CurrentTable, "", "SubjectCode", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow row2        = view2.Row;
             DataRow row         = this.tb.NewRow();
             string  subjectCode = row2["SubjectCode"].ToString();
             row["DtlCode"]    = row2["SubjectCode"];
             row["RecordType"] = "";
             row["CostCode"]   = row2["SubjectCode"];
             row["CostName"]   = row2["SubjectName"];
             row["SortID"]     = row2["SubjectCode"];
             row["ParentCode"] = SubjectRule.GetSubjectParentCode(subjectCode, subjectSetCode);
             row["Deep"]       = row2["Layer"];
             row["FullCode"]   = row2["SubjectCode"];
             row["ChildCount"] = row2["ChildNodesCount"];
             row["IsLeafCBS"]  = ConvertRule.ToInt(row["ChildCount"]) <= 0;
             this.tb.Rows.Add(row);
             DataRow[] rowArray = this.tbContract.Select("CostCode = '" + subjectCode + "'");
             foreach (DataRow row3 in rowArray)
             {
                 string  text3 = row3["ContractCode"].ToString();
                 DataRow drDst = this.tb.NewRow();
                 ConvertRule.DataRowCopy(row3, drDst, this.tbContract, this.tb);
                 drDst["DtlCode"]    = "C_" + subjectCode + ":" + text3;
                 drDst["RecordType"] = row3["RecordType"];
                 drDst["Deep"]       = row["Deep"];
                 drDst["ParentCode"] = row["ParentCode"];
                 drDst["ChildCount"] = 0;
                 drDst["ClassTd"]    = CostBudgetPageRule.m_ClassTdContract;
                 this.tb.Rows.Add(drDst);
                 DataRow[] rowArray2 = this.tbApportion.Select("ContractCode = '" + text3 + "' and CostCode = '" + subjectCode + "'");
                 foreach (DataRow row5 in rowArray2)
                 {
                     string costBudgetSetCode = ConvertRule.ToString(row5["PBSCode"]);
                     drDst = this.tb.NewRow();
                     ConvertRule.DataRowCopy(row5, drDst, this.tbApportion, this.tb);
                     drDst["DtlCode"]      = "A_" + subjectCode + ":" + text3 + "@" + costBudgetSetCode;
                     drDst["RecordType"]   = "Apportion";
                     drDst["PBSCode"]      = costBudgetSetCode;
                     drDst["Deep"]         = row["Deep"];
                     drDst["ParentCode"]   = row["ParentCode"];
                     drDst["ChildCount"]   = 0;
                     drDst["ClassTd"]      = CostBudgetPageRule.m_ClassTdApportion;
                     drDst["ContractName"] = "  " + this.GetCostBudgetSetName(costBudgetSetCode);
                     this.tb.Rows.Add(drDst);
                 }
             }
         }
         this.ReCalcByRelation("", "");
         this.RefreshDateRange();
         for (int i = this.tb.Rows.Count - 1; i >= 0; i--)
         {
             DataRow row6 = this.tb.Rows[i];
             if (((ConvertRule.ToString(row6["RecordType"]) == "") && (ConvertRule.ToString(row6["FullCode"]) != "")) && (ConvertRule.ToInt(row6["IsExistsContract"]) == 0))
             {
                 this.tb.Rows.Remove(row6);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }