public static void AddConstructProgressLastReportDate(string PBSUnitCode, DataTable tb) { try { tb.Columns.Add("IsEnd", typeof(int)); foreach (DataRow row in tb.Rows) { string visualProgress = ConvertRule.ToString(row["VisualProgress"]); if (row["EndDate"] == DBNull.Value) { row["IsEnd"] = 0; EntityData lastConstructProgressReportByVisualProgress = GetLastConstructProgressReportByVisualProgress(PBSUnitCode, visualProgress); if (lastConstructProgressReportByVisualProgress.HasRecord()) { row["EndDate"] = ConvertRule.ToDate(lastConstructProgressReportByVisualProgress.CurrentRow["ReportDate"]); } lastConstructProgressReportByVisualProgress.Dispose(); } else { row["IsEnd"] = 1; } } } catch (Exception exception) { throw exception; } }
public static DataTable GenerateConstructPlanTable(string PBSUnitCode, int year, bool isCopy) { DataTable table3; try { EntityData data = new EntityData("ConstructPlanStep"); data.CurrentTable.Columns.Add(new DataColumn("ProgressType", typeof(int))); data.CurrentTable.Columns.Add(new DataColumn("IsPoint", typeof(int))); data.CurrentTable.Columns.Add(new DataColumn("VisualProgressName", typeof(string))); EntityData validVisualProgress = GetValidVisualProgress(); EntityData constructPlanStepByPBSUnitYear = ConstructDAO.GetConstructPlanStepByPBSUnitYear(PBSUnitCode, year); DataTable currentTable = data.CurrentTable; DataTable table2 = constructPlanStepByPBSUnitYear.CurrentTable; int num = 0; int count = validVisualProgress.CurrentTable.Rows.Count; for (int i = 0; i < count; i++) { validVisualProgress.SetCurrentRow(i); string text = validVisualProgress.GetString("SystemID"); DataRow row = currentTable.NewRow(); row["VisualProgress"] = text; row["VisualProgressName"] = validVisualProgress.GetString("VisualProgress"); row["ProgressType"] = validVisualProgress.GetInt("ProgressType"); row["IsPoint"] = validVisualProgress.GetInt("IsPoint"); DataRow[] rowArray = table2.Select("VisualProgress='" + text + "'"); if (rowArray.Length > 0) { if (isCopy) { num--; row["ConstructPlanStepCode"] = num.ToString(); } else { row["ConstructPlanStepCode"] = ConvertRule.ToString(rowArray[0]["ConstructPlanStepCode"]); } row["StartDate"] = ConvertRule.ToDate(rowArray[0]["StartDate"]); row["EndDate"] = ConvertRule.ToDate(rowArray[0]["EndDate"]); } else { num--; row["ConstructPlanStepCode"] = num.ToString(); } currentTable.Rows.Add(row); } constructPlanStepByPBSUnitYear.Dispose(); validVisualProgress.Dispose(); data.Dispose(); table3 = currentTable; } catch (Exception exception) { throw exception; } return(table3); }