public static _Methods CreateIntaceMet(_Business m_Currentbus, _UnitProject p_un, _Entity_SubInfo info) { _Methods m = new _Methods(m_Currentbus, p_un, info); if (info.PID == 0) { m = new _Mothod_Measures(m_Currentbus, p_un, info); return(m); } if (string.IsNullOrEmpty(info.LB) && info.PID != 0) { m = new _Motheds_CommonProj(m_Currentbus, p_un, info); return(m); } if (info.LB.Equals("清单")) { m = new _Mothods_MFixed(m_Currentbus, p_un, info); return(m); } if (info.LB.Contains("子目")) { m = new _Mothods_MSubheadings(m_Currentbus, p_un, info); return(m); } return(m); }
public override void Begin(List <int> session) { if (session != null) { if (session.Contains(Current.ID)) { return; } else { session.Add(Current.ID); } } _Entity_SubInfo info = null; DataRow row = null; _Methods met = null; _FixedList_Statistics sta = new _FixedList_Statistics(this.Current, this.Unit); sta.DataSource = this.GetDataSource; sta.Begin(this.Unit.StructSource.ModelMeasures.Select("PID = " + this.Current.ID)); //计算子目所属节 info = new _Entity_SubInfo(); row = this.Unit.StructSource.ModelMeasures.GetRowByOther(this.Current.PID.ToString()); if (row == null) { return; } _ObjectSource.GetObject(info, row); met = new _Motheds_CommonProj(this.CurrentBusiness, this.Unit, info); met.Begin(session); }
public override void Calculate() { DataRow[] rows = this.GetDataSource.Select(string.Format("PID={0}", this.Current.ID), "", DataViewRowState.CurrentRows); foreach (DataRow item in rows) { _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, item); _Motheds_CommonProj met = new _Motheds_CommonProj(this.CurrentBusiness, this.Unit, info); met.Calculate(); } _SubSegment_Statistics sta = new _SubSegment_Statistics(this.Current, this.Unit); sta.DataSource = this.GetDataSource; sta.Begin(); //CalculateKCAQWMCSF(); }
private void LoadTable(DataTable dt) { if (dt == null) { return; } _Methods met = null; DataRow[] crows = dt.Select("ParentID=1");//父级编号为1的为通用项目 int xh = 1; for (int i = 0; i < crows.Length; i++) { _Entity_SubInfo info = new _Entity_SubInfo(); info.JSJC = ""; //info.FL = ""; info.GCL = 0m; info.XMMC = crows[i]["Name"].ToString(); info.XMBM = crows[i]["Codes"].ToString(); info.OLDXMBM = crows[i]["Codes"].ToString(); info.SC = true; info.JBHZ = true; //通用项目添加到集合 this.Create(i, info); DataRow[] rows = dt.Select("ParentID=" + crows[i]["ID"] + "");//父级编号为为通用项目ID的项为清单 int m = 1; for (int j = 0; j < rows.Length; j++) { _Entity_SubInfo minfo = new _Entity_SubInfo(); minfo.XMMC = rows[j]["Name"].ToString(); minfo.LB = rows[j]["Type"].ToString(); minfo.GCL = 1m; minfo.JSJC = rows[j]["Calculation"].ToString(); minfo.FL = ToolKit.ParseDecimal(rows[j]["Rate"]); minfo.DW = rows[j]["Unit"].ToString(); minfo.XMBM = rows[j]["Codes"].ToString(); minfo.OLDXMBM = rows[j]["Codes"].ToString(); minfo.SC = true; minfo.JBHZ = true; minfo.XH = xh++; minfo.ZJFS = "子目组价"; if (rows[j]["Remark"].ToString().Contains("通用项目")) { //minfo.XH2 = int.Parse(rows[j]["Remark"].ToString().Replace("通用项目", "")); } if (i == 0 && m < 5) { minfo.ISTY = true; } m++; //info.Create(minfo); met = new _Motheds_CommonProj(this.CurrentBusiness, this.Unit, info); met.Create(j, minfo); DataRow[] srows = dt.Select("ParentID=" + rows[j]["ID"] + "");//父级编号为为清单ID的项为子目 for (int k = 0; k < srows.Length; k++) { _Entity_SubInfo sinfo = new _Entity_SubInfo(); sinfo.XMMC = srows[k]["Name"].ToString(); sinfo.LB = srows[k]["Type"].ToString(); sinfo.JSJC = srows[k]["Calculation"].ToString(); sinfo.FL = ToolKit.ParseDecimal(srows[k]["Rate"]); sinfo.DW = srows[k]["Unit"].ToString(); sinfo.LibraryName = this.Unit.Property.DLibraries.FixedLibrary.FullName; sinfo.GCL = 1m; sinfo.XMBM = srows[k]["Codes"].ToString(); sinfo.OLDXMBM = srows[k]["Codes"].ToString(); sinfo.SC = true; sinfo.JBHZ = true; if (!string.IsNullOrEmpty(sinfo.JSJC)) { sinfo.ZJFS = "公式组价"; } //minfo.Create(sinfo); met = new _Mothods_MFixed(this.CurrentBusiness, this.Unit, minfo); met.Create(k, sinfo); } } } }
private void LoadTempletTable(DataTable dt, Calculator calculator) { if (dt == null) { return; } try { _Methods met = null; string where = "PID=1"; DataRow[] rs = dt.Select("PID=0"); if (rs.Length > 0) { where = string.Format("PID={0}", rs[0]["ID"]); } DataRow[] crows = dt.Select(where);//父级编号为1的为通用项目 int xh = 1; for (int i = 0; i < crows.Length; i++) { _Entity_SubInfo info = GetInfoByRow(crows[i]); //info.JSJC = ""; ////info.FL = ""; //info.GCL = 0m; //info.XMMC = crows[i]["XMMC"].ToString(); //info.XMBM = crows[i]["XMBM"].ToString(); //info.OLDXMBM = crows[i]["OLDXMBM"].ToString(); //info.JBHZ =ToolKit.ParseBoolen (crows[i]["JBHZ"]); //info.SC = ToolKit.ParseBoolen (crows[i]["SC"]); //通用项目添加到集合 this.Create(i, info); DataRow[] rows = dt.Select("PID=" + crows[i]["ID"] + "");//父级编号为为通用项目ID的项为清单 int m = 1; for (int j = 0; j < rows.Length; j++) { _Entity_SubInfo minfo = GetInfoByRow(rows[j]); //minfo.XMMC = rows[j]["XMMC"].ToString(); //minfo.LB = rows[j]["LB"].ToString(); //minfo.GCL = 1m; //minfo.JSJC = rows[j]["JSJC"].ToString(); //minfo.FL = ToolKit.ParseDecimal(rows[j]["FL"]); //minfo.DW = rows[j]["DW"].ToString(); //minfo.XMBM = rows[j]["XMBM"].ToString(); //minfo.OLDXMBM = rows[j]["OLDXMBM"].ToString(); //minfo.JBHZ = ToolKit.ParseBoolen(rows[j]["JBHZ"]); //minfo.SC = ToolKit.ParseBoolen(rows[j]["SC"]); minfo.XH = xh++; //if (rows[j]["Remark"].ToString().Contains("通用项目")) //{ // //minfo.XH2 = int.Parse(rows[j]["Remark"].ToString().Replace("通用项目", "")); //} if (i == 0 && m < 5) { minfo.ISTY = true; } m++; //info.Create(minfo); met = new _Motheds_CommonProj(this.CurrentBusiness, this.Unit, info); calculator.Entities.Add(met.Create(j, minfo)); DataRow[] srows = dt.Select("PID=" + rows[j]["ID"] + "");//父级编号为为清单ID的项为子目 for (int k = 0; k < srows.Length; k++) { _Entity_SubInfo sinfo = GetInfoByRow(srows[k]); //sinfo.XMMC = srows[k]["XMMC"].ToString(); //sinfo.LB = srows[k]["LB"].ToString(); //sinfo.JSJC = srows[k]["JSJC"].ToString(); //minfo.FL = ToolKit.ParseDecimal(rows[k]["FL"]); //sinfo.DW = srows[k]["DW"].ToString(); sinfo.LibraryName = this.Unit.Property.DLibraries.FixedLibrary.FullName; //sinfo.GCL = 1m; //sinfo.XMBM = srows[k]["XMBM"].ToString(); //sinfo.OLDXMBM = srows[k]["OLDXMBM"].ToString(); //sinfo.JBHZ = ToolKit.ParseBoolen(srows[k]["JBHZ"]); //sinfo.SC = ToolKit.ParseBoolen(srows[k]["SC"]); //minfo.Create(sinfo); met = new _Mothods_MFixed(this.CurrentBusiness, this.Unit, minfo); calculator.Entities.Add(met.Create(k, sinfo)); } } } } catch (Exception e) { throw e; } }