示例#1
0
文件: XmlTree.cs 项目: ishui/rms2
        public static string GetDataToXmlString(DataTable tb)
        {
            string text3;

            try
            {
                string text = "<?xml version=\"1.0\"?>";
                text = text + "<" + tb.TableName + "s>";
                foreach (DataRow row in tb.Rows)
                {
                    text = text + "<" + tb.TableName + ">";
                    foreach (DataColumn column in tb.Columns)
                    {
                        string text2 = ConvertRule.ToString(row[column]).Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
                        text = text + string.Format("<{0}>{1}</{0}>", column.ColumnName, text2);
                    }
                    text = text + "</" + tb.TableName + ">";
                }
                text3 = text + "</" + tb.TableName + "s>";
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text3);
        }
示例#2
0
        public static string GetTd(object objText, object objClass)
        {
            string text4;

            try
            {
                string text  = "";
                string text2 = ConvertRule.ToString(objText);
                string text3 = ConvertRule.ToString(objClass);
                if (text2 == "")
                {
                    text = "<td></td>";
                }
                else
                {
                    text = "<td";
                    if (text3 != "")
                    {
                        text = text + " class='" + text3 + "'";
                    }
                    text = (text + ">") + text2 + "</td>";
                }
                text4 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text4);
        }
示例#3
0
        public static EntityData GetFinanceSubjectSet(DataTable tbRelation)
        {
            EntityData data2;

            try
            {
                EntityData allSubjectSet = SubjectDAO.GetAllSubjectSet();
                allSubjectSet.CurrentTable.Columns.Add("U8Code");
                foreach (DataRow row in tbRelation.Rows)
                {
                    string    text     = ConvertRule.ToString(row["SubjectSetCode"]);
                    string    text2    = ConvertRule.ToString(row["U8Code"]);
                    DataRow[] rowArray = allSubjectSet.CurrentTable.Select(string.Format("SubjectSetCode='{0}'", text));
                    if (rowArray.Length > 0)
                    {
                        rowArray[0]["U8Code"] = text2;
                    }
                }
                data2 = allSubjectSet;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
示例#4
0
        public static string GetFinanceSubjectSetDesc(DataTable tbSet)
        {
            string text4;

            try
            {
                string text = "";
                foreach (DataRow row in tbSet.Rows)
                {
                    string subjectSetName = SubjectRule.GetSubjectSetName(ConvertRule.ToString(row["SubjectSetCode"]));
                    string text3          = ConvertRule.ToString(row["U8Code"]);
                    if (subjectSetName != "")
                    {
                        if (text != "")
                        {
                            text = text + ";";
                        }
                        text = text + subjectSetName + ":" + text3;
                    }
                }
                text4 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text4);
        }
示例#5
0
 private string ImportSingle(string val)
 {
     try
     {
         string[] arr = ImportRule.SplitCsvLine(val);
         if (arr.Length < base.MinColCount)
         {
             return(string.Format("列不足{0}个", base.MinColCount));
         }
         string text = arr[1].Trim();
         if (text == "")
         {
             return("材料名称为空");
         }
         string text2 = arr[0].Trim();
         string text3 = "";
         if (text2 != "")
         {
             DataRow[] rowArray = this.m_tbSystemGroup.Select("FullName = '" + text2 + "'");
             if (rowArray.Length > 0)
             {
                 text3 = rowArray[0]["GroupCode"].ToString();
             }
         }
         if (text3 == "")
         {
             return(string.Format("未知的类型“{0}”", text2));
         }
         MaterialDAL   ldal = new MaterialDAL(this.conn);
         MaterialModel mObj = new MaterialModel();
         mObj.MaterialCode = int.Parse(SystemManageDAO.GetNewSysCode("MaterialCode"));
         mObj.MaterialName = text;
         mObj.GroupCode    = text3;
         mObj.Spec         = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 2)).Trim();
         mObj.Unit         = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 3)).Trim();
         mObj.InputPerson  = this.InputPerson;
         try
         {
             if (ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim() == "")
             {
                 mObj.StandardPrice = 0M;
             }
             else
             {
                 mObj.StandardPrice = decimal.Parse(ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim());
             }
         }
         catch
         {
             return(string.Format("参考价“{0}”不是有效的数值", ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 4)).Trim()));
         }
         mObj.Remark = ConvertRule.ToString(ConvertRule.GetArrayItem(arr, 5)).Trim();
         ldal.Insert(mObj);
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return("");
 }
