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; } }
public static DataTable GenerateConstructPlanTable(string ProjectCode, int IYear) { DataTable table3; try { DataTable tbDst = CreateConstructPlanTable(); EntityData data = PBSDAO.GetV_PBSUnitByProject(ProjectCode); EntityData constructAnnualPlanByProjectYear = ConstructDAO.GetConstructAnnualPlanByProjectYear(ProjectCode, IYear); DataTable tbSrc = constructAnnualPlanByProjectYear.CurrentTable; int num = 0; int count = data.CurrentTable.Rows.Count; for (int i = 0; i < count; i++) { data.SetCurrentRow(i); string text = data.GetString("PBSUnitCode"); DataRow drDst = tbDst.NewRow(); drDst["PBSUnitCode"] = text; DataRow[] rowArray = tbSrc.Select("PBSUnitCode='" + text + "'"); if (rowArray.Length > 0) { ConvertRule.DataRowCopy(rowArray[0], drDst, tbSrc, tbDst); } else { num++; drDst["AnnualPlanCode"] = -num; } drDst["PBSUnitName"] = data.GetString("PBSUnitName"); drDst["TotalBuildArea"] = data.GetDecimal("TotalBuildArea"); drDst["PTotalInvest"] = data.GetDecimal("PInvest"); tbDst.Rows.Add(drDst); } constructAnnualPlanByProjectYear.Dispose(); data.Dispose(); table3 = tbDst; } catch (Exception exception) { throw exception; } return(table3); }
public static void DeleteConstructAnnualPlan(string ProjectCode, int IYear) { try { if (ProjectCode != "") { EntityData entity = ConstructDAO.GetConstructPlanStepByProjectYear(ProjectCode, IYear); ConstructDAO.DeleteConstructPlanStep(entity); entity.Dispose(); EntityData constructAnnualPlanByProjectYear = ConstructDAO.GetConstructAnnualPlanByProjectYear(ProjectCode, IYear); ConstructDAO.DeleteConstructAnnualPlan(constructAnnualPlanByProjectYear); constructAnnualPlanByProjectYear.Dispose(); } } catch (Exception exception) { throw exception; } }
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; } }