Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public static void DeleteConstructAnnualPlan(string AnnuelPlanCode)
 {
     try
     {
         if (AnnuelPlanCode != "")
         {
             EntityData entity = ConstructDAO.GetConstructAnnualPlanByCode(AnnuelPlanCode);
             if (entity.HasRecord())
             {
                 string     pBSUnitCode = entity.GetString("PBSUnitCode");
                 int        iYear       = entity.GetInt("IYear");
                 EntityData constructPlanStepByPBSUnitYear = ConstructDAO.GetConstructPlanStepByPBSUnitYear(pBSUnitCode, iYear);
                 ConstructDAO.DeleteConstructPlanStep(constructPlanStepByPBSUnitYear);
                 constructPlanStepByPBSUnitYear.Dispose();
             }
             ConstructDAO.DeleteConstructAnnualPlan(entity);
             entity.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }