Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
        public static DataTable GenerateConstructPlanProgressTable(string PBSUnitCode, int year)
        {
            DataTable table4;

            try
            {
                EntityData data = new EntityData("ConstructProgressStep");
                data.CurrentTable.Columns.Add(new DataColumn("PStartDate", typeof(DateTime)));
                data.CurrentTable.Columns.Add(new DataColumn("PEndDate", typeof(DateTime)));
                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);
                EntityData constructProgressStepByPBSUnit = ConstructDAO.GetConstructProgressStepByPBSUnit(PBSUnitCode);
                DataTable  currentTable = data.CurrentTable;
                DataTable  table2       = constructPlanStepByPBSUnitYear.CurrentTable;
                DataTable  table3       = constructProgressStepByPBSUnit.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 = table3.Select("VisualProgress='" + text + "'");
                    if (rowArray.Length > 0)
                    {
                        row["ProgressStepCode"] = ConvertRule.ToString(rowArray[0]["ProgressStepCode"]);
                        row["StartDate"]        = ConvertRule.ToDate(rowArray[0]["StartDate"]);
                        row["EndDate"]          = ConvertRule.ToDate(rowArray[0]["EndDate"]);
                    }
                    else
                    {
                        num--;
                        row["ProgressStepCode"] = num.ToString();
                    }
                    DataRow[] rowArray2 = table2.Select("VisualProgress='" + text + "'");
                    if (rowArray2.Length > 0)
                    {
                        row["PStartDate"] = ConvertRule.ToDate(rowArray2[0]["StartDate"]);
                        row["PEndDate"]   = ConvertRule.ToDate(rowArray2[0]["EndDate"]);
                    }
                    currentTable.Rows.Add(row);
                }
                constructPlanStepByPBSUnitYear.Dispose();
                constructProgressStepByPBSUnit.Dispose();
                validVisualProgress.Dispose();
                data.Dispose();
                table4 = currentTable;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table4);
        }