public static void UpdateConstructAnnualPlanInvest(string PBSUnitCode) { try { if (PBSUnitCode != "") { EntityData pBSUnitByCode = PBSDAO.GetPBSUnitByCode(PBSUnitCode); if (pBSUnitByCode.HasRecord()) { decimal totalInvest = ConvertRule.ToDecimal(pBSUnitByCode.CurrentRow["PInvest"]); EntityData entity = ConstructDAO.GetConstructAnnualPlanByPBSUnit(PBSUnitCode); foreach (DataRow row2 in entity.CurrentTable.Rows) { string visualProgress = ConvertRule.ToString(row2["VisualProgress"]); int currFloorCount = ConvertRule.ToInt(row2["CurrentFloor"]); int totalFloorCount = PBSRule.GetPBSUnitFloorCount(PBSUnitCode); decimal num4 = CalcInvestByVisualProgress(totalInvest, visualProgress, totalFloorCount, currFloorCount); decimal num5 = ConvertRule.ToDecimal(row2["InvestBefore"]); decimal num6 = num4 - num5; row2["PInvest"] = num6; } ConstructDAO.UpdateConstructAnnualPlan(entity); entity.Dispose(); pBSUnitByCode.Dispose(); } } } catch (Exception exception) { throw exception; } }
public static void DeletePBSUnit(string PBSUnitCode) { try { EntityData entity = ProductDAO.GetBuildingByPBSUnitCode(PBSUnitCode); foreach (DataRow row in entity.CurrentTable.Rows) { string text = row["BuildingCode"].ToString(); row["PBSUnitCode"] = DBNull.Value; } ProductDAO.UpdateBuilding(entity); entity.Dispose(); entity = ConstructDAO.GetConstructAnnualPlanByPBSUnit(PBSUnitCode); if (entity.HasRecord()) { ConstructDAO.DeleteConstructAnnualPlan(entity); } entity.Dispose(); entity = ConstructDAO.GetConstructPlanStepByPBSUnit(PBSUnitCode); if (entity.HasRecord()) { ConstructDAO.DeleteConstructPlanStep(entity); } entity.Dispose(); entity = ConstructDAO.GetConstructProgressRiskByPBSUnitCode(PBSUnitCode); if (entity.HasRecord()) { ConstructDAO.DeleteConstructProgressRisk(entity); } entity.Dispose(); entity = ConstructDAO.GetConstructProgressByPBSUnit(PBSUnitCode); if (entity.HasRecord()) { ConstructDAO.DeleteConstructProgress(entity); } entity.Dispose(); entity = ConstructDAO.GetConstructProgressStepByPBSUnit(PBSUnitCode); if (entity.HasRecord()) { ConstructDAO.DeleteConstructProgressStep(entity); } entity.Dispose(); entity = PBSDAO.GetPBSUnitByCode(PBSUnitCode); if (entity.HasRecord()) { PBSDAO.DeletePBSUnit(entity); } entity.Dispose(); } catch (Exception exception) { throw exception; } }
public static void UpdatePBSUnitByConstructProgressReport(string PBSUnitCode) { try { EntityData entity = PBSDAO.GetPBSUnitByCode(PBSUnitCode); if (entity.HasRecord()) { DataRow currentRow = entity.CurrentRow; string text = ""; int @int = 0; EntityData lastConstructProgressReport = GetLastConstructProgressReport(PBSUnitCode); if (lastConstructProgressReport.HasRecord()) { text = lastConstructProgressReport.GetString("VisualProgress"); @int = lastConstructProgressReport.GetInt("CurrentLayer"); } lastConstructProgressReport.Dispose(); if (text == "") { currentRow["VisualProgress"] = DBNull.Value; } else { currentRow["VisualProgress"] = text; } object constructProgressStepFirstKg = GetConstructProgressStepFirstKg(PBSUnitCode); currentRow["StartDate"] = constructProgressStepFirstKg; object constructProgressStepFirstJg = GetConstructProgressStepFirstJg(PBSUnitCode); currentRow["EndDate"] = constructProgressStepFirstJg; EntityData buildingByPBSUnitCode = ProductDAO.GetBuildingByPBSUnitCode(PBSUnitCode); if (buildingByPBSUnitCode.HasRecord()) { foreach (DataRow row2 in buildingByPBSUnitCode.CurrentTable.Rows) { row2["CurrentLayer"] = @int; ProductDAO.UpdateBuilding(buildingByPBSUnitCode); } } buildingByPBSUnitCode.Dispose(); PBSDAO.UpdatePBSUnit(entity); lastConstructProgressReport.Dispose(); } entity.Dispose(); } catch (Exception exception) { throw exception; } }
public static string GetPBSUnitName(object PBSUnitCode) { string text2; try { string text = ""; if ((PBSUnitCode != null) && (PBSUnitCode.ToString() != "")) { EntityData pBSUnitByCode = PBSDAO.GetPBSUnitByCode(PBSUnitCode.ToString()); if (pBSUnitByCode.HasRecord()) { text = pBSUnitByCode.GetString("PBSUnitName"); } pBSUnitByCode.Dispose(); } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }