public static int GetPBSUnitFloorCount(string PBSUnitCode) { int num2; try { int num = 0; BuildingStrategyBuilder builder = new BuildingStrategyBuilder(); builder.AddStrategy(new Strategy(BuildingStrategyName.PBSUnitCode, PBSUnitCode)); builder.AddOrder("FloorCount", false); QueryAgent agent = new QueryAgent(); agent.SetTopNumber(1); string queryString = builder.BuildMainQueryString(); DataTable table = agent.ExecSqlForDataSet(queryString).Tables[0]; if (table.Rows.Count > 0) { num = ConvertRule.ToInt(table.Rows[0]["IFloorCount"]); } agent.Dispose(); num2 = num; } catch (Exception exception) { throw exception; } return(num2); }
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; } }
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; } }
public static string[] BuildArrayFieldByMonth(string StartY, string EndY, int StartM, int EndM, string FieldPre) { string[] textArray2; try { string[] textArray = new string[0]; int num = ConvertRule.ToInt(StartY); int num2 = ConvertRule.ToInt(EndY); int num3 = (EndM - StartM) + 1; if (num > 0) { int num4 = ((num2 - num) + 1) * num3; if (num4 > 0) { textArray = new string[num4]; int index = -1; for (int i = num; i <= num2; i++) { for (int j = StartM; j <= EndM; j++) { index++; string text = ConvertRule.FormatYYYYMM(i, j); textArray[index] = FieldPre + text; } } } } textArray2 = textArray; } catch (Exception exception) { throw exception; } return(textArray2); }
public static void AddMonthField(DataTable tb, string aStartY, string aEndY, string FieldName) { try { string val = aStartY; string text2 = aEndY; if ((val != "") && (text2 == "")) { text2 = val; } if ((text2 != "") && (val == "")) { val = text2; } if ((val != "") && (text2 != "")) { int num = ConvertRule.ToInt(val); int num2 = ConvertRule.ToInt(text2); for (int i = num; i <= num2; i++) { for (int j = 0; j <= 12; j++) { string text3 = ConvertRule.FormatYYYYMM(i, j); tb.Columns.Add(FieldName + text3, typeof(decimal)); } } } } catch (Exception exception) { throw exception; } }
public static string GetParentSubjectCode(string subjectCode, string ruleCode) { string text3; try { string[] textArray = ruleCode.Split(".".ToCharArray()); string text = ""; string text2 = subjectCode; for (int i = 0; i < textArray.Length; i++) { int length = ConvertRule.ToInt(textArray[i]); if (text2.Length > length) { text = text + text2.Substring(0, length); text2 = text2.Substring(length, text2.Length - length); } else { break; } } text3 = text; } catch (Exception exception) { throw exception; } return(text3); }
public void Generate() { try { string costCode; this.tb.Rows.Clear(); this.SetPBS(); this.SetPayment(); DataView view = new DataView(CBSDAO.GetCBSByProject(this.ProjectCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; DataRow row2 = this.tb.NewRow(); costCode = row["CostCode"].ToString(); row2["DtlCode"] = row["CostCode"]; row2["RecordType"] = ""; row2["CostCode"] = row["CostCode"]; row2["CostName"] = row["CostName"]; row2["SortID"] = row["SortID"]; row2["ParentCode"] = row["ParentCode"]; row2["Deep"] = row["Deep"]; row2["FullCode"] = row["FullCode"]; row2["ChildCount"] = row["ChildCount"]; row2["IsLeafCBS"] = ConvertRule.ToInt(row2["ChildCount"]) <= 0; this.tb.Rows.Add(row2); } foreach (DataRow row3 in this.tb.Rows) { costCode = ConvertRule.ToString(row3["CostCode"]); string text2 = ConvertRule.ToString(row3["FullCode"]); decimal num = 0M; string text3 = ""; foreach (DataRow row4 in this.tbPBS.Rows) { string text4 = ConvertRule.ToString(row4["PBSType"]); string text5 = ConvertRule.ToString(row4["PBSCode"]); decimal money = 0M; if (text2 != "") { string filterExpression = string.Format("FullCode like '{0}%' and isnull(PBSType, '') = '{1}' and isnull(PBSCode, '') = '{2}'", text2, text4, text5); money = MathRule.SumColumn(this.tbPayment.Select(filterExpression), "PaymentMoney"); } num += money; text3 = text3 + string.Format("<td align=right nowrap title='{1}'>{0}</td>", CostBudgetPageRule.GetContractPayHref(CostBudgetPageRule.GetMoneyShowString(money, CostBudgetPageRule.m_MoneyUnit.yuan), costCode, "", "", text4, text5), CostBudgetPageRule.GetWanDecimalShowHint(money)); } row3["Money"] = num; row3["MoneyHtml"] = text3; } this.ResetTitleHtml(); } catch (Exception exception) { throw exception; } }
public static DataRow CopySystemGroupNewRow(DataTable tb, DataRow drSrc, DataRow drDst, string dstClassCode) { DataRow row3; try { string text = ""; int num = 0; string text2 = ""; if (drDst != null) { text = ConvertRule.ToString(drDst["GroupCode"]); num = ConvertRule.ToInt(drDst["Deep"]); text2 = ConvertRule.ToString(drDst["FullID"]); } DataRow row = tb.NewRow(); int num2 = num + 1; string groupCode = SystemManageDAO.GetNewSysCode("SystemGroupCode"); string text4 = text2; if (text4.Length > 0) { text4 = text4 + "-" + groupCode; } else { text4 = groupCode; } row["GroupCode"] = groupCode; row["GroupName"] = drSrc["GroupName"]; row["SortID"] = drSrc["SortID"]; row["ClassCode"] = dstClassCode; row["deep"] = num2; row["FullID"] = text4; row["ParentCode"] = text; tb.Rows.Add(row); EntityData entity = ResourceDAO.GetAccessRangeByGroupCode(drSrc[0].ToString()); DataTable table = entity.Tables["AccessRange"]; for (int i = table.Rows.Count - 1; i >= 0; i--) { DataRow row2 = table.Rows[i]; AccessRangeNewRow(table, row2["AccessRangeType"].ToString(), row2["RelationCode"].ToString(), row2["OperationCode"].ToString(), groupCode, row2["RoleLevel"].ToString(), row2["ResourceCode"].ToString()); } ResourceDAO.SubmitAllAccessRange(entity); row3 = row; } catch (Exception exception) { throw exception; } return(row3); }
public static void SetSystemAccessDistinctRelationOperationHtml(DataTable tbRela, DataTable tbOp) { try { tbRela.Columns.Add("OperationCodes"); tbRela.Columns.Add("OperationNames"); tbRela.Columns.Add("OperationHtml"); foreach (DataRow row in tbRela.Rows) { string text = ConvertRule.ToString(row["AccessRangeType"]); string text2 = ConvertRule.ToString(row["RelationCode"]); string filterExpression = string.Format("AccessRangeType='{0}' and RelationCode='{1}'", text, text2); DataRow[] rowArray = tbOp.Select(filterExpression, "", DataViewRowState.CurrentRows); string text4 = ""; string text5 = ""; string text6 = ""; foreach (DataRow row2 in rowArray) { string text7 = ConvertRule.ToString(row2["OperationCode"]); string text8 = ConvertRule.ToString(row2["OperationName"]); int num = ConvertRule.ToInt(row2["RoleLevel"]); string text9 = ConvertRule.ToString(row2["RoleLevelName"]); string text10 = ""; if (num != 0) { text10 = "<font color='red'>" + text9 + "</font>"; } if (text4 != "") { text4 = text4 + ","; text5 = text5 + ","; text6 = text6 + ","; } text4 = text4 + text7; text5 = text5 + text8; text6 = text6 + text8 + text10; } row["OperationCodes"] = text4; row["OperationNames"] = text5; row["OperationHtml"] = text6; } } catch (Exception exception) { throw exception; } }
public static string CheckPBSUnitFloorCount(string PBSUnitCode, string InputFloorCount, string InputName) { string text2; try { string text = ""; int num = ConvertRule.ToInt(InputFloorCount); if (num == 0) { return(text); } int pBSUnitFloorCount = GetPBSUnitFloorCount(PBSUnitCode); if (pBSUnitFloorCount >= 0) { if (num > pBSUnitFloorCount) { return(string.Format("{0}({1})不能超出总层数({2})", InputName, num, pBSUnitFloorCount)); } if (num < 0) { return(string.Format("{0}({1})不能为负数", InputName, num)); } } else { if (Math.Abs(num) > Math.Abs(pBSUnitFloorCount)) { return(string.Format("{0}({1})不能超出总层数({2})", InputName, num, pBSUnitFloorCount)); } if (num > 0) { return(string.Format("{0}({1})必须为负数", InputName, num)); } } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
public void Generate() { try { if (this.m_PayType == e_PayType.payout) { this.SetPayout(); } else { this.SetPayment(); } DataView view = new DataView(CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; DataRow row2 = this.tb.NewRow(); string text = row["CostCode"].ToString(); row2["DtlCode"] = row["CostCode"]; row2["CostCode"] = row["CostCode"]; row2["CostName"] = row["CostName"]; row2["SortID"] = row["SortID"]; row2["ParentCode"] = row["ParentCode"]; row2["Deep"] = row["Deep"]; row2["FullCode"] = row["FullCode"]; row2["ChildCount"] = row["ChildCount"]; row2["IsLeafCBS"] = ConvertRule.ToInt(row2["ChildCount"]) <= 0; this.tb.Rows.Add(row2); } DropDateRangeColumn(this.tb); if ((this.StartYm != "") && (this.EndYm != "")) { AddDateRangeColumn(this.tb, this.StartYm, this.EndYm); } this.ReCalcByRelation(); this.RefreshDateRange(); } catch (Exception exception) { throw exception; } }
private void GetCurrentYearMonthRange(int CurrentY, int BeginY, int EndY, ref int iBeginM, ref int iEndM) { try { iBeginM = 1; iEndM = 12; if (CurrentY == BeginY) { iBeginM = ConvertRule.ToInt(this.StartYm.Substring(4, 2)); } if (CurrentY == EndY) { iEndM = ConvertRule.ToInt(this.EndYm.Substring(4, 2)); } } catch (Exception exception) { throw exception; } }
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; } }
private void AddCostChildDyn(DataRow drCBS) { try { string text = ConvertRule.ToString(drCBS["CostCode"]); int num = ConvertRule.ToInt(drCBS["Deep"]); string text2 = ConvertRule.ToString(drCBS["SortID"]); string text3 = ConvertRule.ToString(drCBS["FullCode"]); foreach (CostBudgetDynamic dynamic in this.m_arrDyn) { DataRow row = this.tb.NewRow(); row["CostBudgetDtlCode"] = "S_" + text + "_" + dynamic.CostBudgetSetCode; row["CostBudgetSetCode"] = dynamic.CostBudgetSetCode; row["CostCode"] = text; row["CostName"] = dynamic.entitySet.GetString("CostBudgetSetName"); row["ParentCode"] = text; row["FullCode"] = text3; row["Deep"] = num + 1; row["ChildCount"] = 0; DataRow[] rowArray = dynamic.tb.Select("CostCode = '" + text + "'"); if (rowArray.Length > 0) { foreach (string text4 in this.m_arrMoneyField) { row[text4] = rowArray[0][text4]; } row["ContractPayPercent"] = rowArray[0]["ContractPayPercent"]; row["BuildingPrice"] = rowArray[0]["BuildingPrice"]; row["HousePrice"] = rowArray[0]["HousePrice"]; row["BudgetPrice"] = rowArray[0]["BudgetPrice"]; row["ContractOriginalPrice"] = rowArray[0]["ContractOriginalPrice"]; } this.tb.Rows.Add(row); } } catch (Exception exception) { throw exception; } }
public static void FillCostBudgetDtlCBSData(DataRow drDtl, DataRow drCBS) { try { drDtl["CostCode"] = drCBS["CostCode"]; drDtl["CostName"] = drCBS["CostName"]; drDtl["SortID"] = drCBS["SortID"]; drDtl["ParentCode"] = drCBS["ParentCode"]; drDtl["Deep"] = drCBS["Deep"]; drDtl["FullCode"] = drCBS["FullCode"]; drDtl["MeasurementUnit"] = drCBS["MeasurementUnit"]; if (drDtl.Table.Columns.Contains("ChildCount") && drCBS.Table.Columns.Contains("ChildCount")) { drDtl["ChildCount"] = drCBS["ChildCount"]; drDtl["IsLeafCBS"] = ConvertRule.ToInt(drDtl["ChildCount"]) <= 0; } } catch (Exception exception) { throw exception; } }
public static void SetSystemGroupAccessRelationImage(DataRow dr) { try { int num = ConvertRule.ToInt(dr["AccessRangeType"]); string text = ""; switch (num) { case 0: text = "user.gif"; break; case 1: text = "group.gif"; break; } dr["AccessRangeTypeImageName"] = text; } catch (Exception exception) { throw exception; } }
public static string GetAccessRangeRoleLevelName(object objRoleLevel) { string text2; try { string text = ""; if (ConvertRule.ToInt(objRoleLevel) == 1) { text = "个人"; } else { text = "所有"; } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
public static string GetSalBudgetAfterPeriodDesc(DataRow dr) { string text2; try { string text = ""; int num = ConvertRule.ToInt(dr["IYear"]); int num2 = ConvertRule.ToInt(dr["AfterPeriod"]); int num3 = num + 1; int num4 = num + num2; if (num2 > 0) { text = string.Format("{0}年 到 {1}年", num3, num4); } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
public static string GetNextSubjectSetCode() { string text2; try { string text = ""; QueryAgent agent = new QueryAgent(); try { text = (ConvertRule.ToInt(agent.ExecuteScalar("select max(cast(SubjectSetCode as int)) from SubjectSet where IsNumeric(SubjectSetCode) = 1")) + 1).ToString(); } finally { agent.Dispose(); } text2 = text; } catch (Exception exception) { throw exception; } return(text2); }
public static string GetSalBudgetPeriodMonthDesc(DataRow dr) { string text2; try { int num = ConvertRule.ToInt(dr["IYear"]); int num2 = ConvertRule.ToInt(dr["PeriodMonth"]); int num3 = ConvertRule.ToInt(dr["StartMonth"]); int num4 = (num3 + num2) - 1; int num5 = num; if (num4 > 12) { num5++; num4 -= 12; } text2 = string.Format("{0}年{1}月 到 {2}年{3}月", new object[] { num, num3, num5, num4 }); } catch (Exception exception) { throw exception; } return(text2); }
private static DataRow AccessRangeNewRow(DataTable tb, string AccessRangeType, string RelationCode, string OperationCode, string GroupCode, string RoleLevel, string ResourceCode) { DataRow row2; try { DataRow row = tb.NewRow(); row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode"); row["AccessRangeType"] = AccessRangeType; row["RelationCode"] = RelationCode; row["ResourceCode"] = ResourceCode; row["GroupCode"] = GroupCode; row["UnitCode"] = ""; row["OperationCode"] = OperationCode; row["RoleLevel"] = ConvertRule.ToInt(RoleLevel); tb.Rows.Add(row); row2 = row; } catch (Exception exception) { throw exception; } return(row2); }
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; } }
public static void SetSystemGroupAccessRelationName(DataRow dr) { try { int num = ConvertRule.ToInt(dr["AccessRangeType"]); string userCode = ConvertRule.ToString(dr["RelationCode"]); string userName = ""; switch (num) { case 0: userName = SystemRule.GetUserName(userCode); break; case 1: userName = SystemRule.GetStationNameEx(userCode); break; } dr["RelationName"] = userName; } catch (Exception exception) { throw exception; } }
private static void BuildingCostApportionOnePayout(string projectCode, string payoutCode, EntityData PBSUnits, EntityData buildings, EntityData CBS, DataTable dtApportion, string AreaField) { try { DataTable dt = BuildBuildingCostApportionTable(); EntityData data = PaymentDAO.GetStandard_PayoutByCode(payoutCode); foreach (DataRow row in data.Tables["PayoutItem"].Rows) { dt.Clear(); string alloType = ConvertRule.ToString(row["AlloType"]); string text2 = ConvertRule.ToString(row["PayoutItemCode"]); int num = ConvertRule.ToInt(row["IsManualAlloc"]); string subjectCode = ConvertRule.ToString(row["SubjectCode"]); decimal money = ConvertRule.ToDecimal(row["PayoutMoney"]); switch (alloType) { case "P": AddBuildingCostApportion(projectCode, dt, alloType, "项目", money, buildings, PBSUnits, CBS, subjectCode, AreaField); break; case "U": case "B": { DataRow[] drsSelect = data.Tables["PayoutItemBuilding"].Select(string.Format(" PayoutItemCode='{0}' ", text2)); decimal totalArea = SumTotalArea(drsSelect, buildings, PBSUnits, alloType, AreaField); foreach (DataRow row2 in drsSelect) { string buildingCode = ConvertRule.ToString(row2["BuildingCode"]); string text5 = ConvertRule.ToString(row2["PBSUnitCode"]); decimal num4 = ConvertRule.ToDecimal(row2["ItemBuildingMoney"]); if (num == 1) { if (alloType == "U") { AddBuildingCostApportion(projectCode, dt, alloType, text5, num4, buildings, PBSUnits, CBS, subjectCode, AreaField); } else { AddBuildingCostApportion(projectCode, dt, alloType, buildingCode, num4, buildings, PBSUnits, CBS, subjectCode, AreaField); } } else if (alloType == "U") { AddBuildingCostApportion(projectCode, dt, alloType, text5, money, totalArea, buildings, PBSUnits, CBS, subjectCode, AreaField); } else { AddBuildingCostApportion(projectCode, dt, alloType, buildingCode, money, totalArea, buildings, PBSUnits, CBS, subjectCode, AreaField); } } break; } } ReCalcLastMoney(dt, money, "ApportionMoney"); SaveTempToFormalByCost(dt, dtApportion); } } catch (Exception exception) { throw exception; } }
public static void PBSTypeCopyByProject(string srcProjectCode, string dstProjectCode) { Exception exception; try { using (StandardEntityDAO ydao = new StandardEntityDAO("PBSType")) { ydao.BeginTrans(); try { EntityData entitydata = new EntityData("PBSType"); ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", dstProjectCode, entitydata, "PBSType"); ydao.DeleteAllRow(entitydata); ydao.DeleteEntity(entitydata); DataTable table = new DataTable(); table.Columns.Add("OldPBSTypeCode", typeof(string)); table.Columns.Add("NewPBSTypeCode", typeof(string)); EntityData data2 = new EntityData("PBSType"); ydao.FillEntity(SqlManager.GetSqlStruct("PBSType", "SelectByProjectCode").SqlString, "@ProjectCode", srcProjectCode, data2, "PBSType"); int num = 1; for (DataRow[] rowArray = data2.CurrentTable.Select("deep=" + num.ToString()); rowArray.Length > 0; rowArray = data2.CurrentTable.Select("deep=" + num.ToString())) { foreach (DataRow row in rowArray) { DataRow row2 = entitydata.CurrentTable.NewRow(); string newSysCode = SystemManageDAO.GetNewSysCode("PBSTypeCode"); row2["PBSTypeCode"] = newSysCode; row2["ProjectCode"] = dstProjectCode; row2["PBSTypeName"] = ConvertRule.ToString(row["PBSTypeName"]); row2["Description"] = ConvertRule.ToString(row["Description"]); row2["Deep"] = ConvertRule.ToInt(row["Deep"]); row2["SortID"] = ConvertRule.ToInt(row["SortID"]); DataRow row3 = table.NewRow(); row3["OldPBSTypeCode"] = ConvertRule.ToString(row["PBSTypeCode"]); row3["NewPBSTypeCode"] = newSysCode; table.Rows.Add(row3); string text2 = ConvertRule.ToString(row["ParentCode"]); if (text2 != "") { DataRow[] rowArray2 = table.Select("OldPBSTypeCode='" + text2 + "'"); if (rowArray2.Length > 0) { text2 = ConvertRule.ToString(rowArray2[0]["NewPBSTypeCode"]); } } string text3 = ""; if (text2 != "") { DataRow[] rowArray3 = entitydata.CurrentTable.Select("PBSTypeCode='" + text2 + "'"); if (rowArray3.Length > 0) { text3 = ConvertRule.ToString(rowArray3[0]["FullID"]); } } string text4 = newSysCode; if (text3 != "") { text4 = text3 + "-" + text4; } row2["ParentCode"] = text2; row2["FullID"] = text4; entitydata.CurrentTable.Rows.Add(row2); } num++; } ydao.InsertEntity(entitydata); ydao.CommitTrans(); data2.Dispose(); entitydata.Dispose(); } catch (Exception exception1) { exception = exception1; try { ydao.RollBackTrans(); } catch { } throw exception; } } } catch (Exception exception2) { exception = exception2; throw exception; } }
public DataTable GenerateCurrent() { DataTable table2; try { if (this.entityTargetHis != null) { this.entityTargetHis.Dispose(); } if (this.IsShowTargetMoneyHis) { this.entityTargetHis = CostBudgetRule.GetRelationCostBudget(this.ProjectCode, this.FirstCostBudgetCode, "1,2", this.CostBudgetCode); } DataTable table = CostBudgetPageRule.GenerateEmptyCostTargetDtl(this.StartY, this.EndY, this.entityTargetHis); EntityData allCBSBySet = CostBudgetRule.GetAllCBSBySet(this.ProjectCode, this.CostBudgetSetCode); if (allCBSBySet == null) { return(table); } if (this.ShowCostCode != "") { string cBSFullCode = CBSRule.GetCBSFullCode(this.ShowCostCode); DataRow[] rowArray = allCBSBySet.CurrentTable.Select(string.Format("FullCode not like '{0}%'", cBSFullCode)); foreach (DataRow row in rowArray) { allCBSBySet.CurrentTable.Rows.Remove(row); } CostBudgetRule.ResetCBSDeep(allCBSBySet.CurrentTable); } DataRow row2 = null; if (this.ShowCostCode == "") { row2 = table.NewRow(); row2["CostBudgetDtlCode"] = "R_0"; row2["CostCode"] = row2["CostBudgetDtlCode"]; row2["CostName"] = "合计"; row2["Deep"] = 1; row2["ParentCode"] = ""; row2["ChildCount"] = 1; row2["IsExpand"] = 1; table.Rows.Add(row2); } int num = 0; foreach (DataRow row3 in allCBSBySet.CurrentTable.Rows) { num--; DataRow drDtl = table.NewRow(); drDtl["CostBudgetDtlCode"] = num; CostBudgetPageRule.FillCostBudgetDtlCBSData(drDtl, row3); if (row2 != null) { if (ConvertRule.ToInt(drDtl["Deep"]) == 1) { drDtl["ParentCode"] = row2["CostBudgetDtlCode"]; } drDtl["Deep"] = ConvertRule.ToInt(drDtl["Deep"]) + 1; } else if (ConvertRule.ToInt(drDtl["Deep"]) == 1) { drDtl["ParentCode"] = ""; } table.Rows.Add(drDtl); } EntityData validCostBudget = CostBudgetRule.GetValidCostBudget(this.CostBudgetSetCode, 1); EntityData costBudgetDtlByCostBudgetCode = null; if (validCostBudget.HasRecord()) { costBudgetDtlByCostBudgetCode = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(validCostBudget.GetString("CostBudgetCode")); } EntityData data4 = CostBudgetDAO.GetCostBudgetDtlByCostBudgetCode(this.CostBudgetCode); EntityData costBudgetMonthByCostBudgetCode = CostBudgetDAO.GetCostBudgetMonthByCostBudgetCode(this.CostBudgetCode); foreach (DataRow row5 in table.Rows) { DataRow[] rowArray2 = data4.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row5["CostCode"]) + "'"); if (rowArray2.Length > 0) { row5["CostBudgetDtlCode"] = rowArray2[0]["CostBudgetDtlCode"]; row5["Price"] = rowArray2[0]["Price"]; row5["Qty"] = rowArray2[0]["Qty"]; row5["BudgetMoney"] = rowArray2[0]["BudgetMoney"]; row5["IsExpand"] = rowArray2[0]["IsExpand"]; row5["Description"] = rowArray2[0]["Description"]; row5["DescriptionHtml"] = rowArray2[0]["Description"]; } if (costBudgetDtlByCostBudgetCode != null) { DataRow[] rowArray3 = costBudgetDtlByCostBudgetCode.CurrentTable.Select("CostCode='" + ConvertRule.ToString(row5["CostCode"]) + "'"); if (rowArray3.Length > 0) { row5["BudgetValidMoney"] = rowArray3[0]["BudgetMoney"]; } } foreach (DataColumn column in table.Columns) { if (column.ColumnName.StartsWith("BudgetMoney_")) { string text2 = column.ColumnName.Replace("BudgetMoney_", ""); string val = text2.Substring(0, 4); string text4 = text2.Substring(4, 2); int num2 = ConvertRule.ToInt(val); int num3 = ConvertRule.ToInt(text4); DataRow[] rowArray4 = costBudgetMonthByCostBudgetCode.CurrentTable.Select("CostBudgetDtlCode = '" + ConvertRule.ToString(row5["CostBudgetDtlCode"]) + "' and IYear = " + num2.ToString() + " and IMonth = " + num3.ToString()); if (rowArray4.Length > 0) { row5[column.ColumnName] = rowArray4[0]["BudgetMoney"]; } } } if (!this.IsModify) { row5["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row5, this.iStartY, this.iEndY, "BudgetMoney_"); } } allCBSBySet.Dispose(); data4.Dispose(); costBudgetMonthByCostBudgetCode.Dispose(); validCostBudget.Dispose(); if (costBudgetDtlByCostBudgetCode != null) { costBudgetDtlByCostBudgetCode.Dispose(); } if (row2 != null) { DataRow[] drs = table.Select("ParentCode = '" + row2["CostBudgetDtlCode"].ToString() + "'"); string[] textArray = new string[] { "BudgetMoney", "BudgetValidMoney" }; string[] textArray2 = CostBudgetPageRule.BuildArrayFieldByMonth(this.StartY, this.EndY, "BudgetMoney_"); string[] arrColumnName = ConvertRule.ArrayConcat(textArray, textArray2); decimal[] numArray = MathRule.SumColumn(drs, arrColumnName); int index = -1; foreach (string text5 in arrColumnName) { index++; row2[text5] = numArray[index]; } if (!this.IsModify) { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, "BudgetMoney_"); } } table2 = table; } catch (Exception exception) { throw exception; } return(table2); }
public void Generate() { try { this.InitCostBudgetSet(); this.SetRelationContract(); this.SetRelationNoContract(); DataView view = new DataView(CBSDAO.GetCBSByProject(this.ProjectCode).CurrentTable, "", "SortID, Deep", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { DataRow row = view2.Row; DataRow row2 = this.tb.NewRow(); string text = row["CostCode"].ToString(); row2["DtlCode"] = row["CostCode"]; row2["RecordType"] = ""; row2["CostCode"] = row["CostCode"]; row2["CostName"] = row["CostName"]; row2["SortID"] = row["SortID"]; row2["ParentCode"] = row["ParentCode"]; row2["Deep"] = row["Deep"]; row2["FullCode"] = row["FullCode"]; row2["ChildCount"] = row["ChildCount"]; row2["IsLeafCBS"] = ConvertRule.ToInt(row2["ChildCount"]) <= 0; this.tb.Rows.Add(row2); DataRow[] rowArray = this.tbContract.Select("CostCode = '" + text + "'"); foreach (DataRow row3 in rowArray) { string text2 = row3["ContractCode"].ToString(); DataRow drDst = this.tb.NewRow(); ConvertRule.DataRowCopy(row3, drDst, this.tbContract, this.tb); drDst["DtlCode"] = "C_" + text + ":" + text2; drDst["RecordType"] = row3["RecordType"]; drDst["Deep"] = row2["Deep"]; drDst["ParentCode"] = row2["ParentCode"]; drDst["ChildCount"] = 0; drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdContract; this.tb.Rows.Add(drDst); DataRow[] rowArray2 = this.tbApportion.Select("ContractCode = '" + text2 + "' and CostCode = '" + text + "'"); foreach (DataRow row5 in rowArray2) { string costBudgetSetCode = ConvertRule.ToString(row5["PBSCode"]); drDst = this.tb.NewRow(); ConvertRule.DataRowCopy(row5, drDst, this.tbApportion, this.tb); drDst["DtlCode"] = "A_" + text + ":" + text2 + "@" + costBudgetSetCode; drDst["RecordType"] = "Apportion"; drDst["PBSCode"] = costBudgetSetCode; drDst["Deep"] = row2["Deep"]; drDst["ParentCode"] = row2["ParentCode"]; drDst["ChildCount"] = 0; drDst["ClassTd"] = CostBudgetPageRule.m_ClassTdApportion; drDst["ContractName"] = " " + this.GetCostBudgetSetName(costBudgetSetCode); this.tb.Rows.Add(drDst); } } } this.ReCalcByRelation("", ""); this.RefreshDateRange(); } catch (Exception exception) { throw exception; } }
public static void MoveSystemGroup(string srcGroupCode, string dstGroupCode, string dstClassCode) { try { if (srcGroupCode == "") { throw new Exception("未传入源结点号"); } if (dstClassCode == "") { throw new Exception("未传入大类代码"); } EntityData systemGroupByCode = SystemManageDAO.GetSystemGroupByCode(srcGroupCode); if (!systemGroupByCode.HasRecord()) { throw new Exception("源结点不存在"); } DataRow currentRow = systemGroupByCode.CurrentRow; string text = ConvertRule.ToString(currentRow["FullID"]); string text2 = ConvertRule.ToString(currentRow["ClassCode"]); string text3 = ConvertRule.ToString(currentRow["ParentCode"]); if (text2 != dstClassCode) { throw new Exception("只能在同一大类下移动"); } DataRow row2 = null; if (dstGroupCode.Length > 0) { EntityData data2 = SystemManageDAO.GetSystemGroupByCode(dstGroupCode); if (data2.HasRecord()) { row2 = data2.CurrentRow; } data2.Dispose(); } if (srcGroupCode == dstGroupCode) { throw new Exception("无法移动:源结点和目标结点相同"); } if (text3 == dstGroupCode) { throw new Exception("无法移动:目标文件夹和源文件夹相同"); } if ((row2 != null) && (ConvertRule.ToString(row2["FullID"]).IndexOf(text) == 0)) { throw new Exception("无法移动:目标文件夹是源文件夹的子文件"); } EntityData entity = SystemManageDAO.GetSystemGroupIncludeAllChildByParentFullID(text); DataTable currentTable = entity.CurrentTable; DataView view = new DataView(currentTable, "", "deep", DataViewRowState.CurrentRows); foreach (DataRow row3 in currentTable.Rows) { string text5 = ConvertRule.ToString(row3["GroupCode"]); int num = ConvertRule.ToInt(row3["Deep"]); string text6 = ConvertRule.ToString(row3["ParentCode"]); DataRow drParent = null; if (text5 == srcGroupCode) { drParent = row2; } else { DataRow[] rowArray = currentTable.Select("GroupCode='" + text6 + "'"); if (rowArray.Length > 0) { drParent = rowArray[0]; } else { drParent = currentTable.Select("GroupCode='" + srcGroupCode + "'")[0]; } } SetSystemGroupParent(row3, drParent); } SystemManageDAO.SubmitAllSystemGroup(entity); entity.Dispose(); systemGroupByCode.Dispose(); } catch (Exception exception) { throw exception; } }
public void RefreshHtml() { try { DataRow drDst; if (!this.ds.Tables.Contains("Html")) { this.ds.Tables.Add(CostBudgetPageRule.CreateDynamicHtmlTable(this.StartY, this.EndY, this.tb)); } this.tbHtml.Clear(); foreach (DataRow row in this.tb.Rows) { drDst = this.tbHtml.NewRow(); ConvertRule.DataRowCopy(row, drDst, this.tb, this.tbHtml); this.tbHtml.Rows.Add(drDst); } if ((this.StartY != "") && (this.EndY != "")) { DataRow[] drsChild; DataView view = new DataView(this.tbHtml, "Deep = 3", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { int objYear; int objMonth; string text4; string name; drDst = view2.Row; string text = ConvertRule.ToString(drDst["CostCode"]); string text2 = ConvertRule.ToString(drDst["FullCode"]); string text3 = ConvertRule.ToString(drDst["CostBudgetSetCode"]); DataRow[] rowArray = this.tbMonth.Select(string.Format("CostCode = '{0}' and CostBudgetSetCode = '{1}'", text, text3)); foreach (DataRow row3 in rowArray) { objYear = ConvertRule.ToInt(row3["IYear"]); objMonth = ConvertRule.ToInt(row3["IMonth"]); text4 = ConvertRule.FormatYYYYMM(objYear, objMonth); name = "BudgetMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } } rowArray = this.tbContractMonth.Select(string.Format("FullCode like '{0}%' and CostBudgetSetCode = '{1}'", text2, text3)); foreach (DataRow row3 in rowArray) { objYear = ConvertRule.ToInt(row3["IYear"]); objMonth = ConvertRule.ToInt(row3["IMonth"]); text4 = ConvertRule.FormatYYYYMM(objYear, objMonth); name = "ContractMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } text4 = ConvertRule.FormatYYYYMM(objYear, 0); name = "ContractMoney_" + text4; if (this.tbHtml.Columns.Contains(name)) { drDst[name] = ConvertRule.ToDecimal(drDst[name]) + ConvertRule.ToDecimal(row3["Money"]); } } } view = new DataView(this.tbHtml, "Deep = 2", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { drDst = view2.Row; drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'"); this.CalcByChilds(drDst, drsChild); } view = new DataView(this.tbHtml, "Deep = 1", "", DataViewRowState.CurrentRows); foreach (DataRowView view2 in view) { drDst = view2.Row; drsChild = this.tbHtml.Select("ParentCode = '" + ConvertRule.ToString(drDst["CostBudgetDtlCode"]) + "'"); this.CalcByChilds(drDst, drsChild); } } foreach (DataRow row2 in this.tbHtml.Rows) { string text6 = ConvertRule.ToString(row2["RecordType"]); string classTd = ConvertRule.ToString(row2["ClassTd"]); if (text6 == "") { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, new string[] { "BudgetMoney_", "ContractMoney_" }, new string[] { classTd, CostBudgetPageRule.m_ClassTdContract }, new string[] { "预算", "合同" }); } else { row2["PlanDataHtml"] = CostBudgetPageRule.GenerateCostBudgetPlanDataHtml(row2, this.iStartY, this.iEndY, "ContractMoney_", classTd); } } } catch (Exception exception) { throw exception; } }
private void SumDs() { try { DataRow[] drsChild; DataRow drDtl; this.tb.Rows.Clear(); this.tbMonth.Rows.Clear(); this.tbContractMonth.Rows.Clear(); DataRow row = this.tb.NewRow(); row["CostBudgetDtlCode"] = "R_0"; row["CostName"] = this.m_entityGroup.GetString("GroupName") + "合计"; row["Deep"] = 1; row["ParentCode"] = ""; row["ChildCount"] = 1; row["IsExpand"] = 1; this.tb.Rows.Add(row); EntityData rootCBSByGroup = CostBudgetRule.GetRootCBSByGroup(this.ProjectCode, this.GroupCode); foreach (DataRow row2 in rootCBSByGroup.CurrentTable.Rows) { string text = ConvertRule.ToString(row2["CostCode"]); drDtl = this.tb.NewRow(); drDtl["CostBudgetDtlCode"] = text; CostBudgetPageRule.FillCostBudgetDtlCBSData(drDtl, row2); drDtl["Deep"] = ConvertRule.ToInt(row["Deep"]) + 1; drDtl["ParentCode"] = row["CostBudgetDtlCode"]; drDtl["ChildCount"] = 1; this.tb.Rows.Add(drDtl); this.AddCostChildDyn(drDtl); drsChild = this.tb.Select("ParentCode = '" + text + "'"); this.CalcByChilds(drDtl, drsChild); } rootCBSByGroup.Dispose(); drsChild = this.tb.Select("ParentCode = '" + row["CostBudgetDtlCode"].ToString() + "'"); this.CalcByChilds(row, drsChild); if ((this.StartY != "") && (this.EndY != "")) { foreach (CostBudgetDynamic dynamic in this.m_arrDyn) { foreach (DataRow row4 in dynamic.tbMonth.Rows) { drDtl = this.tbMonth.NewRow(); ConvertRule.DataRowCopy(row4, drDtl, dynamic.tbMonth, this.tbMonth); drDtl["CostBudgetSetCode"] = dynamic.CostBudgetSetCode; this.tbMonth.Rows.Add(drDtl); } foreach (DataRow row5 in dynamic.tbContractMonth.Rows) { drDtl = this.tbContractMonth.NewRow(); ConvertRule.DataRowCopy(row5, drDtl, dynamic.tbContractMonth, this.tbContractMonth); drDtl["CostBudgetSetCode"] = dynamic.CostBudgetSetCode; this.tbContractMonth.Rows.Add(drDtl); } } } } catch (Exception exception) { throw exception; } }