示例#6
0
 public static void AddColumnTargetHis(DataTable tbDtl, EntityData entityTargetHis)
 {
     try
     {
         if (entityTargetHis != null)
         {
             DataView view = new DataView(entityTargetHis.CurrentTable, "", "VerID desc", DataViewRowState.CurrentRows);
             foreach (DataRowView view2 in view)
             {
                 string text = ConvertRule.ToString(view2.Row["VerID"]);
                 if (text != "")
                 {
                     string name = "BudgetMoneyHis_" + text;
                     if (!tbDtl.Columns.Contains(name))
                     {
                         tbDtl.Columns.Add(name);
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#7
0
文件: CostRule.cs 项目: riyuexing/rms
 private static void SaveTempToFormalByCost(DataTable dtTemp, DataTable dt)
 {
     try
     {
         foreach (DataRow row in dtTemp.Rows)
         {
             string    text     = ConvertRule.ToString(row["AlloType"]);
             string    text2    = ConvertRule.ToString(row["buildingCode"]);
             string    text3    = ConvertRule.ToString(row["costCode"]);
             DataRow[] rowArray = dt.Select(string.Format(" AlloType='{0}' and BuildingCode='{1}' and CostCode='{2}' ", text, text2, text3));
             DataRow   drDst    = null;
             if (rowArray.Length > 0)
             {
                 drDst = rowArray[0];
                 drDst["ApportionMoney"] = ConvertRule.ToDecimal(drDst["ApportionMoney"]) + ConvertRule.ToDecimal(row["ApportionMoney"]);
             }
             else
             {
                 drDst = dt.NewRow();
                 ConvertRule.DataRowCopy(row, drDst, dtTemp, dt);
                 dt.Rows.Add(drDst);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#8
0
 public static void DeleteAllSupplier()
 {
     try
     {
         QueryAgent agent = new QueryAgent();
         try
         {
             string  queryString = "select top 1 a.ContractName, b.SupplierName from Contract a, Supplier b where a.SupplierCode = b.SupplierCode";
             DataSet set         = agent.ExecSqlForDataSet(queryString);
             try
             {
                 if (set.Tables[0].Rows.Count > 0)
                 {
                     throw new Exception(string.Format("供应商“{0}”已生成合同,不能删除", ConvertRule.ToString(set.Tables[0].Rows[0]["SupplierName"])));
                 }
             }
             finally
             {
                 set.Dispose();
             }
             agent.ExecuteSql("delete SupplierSubjectSet");
             agent.ExecuteSql("delete Supplier");
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#9
0
        public static string GetSalProjectNameByCode(string ProjectCode)
        {
            string text2;

            try
            {
                string text = "";
                if (ProjectCode == "")
                {
                    return(text);
                }
                SalService service = new SalService();
                DataTable  table   = service.GetSalProjectByCode(ProjectCode).Tables[0];
                if (table.Rows.Count > 0)
                {
                    text = ConvertRule.ToString(table.Rows[0]["Proj_Name"]);
                }
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
示例#10
0
 public void ResetTitleHtml()
 {
     try
     {
         this.m_TitleHtml1           = "";
         this.m_TitleHtmlArea        = "";
         this.m_TitleHtmlAreaPercent = "";
         foreach (DataRow row in this.tbPBS.Rows)
         {
             if (ConvertRule.ToString(row["PBSType"]) == "B")
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", CostBudgetPageRule.GetBuildingHref(ConvertRule.ToString(row["PBSCode"]), ConvertRule.ToString(row["PBSName"])) + "&nbsp;");
             }
             else
             {
                 this.m_TitleHtml1 = this.m_TitleHtml1 + string.Format("<th align=center nowrap>{0}</th>", ConvertRule.ToString(row["PBSName"]) + "&nbsp;");
             }
             this.m_TitleHtmlArea        = this.m_TitleHtmlArea + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowNumberString(row["Area"], "#,##0.##") + "&nbsp;");
             this.m_TitleHtmlAreaPercent = this.m_TitleHtmlAreaPercent + string.Format("<th align=center nowrap style='border-top:0'>{0}</th>", StringRule.BuildShowPercentString(row["AreaPercent"]) + "&nbsp;");
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#11
0
 private void FillContractChangeCostCode(DataTable tbTemp)
 {
     try
     {
         QueryAgent agent = new QueryAgent();
         foreach (DataRow row in tbTemp.Rows)
         {
             if (ConvertRule.ToString(row["ContractCostCode"]) == "")
             {
                 string    text        = ConvertRule.ToString(row["ContractCode"]);
                 string    text2       = ConvertRule.ToString(row["CostCode"]);
                 string    text3       = ConvertRule.ToString(row["CostBudgetSetCode"]);
                 string    text4       = "";
                 string    queryString = string.Format("select ContractCostCode from ContractCost where ContractCode = '{0}' and CostCode = '{1}' and CostBudgetSetCode = '{2}'", text, text2, text3);
                 DataTable table       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 foreach (DataRow row2 in table.Rows)
                 {
                     text4 = text4 + ((text4 == "") ? "" : ",");
                     text4 = text4 + ConvertRule.ToString(row2["ContractCostCode"]);
                 }
                 row["ContractCostCode"] = text4;
             }
         }
         agent.Dispose();
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#12
0
        public static string GetSystemReportDtlString(DataTable tb)
        {
            string text2;

            try
            {
                string text = "";
                int    num  = -1;
                foreach (DataRow row in tb.Rows)
                {
                    num++;
                    if (num > 0)
                    {
                        text = text + ";";
                    }
                    text = text + ConvertRule.ToString(row["FieldName"]) + "=" + ConvertRule.ToString(row["FieldDispName"]);
                }
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
示例#13
0
文件: CostPlan.cs 项目: riyuexing/rms
 private void AddPlan(DataRow[] drsSrc, string RecordType)
 {
     try
     {
         foreach (DataRow row in drsSrc)
         {
             DataRow   row2;
             string    text     = ConvertRule.ToString(row["ContractCode"]);
             string    text2    = ConvertRule.ToString(row["CostCode"]);
             string    text3    = ConvertRule.ToString(row["PlanYm"]);
             DataRow[] rowArray = this.tbPlan.Select("ContractCode = '" + text + "' and CostCode='" + text2 + "' and PlanYm = '" + text3 + "'");
             if (rowArray.Length == 0)
             {
                 row2 = this.tbPlan.NewRow();
                 row2["RecordType"]   = RecordType;
                 row2["ContractCode"] = text;
                 row2["CostCode"]     = text2;
                 row2["FullCode"]     = row["FullCode"];
                 row2["PlanYm"]       = row["PlanYm"];
                 this.tbPlan.Rows.Add(row2);
             }
             else
             {
                 row2 = rowArray[0];
             }
             row2["PlanMoney"] = ConvertRule.ToDecimal(row2["PlanMoney"]) + ConvertRule.ToDecimal(row["PlanMoney"]);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#14
0
 public static void SplitPubBuildingName(DataTable tb)
 {
     try
     {
         tb.Columns.Add("BuildingNameH", typeof(string));
         tb.Columns.Add("BuildingNameP", typeof(string));
         foreach (DataRow row in tb.Rows)
         {
             row["BuildingNameH"] = row["BuildingName"];
             row["BuildingNameP"] = row["BuildingName"];
         }
         DataRow[] rowArray = tb.Select("PBSTypeFullName like '住宅%'", "BuildingName");
         foreach (DataRow row in rowArray)
         {
             string    text      = ConvertRule.ToString(row["BuildingName"]);
             DataRow[] rowArray2 = tb.Select(string.Format("BuildingName like '{0}%' and PBSTypeFullName not like '住宅%'", text));
             foreach (DataRow row2 in rowArray2)
             {
                 string text2 = ConvertRule.ToString(row2["BuildingName"]);
                 string text3 = text2.Substring(text.Length, text2.Length - text.Length);
                 row2["BuildingNameH"] = text;
                 row2["BuildingNameP"] = text3;
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#15
0
文件: CostRule.cs 项目: riyuexing/rms
        public static DataTable ApportionAllPayout(string projectCode, string AreaField)
        {
            DataTable table2;

            try
            {
                EntityData buildings           = ProductDAO.GetBuildingNotAreaByProjectCode(projectCode);
                EntityData pBSUnits            = PBSDAO.GetPBSUnitByProject(projectCode);
                DataTable  dtApportion         = BuildApportionTable();
                EntityData payoutByProjectCode = PaymentDAO.GetPayoutByProjectCode(projectCode);
                foreach (DataRow row in payoutByProjectCode.CurrentTable.Rows)
                {
                    string payoutCode = ConvertRule.ToString(row["PayoutCode"]);
                    ApportionOnePayout(projectCode, payoutCode, pBSUnits, buildings, dtApportion, AreaField);
                }
                payoutByProjectCode.Dispose();
                pBSUnits.Dispose();
                buildings.Dispose();
                table2 = dtApportion;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
示例#16
0
文件: CostRule.cs 项目: riyuexing/rms
 private static void GetBuildingInfo(string alloType, string buildingCode, ref string buildingName, ref decimal buildingArea, EntityData PBSUnits, EntityData buildings, string AreaField)
 {
     if (alloType == "P")
     {
         buildingName = ProjectRule.GetProjectName(buildingCode);
         buildingArea = MathRule.SumColumn(buildings.CurrentTable, AreaField);
     }
     else
     {
         DataRow[] rowArray;
         if (alloType == "U")
         {
             rowArray = PBSUnits.CurrentTable.Select(string.Format("PBSUnitCode='{0}'", buildingCode));
             if (rowArray.Length > 0)
             {
                 buildingName = ConvertRule.ToString(rowArray[0]["PBSUnitName"]);
                 buildingArea = ConvertRule.ToDecimal(rowArray[0]["BuildingAreaSum"]);
             }
         }
         else if (alloType == "B")
         {
             rowArray = buildings.CurrentTable.Select(string.Format("BuildingCode='{0}'", buildingCode));
             if (rowArray.Length > 0)
             {
                 buildingName = ConvertRule.ToString(rowArray[0]["BuildingName"]);
                 buildingArea = ConvertRule.ToDecimal(rowArray[0][AreaField]);
             }
         }
     }
 }
示例#17
0
 public static void SetSystemGroupParent(DataRow drNew, DataRow drParent)
 {
     try
     {
         string text  = "";
         int    num   = 0;
         string text2 = "";
         if (drParent != null)
         {
             text  = ConvertRule.ToString(drParent["GroupCode"]);
             num   = ConvertRule.ToInt(drParent["Deep"]);
             text2 = ConvertRule.ToString(drParent["FullID"]);
         }
         string text3 = drNew["GroupCode"].ToString();
         int    num2  = num + 1;
         string text4 = text2;
         if (text4.Length > 0)
         {
             text4 = text4 + "-" + text3;
         }
         else
         {
             text4 = text3;
         }
         drNew["deep"]       = num2;
         drNew["FullID"]     = text4;
         drNew["ParentCode"] = text;
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#18
0
        public static DataTable GetSystemAccessDistinctRelation(DataTable tb)
        {
            DataTable table2;

            try
            {
                DataTable table = new DataTable();
                table.Columns.Add("SystemID");
                table.Columns.Add("AccessRangeType");
                table.Columns.Add("RelationCode");
                int num = 0;
                foreach (DataRow row in tb.Rows)
                {
                    string text             = ConvertRule.ToString(row["AccessRangeType"]);
                    string text2            = ConvertRule.ToString(row["RelationCode"]);
                    string filterExpression = string.Format("AccessRangeType='{0}' and RelationCode='{1}'", text, text2);
                    if (table.Select(filterExpression).Length == 0)
                    {
                        DataRow row2 = table.NewRow();
                        num++;
                        row2["SystemID"]        = num;
                        row2["AccessRangeType"] = text;
                        row2["RelationCode"]    = text2;
                        table.Rows.Add(row2);
                    }
                }
                table2 = table;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
示例#19
0
文件: SalRule.cs 项目: riyuexing/rms
        public static string GetSalPayItemName(string SalPayCode, string ContractCode)
        {
            string text2;

            try
            {
                string text = "";
                if ((SalPayCode == "") || (ContractCode == ""))
                {
                    return(text);
                }
                DataTable salPayItem = GetSalPayItem(SalPayCode, ContractCode);
                int       count      = salPayItem.Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    DataRow row = salPayItem.Rows[i];
                    if (text != "")
                    {
                        text = text + ",";
                    }
                    text = text + ConvertRule.ToString(row["ItemName"]);
                }
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
示例#20
0
 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;
     }
 }
示例#21
0
        public static DataTable UnionHouse(DataTable tb)
        {
            DataTable table2;

            try
            {
                DataTable tbDst       = tb.Clone();
                DataRow[] rowArray    = tb.Select("PBSTypeFullName like '住宅%'", "BuildingName");
                string[]  columnNames = new string[] {
                    "TotalInvest", "TotalCompleteInvest", "PCurrentYearInvest", "BeforInvestAccout", "PTotalConstructSize", "PHouseConstructSize", "PToBuildConstructSize", "POtherConstructSize", "PTotalCompleteSize", "PHouseCompleteSize", "PToBuildCompleteSize", "POtherCompleteSize", "HouseArea", "HouseSize", "ToBuildSize", "OtherSize",
                    "RoomArea", "HouseRoomSize", "ToBuildRoomSize", "OtherRoomSize"
                };
                foreach (DataRow row in rowArray)
                {
                    DataRow drDst = tbDst.NewRow();
                    ConvertRule.DataRowCopy(row, drDst, tb, tbDst);
                    string    text      = ConvertRule.ToString(drDst["BuildingName"]);
                    DataRow[] rowArray2 = tb.Select(string.Format("BuildingName like '{0}%' and PBSTypeFullName not like '住宅%'", text));
                    foreach (DataRow row3 in rowArray2)
                    {
                        ConvertRule.DataRowAddDecimal(drDst, row3, columnNames);
                    }
                    tbDst.Rows.Add(drDst);
                }
                table2 = tbDst;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(table2);
        }
示例#22
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;
     }
 }
示例#23
0
 private void PBSApport()
 {
     try
     {
         CostApportion apportion = new CostApportion();
         apportion.RoundDec = 2;
         DataView view = new DataView(this.tbPBS, "PBSType = 'B'", "", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             apportion.SetArea(ConvertRule.ToString(view2.Row["PBSCode"]), ConvertRule.ToDecimal(view2.Row["Area"]));
         }
         apportion.SetTotalMoney("AreaPercent", 100M);
         apportion.DoApportion();
         this.m_TotalPBSArea = apportion.TotalArea;
         foreach (DataRowView view2 in view)
         {
             DataRow[] rowArray = apportion.tbArea.Select("ID = '" + ConvertRule.ToString(view2.Row["PBSCode"]) + "'");
             if (rowArray.Length > 0)
             {
                 DataRow row = rowArray[0];
                 view2.Row["AreaPercent"] = row["AreaPercent"];
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#24
0
 private void ReCalcByRelation(string AStartYm, string AEndYm)
 {
     try
     {
         DataView view = new DataView(this.tb, "RecordType = ''", "", DataViewRowState.CurrentRows);
         foreach (DataRowView view2 in view)
         {
             DataRow dr = view2.Row;
             if (ConvertRule.ToString(dr["FullCode"]) != "")
             {
                 DataRow[] drs           = this.tbContract.Select("FullCode like '" + ConvertRule.ToString(dr["FullCode"]) + "%'");
                 string[]  textArray     = new string[] { "ContractMoney", "ContractChangeMoney", "ContractApplyMoney", "ContractPay", "ContractPayReal" };
                 string[]  textArray2    = CostBudgetPageRule.BuildArrayFieldByYm(AStartYm, AEndYm, "PayoutMoneyYm_");
                 string[]  arrColumnName = ConvertRule.ArrayConcat(textArray, textArray2);
                 decimal[] numArray      = MathRule.SumColumn(drs, arrColumnName);
                 int       index         = -1;
                 foreach (string text in arrColumnName)
                 {
                     index++;
                     dr[text] = numArray[index];
                 }
                 CostBudgetPageRule.CostBudgetDtlCalcField(dr, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
             }
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#25
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);
        }
示例#26
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);
        }
示例#27
0
文件: CostPlan.cs 项目: riyuexing/rms
 private void ResetContractDateRange()
 {
     try
     {
         DropDateRangeColumn(this.tbContract);
         DropDateRangeColumn(this.tb);
         if ((this.StartYm != "") && (this.EndYm != ""))
         {
             string text;
             string text2;
             string text3;
             string name;
             AddDateRangeColumn(this.tbContract, this.StartYm, this.EndYm);
             AddDateRangeColumn(this.tb, this.StartYm, this.EndYm);
             int monthsBetween = StringRule.GetMonthsBetween(this.StartYm, this.EndYm);
             foreach (DataRow row in this.tbContract.Rows)
             {
                 text  = ConvertRule.ToString(row["ContractCode"]);
                 text2 = ConvertRule.ToString(row["CostCode"]);
                 DataRow[] rowArray = this.tbPlan.Select("ContractCode = '" + text + "' and CostCode='" + text2 + "'");
                 foreach (DataRow row2 in rowArray)
                 {
                     text3 = ConvertRule.ToString(row2["PlanYm"]);
                     name  = "PlanMoneyYm_" + text3;
                     if (this.tbContract.Columns.Contains(name))
                     {
                         row[name] = ConvertRule.ToDecimal(row[name]) + ConvertRule.ToDecimal(row2["PlanMoney"]);
                     }
                 }
             }
             foreach (DataRow row in this.tbContract.Rows)
             {
                 text  = ConvertRule.ToString(row["ContractCode"]);
                 text2 = ConvertRule.ToString(row["CostCode"]);
                 DataRow   row3      = null;
                 DataRow[] rowArray2 = this.tb.Select("ContractCode = '" + text + "' and CostCode = '" + text2 + "' and RecordType <> ''");
                 if (rowArray2.Length > 0)
                 {
                     row3 = rowArray2[0];
                 }
                 if (row3 != null)
                 {
                     for (int i = 0; i < monthsBetween; i++)
                     {
                         text3      = StringRule.YmAddMonths(this.StartYm, i);
                         name       = "PlanMoneyYm_" + text3;
                         row3[name] = row[name];
                     }
                 }
             }
             this.ReCalcByRelation(this.StartYm, this.EndYm);
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
 private void SetRelationNoContract()
 {
     try
     {
         int       index;
         DataRow[] rowArray = this.tbContract.Select("RecordType = 'NoContract'");
         int       length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbContract.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbPayout.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbPayout.Rows.Remove(rowArray[index]);
         }
         rowArray = this.tbApportion.Select("RecordType = 'NoContract'");
         length   = rowArray.Length;
         for (index = length - 1; index >= 0; index--)
         {
             this.tbApportion.Rows.Remove(rowArray[index]);
         }
         QueryAgent agent = new QueryAgent();
         try
         {
             string queryString = "select 'Payment_' + a.PaymentCode as ContractCode, '' as ContractID, '非合同请款' + b.PaymentID as ContractName, c.SubjectCode as CostCode, c.SubjectCode as FullCode, b.SupplyCode as SupplierCode, b.SupplyName as SupplierName, a.ItemMoney as Money, a.CostBudgetSetCode, cb.PBSType, cb.PBSCode from PaymentItem a left join CBS c on c.CostCode = a.CostCode left join CostBudgetSet cb on cb.CostBudgetSetCode = a.CostBudgetSetCode, Payment b, PayoutItem oi, Voucher v, VoucherDetail vd where a.PaymentCode = b.PaymentCode and b.ProjectCode = '" + this.ProjectCode + "' and isnull(b.IsContract, 0) = 0 and a.PaymentItemCode = oi.PaymentItemCode and vd.RelaType = '付款' and vd.RelaCode = oi.PayoutCode and v.VoucherCode = vd.VoucherCode and v.Status in (1, 2)";
             if ((this.PBSType != "") || (this.PBSCode != ""))
             {
                 string text4 = queryString;
                 queryString = text4 + " and cb.PBSType = '" + this.PBSType + "' and cb.PBSCode = '" + this.PBSCode + "'";
             }
             DataTable tbSrc = agent.ExecSqlForDataSet(queryString).Tables[0];
             this.AddRelationContractRow(this.tbContract, tbSrc, "NoContract", "ContractMoney");
             foreach (DataRow row in this.tbContract.Rows)
             {
                 string text2 = ConvertRule.ToString(row["ContractCode"]).Replace("Payment_", "");
                 string text3 = ConvertRule.ToString(row["CostCode"]);
                 queryString = "select b.VoucherCode as PayoutCode, b.CheckDate as PayoutDate, a.DebitMoney as Money, 'Payment_' + pi.PaymentCode as ContractCode, a.SubjectCode as CostCode, a.SubjectCode as FullCode, '' as CostBudgetSetCode, '' as PBSType, '' as PBSCode from VoucherDetail a inner join Voucher b on b.VoucherCode = a.VoucherCode       and b.Status in (1, 2), PayoutItem oi, PaymentItem pi where b.ProjectCode = '" + this.ProjectCode + "' and a.RelaType = '付款' and a.RelaCode = oi.PayoutCode and oi.PaymentItemCode = pi.PaymentItemCode and pi.PaymentCode = '" + text2 + "'";
                 tbSrc       = agent.ExecSqlForDataSet(queryString).Tables[0];
                 this.AddPayout(tbSrc, "Contract");
                 foreach (DataRow row2 in tbSrc.Rows)
                 {
                     row["ContractPayReal"] = ConvertRule.ToDecimal(row["ContractPayReal"]) + ConvertRule.ToDecimal(row2["Money"]);
                 }
             }
             CostBudgetPageRule.CostBudgetDtlCalcAllRow(this.tbContract, CostBudgetPageRule.m_DynamicRowType.Contract, null, 0, 0);
         }
         finally
         {
             agent.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
示例#29
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;
     }
 }
示例#30
0
        private static EntityData ImportSalContractByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao)
        {
            EntityData data2;

            try
            {
                DataTable table = dsSrc.Tables["Contract"];
                dao.EntityName = "SalContract";
                EntityData entitydata = new EntityData("SalContract");
                string[]   Params     = new string[] { "@ClientCode" };
                object[]   values     = new object[] { ClientCode };
                dao.FillEntity(SqlManager.GetSqlStruct("SalContract", "SelectByClient").SqlString, Params, values, entitydata, "SalContract");
                if (entitydata.HasRecord())
                {
                    dao.DeleteAllRow(entitydata);
                    dao.DeleteEntity(entitydata);
                }
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    DataRow row          = entitydata.CurrentTable.NewRow();
                    DataRow row2         = table.Rows[i];
                    string  contractCode = row2["contract_code"].ToString();
                    row["ProjectCode"]  = ProjectCode;
                    row["ContractCode"] = contractCode;
                    row["ContractID"]   = row2["contract_id"];
                    row["ClientCode"]   = row2["client_code"];
                    row["ClientName"]   = row2["client_name"];
                    row["RoomCode"]     = row2["room_code"];
                    row["ContractDate"] = row2["contract_date"];
                    row["TotalPrice"]   = row2["total_price"];
                    row["FactPrice"]    = row2["fact_price"];
                    row["UnitPrice"]    = row2["unit_price"];
                    //row["Jiesuan"] = row2["jiesuan"];
                    // row["BofangCode"] = row2["bofang_code"];
                    row["ChamberName"]  = row2["chamber"];
                    row["BuildDim"]     = row2["build_dim"];
                    row["RoomDim"]      = row2["room_dim"];
                    row["Room"]         = row2["room"];
                    row["BuildingName"] = row2["build_name"];
                    //row["JiesuanDate"] = row2["jiesuan_date"];
                    string suplCodeByName = GetSuplCodeByName(GetSuplNameByContract(row["ContractID"].ToString(), 4), ProjectCode);
                    row["SuplCode"] = suplCodeByName;
                    string roomCode = ProductRule.GetRoomCodeByChamberRoomName(ConvertRule.ToString(row["ChamberName"]), ConvertRule.ToString(row["Room"]), ProjectCode);
                    row["RoomCode"] = roomCode;
                    UpdateRoomSalState(roomCode, contractCode);
                    entitydata.AddNewRecord(row);
                    dao.InsertEntity(entitydata);
                }
                data2 = entitydata;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }