public static void NewYearConstructAnnualPlan(string ProjectCode, int IYear, string UserCode) { try { if ((ProjectCode != "") && (IYear > 0)) { DataRow drDst; int num = IYear + 1; EntityData constructPlanStepByProjectYear = ConstructDAO.GetConstructPlanStepByProjectYear(ProjectCode, IYear); EntityData entity = new EntityData("ConstructPlanStep"); foreach (DataRow row in constructPlanStepByProjectYear.CurrentTable.Rows) { drDst = entity.CurrentTable.NewRow(); ConvertRule.DataRowCopy(row, drDst, constructPlanStepByProjectYear.CurrentTable, entity.CurrentTable); drDst["ConstructPlanStepCode"] = SystemManageDAO.GetNewSysCode("ConstructPlanStepCode"); drDst["IYear"] = num; entity.CurrentTable.Rows.Add(drDst); } ConstructDAO.InsertConstructPlanStep(entity); entity.Dispose(); constructPlanStepByProjectYear.Dispose(); EntityData data3 = PBSDAO.GetV_PBSUnitByProject(ProjectCode); EntityData constructAnnualPlanByProjectYear = ConstructDAO.GetConstructAnnualPlanByProjectYear(ProjectCode, IYear); entity = new EntityData("ConstructAnnualPlan"); foreach (DataRow row3 in data3.CurrentTable.Rows) { string pBSUnitCode = ConvertRule.ToString(row3["PBSUnitCode"]); string code = ConvertRule.ToString(row3["VisualProgress"]); decimal num2 = ConvertRule.ToDecimal(row3["TotalBuildArea"]); drDst = entity.CurrentTable.NewRow(); drDst["AnnualPlanCode"] = SystemManageDAO.GetNewSysCode("AnnualPlanCode"); entity.CurrentTable.Rows.Add(drDst); drDst["IYear"] = num; drDst["PBSUnitCode"] = pBSUnitCode; drDst["ProjectCode"] = ProjectCode; drDst["PlanDate"] = DateTime.Now; drDst["PlanPerson"] = UserCode; decimal num3 = CalcPBSUnitCompleteInvest(pBSUnitCode); drDst["InvestBefore"] = num3; EntityData visualProgressByCode = ConstructDAO.GetVisualProgressByCode(code); if (visualProgressByCode.HasRecord() && (visualProgressByCode.GetInt("ProgressType") >= 0)) { drDst["LCFArea"] = num2; } visualProgressByCode.Dispose(); ConstructDAO.InsertConstructAnnualPlan(entity); } entity.Dispose(); constructAnnualPlanByProjectYear.Dispose(); data3.Dispose(); } } catch (Exception exception) { throw exception; } }