Example #1
0
 public static void InsertDefaultConstructAnnualPlan(string ProjectCode)
 {
     try
     {
         string val = GetConstructPlanCurrYearByProject(ProjectCode);
         if (val == "")
         {
             val = DateTime.Today.Year.ToString();
         }
         int        iYear            = ConvertRule.ToInt(val);
         EntityData pBSUnitByProject = PBSDAO.GetPBSUnitByProject(ProjectCode);
         EntityData constructAnnualPlanByProjectYear = ConstructDAO.GetConstructAnnualPlanByProjectYear(ProjectCode, iYear);
         EntityData entity = new EntityData("ConstructAnnualPlan");
         foreach (DataRow row in pBSUnitByProject.CurrentTable.Rows)
         {
             string text2 = row["PBSUnitCode"].ToString();
             if (constructAnnualPlanByProjectYear.CurrentTable.Select("PBSUnitCode='" + text2 + "'").Length == 0)
             {
                 DataRow row2 = entity.CurrentTable.NewRow();
                 row2["AnnualPlanCode"] = SystemManageDAO.GetNewSysCode("AnnualPlanCode");
                 row2["PBSUnitCode"]    = text2;
                 row2["ProjectCode"]    = ProjectCode;
                 row2["IYear"]          = iYear;
                 entity.CurrentTable.Rows.Add(row2);
             }
         }
         ConstructDAO.SubmitAllConstructAnnualPlan(entity);
         entity.Dispose();
         constructAnnualPlanByProjectYear.Dispose();
         pBSUnitByProject.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }