Exemple #1
0
        public static string GetVisualProgressName(string code)
        {
            string text2;

            try
            {
                string text = "";
                if (code == "")
                {
                    return(text);
                }
                EntityData visualProgressByCode = ConstructDAO.GetVisualProgressByCode(code);
                if (visualProgressByCode.HasRecord())
                {
                    text = visualProgressByCode.GetString("VisualProgress");
                }
                visualProgressByCode.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Exemple #2
0
 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;
     }
 }
Exemple #3
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);
        }
Exemple #4
0
        public static DataTable GenerateConstructProgressRiskTable(string ProgressCode, bool IsDefault)
        {
            DataTable table3;

            try
            {
                EntityData data        = new EntityData("ConstructProgressRisk");
                EntityData allRiskType = ConstructDAO.GetAllRiskType();
                EntityData constructProgressRiskByProgressCode = ConstructDAO.GetConstructProgressRiskByProgressCode(ProgressCode);
                DataTable  currentTable = data.CurrentTable;
                DataTable  table2       = constructProgressRiskByProgressCode.CurrentTable;
                currentTable.Columns.Add("RiskIndexName", typeof(string));
                int num   = 0;
                int count = allRiskType.CurrentTable.Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    allRiskType.SetCurrentRow(i);
                    string  text = allRiskType.GetString("TypeName");
                    DataRow row  = currentTable.NewRow();
                    row["RiskTypeName"] = text;
                    DataRow[] rowArray = table2.Select("RiskTypeName='" + text + "'");
                    if (rowArray.Length > 0)
                    {
                        row["ProgressRiskCode"] = ConvertRule.ToString(rowArray[0]["ProgressRiskCode"]);
                        row["RiskIndexCode"]    = rowArray[0]["RiskIndexCode"];
                    }
                    else
                    {
                        num--;
                        row["ProgressRiskCode"] = num.ToString();
                    }
                    if ((ConvertRule.ToString(row["RiskIndexCode"]) == "") && IsDefault)
                    {
                        EntityData defaultRiskIndex = ConstructDAO.GetDefaultRiskIndex();
                        if (defaultRiskIndex.HasRecord())
                        {
                            row["RiskIndexCode"] = defaultRiskIndex.GetString("IndexCode");
                            row["RiskIndexName"] = defaultRiskIndex.GetString("IndexName");
                        }
                        defaultRiskIndex.Dispose();
                    }
                    if (ConvertRule.ToString(row["RiskIndexName"]) == "")
                    {
                        row["RiskIndexName"] = GetRiskIndexName(row["RiskIndexCode"]);
                    }
                    currentTable.Rows.Add(row);
                }
                constructProgressRiskByProgressCode.Dispose();
                allRiskType.Dispose();
                data.Dispose();
                table3 = currentTable;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table3);
        }
Exemple #5
0
 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;
     }
 }
Exemple #6
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;
     }
 }
Exemple #7
0
 public static void DeleteRiskType(string TypeCode)
 {
     try
     {
         if (TypeCode != "")
         {
             EntityData entity = ConstructDAO.GetRiskTypeByCode(TypeCode);
             ConstructDAO.DeleteRiskType(entity);
             entity.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #8
0
 public static void DeleteRiskIndex(string IndexCode)
 {
     try
     {
         if (IndexCode != "")
         {
             EntityData entity = ConstructDAO.GetRiskIndexByCode(IndexCode);
             ConstructDAO.DeleteRiskIndex(entity);
             entity.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #9
0
        public static DataTable GetVisualProgressNotStart()
        {
            DataTable currentTable;

            try
            {
                EntityData visualProgressByProgressType = ConstructDAO.GetVisualProgressByProgressType(-1);
                visualProgressByProgressType.Dispose();
                currentTable = visualProgressByProgressType.CurrentTable;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(currentTable);
        }
Exemple #10
0
 public static void DeleteVisualProgress(string code)
 {
     try
     {
         if (code != "")
         {
             EntityData entity = ConstructDAO.GetVisualProgressByCode(code);
             ConstructDAO.DeleteVisualProgress(entity);
             entity.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #11
0
 public static void DeleteConstructProgressReport(string ProgressCode)
 {
     try
     {
         EntityData entity = ConstructDAO.GetStandard_ConstructProgressByCode(ProgressCode);
         if (entity.HasRecord())
         {
             string pBSUnitCode = entity.GetString("PBSUnitCode");
             ConstructDAO.DeleteStandard_ConstructProgress(entity);
             UpdatePBSUnitByConstructProgressReport(pBSUnitCode);
         }
         entity.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #12
0
 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;
     }
 }
Exemple #13
0
        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);
        }
Exemple #14
0
 public static void MakeConstructProgressApplyReport(string year, DataTable tb)
 {
     try
     {
         int month;
         for (month = 1; month <= 12; month++)
         {
             tb.Columns.Add("VGMonth" + month.ToString());
         }
         int num2 = ConvertRule.ToInt(year);
         foreach (DataRow row in tb.Rows)
         {
             string     text = ConvertRule.ToString(row["BuildingCode"]);
             EntityData data = ConstructDAO.GetV_ConstructProgressByPBSUnit(ConvertRule.ToString(row["PBSUnitCode"]));
             for (month = 1; month <= 12; month++)
             {
                 string   text3 = "";
                 DateTime time  = new DateTime(num2, month, 1);
                 string   text4 = time.ToString("yyyy-MM-dd");
                 string   text5 = time.AddMonths(1).ToString("yyyy-MM-dd");
                 DataView view  = new DataView(data.CurrentTable, "ReportDate >= '" + text4 + "' and ReportDate < '" + text5 + "'", "ReportDate desc", DataViewRowState.CurrentRows);
                 if (view.Count > 0)
                 {
                     DataRow row2 = view[0].Row;
                     int     num3 = ConvertRule.ToInt(row2["ProgressType"]);
                     text3 = ConvertRule.ToString(row2["VisualProgressName"]);
                     if (num3 == 1)
                     {
                         text3 = text3 + ConvertRule.ToInt(row2["CurrentLayer"]).ToString();
                     }
                 }
                 row["VGMonth" + month.ToString()] = text3;
             }
             data.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Exemple #15
0
        public static string GetLastVisualProgress()
        {
            string text2;

            try
            {
                string     text = "";
                EntityData lastVisualProgress = ConstructDAO.GetLastVisualProgress("");
                if (lastVisualProgress.HasRecord())
                {
                    text = lastVisualProgress.GetString("SystemID");
                }
                lastVisualProgress.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Exemple #16
0
        public static string GetConstructPlanVisualProgress(string PBSUnitCode, int IYear)
        {
            string text2;

            try
            {
                string     text = "";
                EntityData constructAnnualPlanByPBSUnitYear = ConstructDAO.GetConstructAnnualPlanByPBSUnitYear(PBSUnitCode, IYear);
                if (constructAnnualPlanByPBSUnitYear.HasRecord())
                {
                    text = constructAnnualPlanByPBSUnitYear.GetString("VisualProgress");
                }
                constructAnnualPlanByPBSUnitYear.Dispose();
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Exemple #17
0
 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;
     }
 }
Exemple #18
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;
     }
 }
Exemple #19
0
        public static string GetRiskTypeName(object TypeCode)
        {
            string text2;

            try
            {
                string text = "";
                if ((TypeCode != null) && (TypeCode.ToString() != ""))
                {
                    EntityData riskTypeByCode = ConstructDAO.GetRiskTypeByCode(TypeCode.ToString());
                    if (riskTypeByCode.HasRecord())
                    {
                        text = riskTypeByCode.GetString("TypeName");
                    }
                    riskTypeByCode.Dispose();
                }
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }