private void SetFixedTable(IEnumerable <DataRow> infos, int id, bool flag) { if (infos == null) { return; } if (flag) { foreach (DataRow item in infos) { DataRow r2 = this.m_Source.NewRow(); r2["ID"] = this.getID; r2["ParentID"] = id; r2["Display"] = "[" + item["XMBM"] + "]" + item["XMMC"]; this.m_Source.Rows.Add(r2); } } else { _SubSegmentsSource souce = null; foreach (DataRow item in infos) { if (item["SSLB"].Equals(0)) { souce = this.Activitie.StructSource.ModelSubSegments; } else { souce = this.Activitie.StructSource.ModelMeasures; } DataRow row = souce.GetRowByOther(item["PID"].ToString()); DataRow r2 = this.m_Source.NewRow(); r2["ID"] = this.getID; r2["ParentID"] = id; if (row != null) { r2["Display"] = "[" + row["XMBM"] + "]" + "[" + item["XMBM"] + "]" + item["XMMC"]; } else { r2["Display"] = "[" + item["XMBM"] + "]" + item["XMMC"]; } this.m_Source.Rows.Add(r2); } } }
/// <summary> /// 获取清单ID /// </summary> /// <param name="p_info"></param> /// <param name="p_BH"></param> /// <returns></returns> private string GetQDID(_SubSegmentsSource p_info, string p_BH) { string str = "-1"; DataRow[] drs = p_info.Select(string.Format("{0}={1}", p_BH, this.m_Methods_Subheadings.Current.ID)); foreach (DataRow item in drs) { if (str == "-1") { str = string.Empty; } str += item["ID"].ToString() + ","; } if (str != "-1") { str = str.Substring(0, str.Length - 1); } return(str); }
private void RemoveParent(DataRow row) { _SubSegmentsSource source = this.Unit.StructSource.ModelSubSegments; DataRow[] rows = source.Select(string.Format(" PID = {0}", row["PID"]), string.Empty, DataViewRowState.CurrentRows); if (rows.Length < 2) { DataRow row1 = source.GetRowByOther(row["PID"].ToString()); if (row1 != null) { if (row1["PID"].Equals(0)) { row.Delete(); _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, row1); GLODSOFT.QDJJ.BUSINESS._Methods mets = GLODSOFT.QDJJ.BUSINESS._Methods.CreateIntace(this.CurrentBusiness, this.Unit, info); mets.Begin(null); } else { this.RemoveParent(row1); } } } else { DataRow r = source.GetRowByOther(row["ID"].ToString()); if (r != null) { if (!r["PID"].Equals(0)) { string id = r["PID"].ToString(); r.Delete(); DataRow r1 = source.GetRowByOther(id); _Entity_SubInfo info = new _Entity_SubInfo(); _ObjectSource.GetObject(info, r1); GLODSOFT.QDJJ.BUSINESS._Methods mets = GLODSOFT.QDJJ.BUSINESS._Methods.CreateIntace(this.CurrentBusiness, this.Unit, info); mets.Begin(null); } } } }
private void CreateZJF(_Business m_Currentbus, _Entity_SubInfo item, DataRow row, Calculator calculator) { if (calculator == null) { calculator = new Calculator(m_Currentbus, Parent); } _SubSegmentsSource sorce = null; GLODSOFT.QDJJ.BUSINESS._Methods_Fixed fix = null; if (item.SSLB == 0) { sorce = this.Parent.StructSource.ModelSubSegments; fix = new _Methods_Fixed(m_Currentbus, this.Parent, item); } else { sorce = this.Parent.StructSource.ModelMeasures; fix = new _Mothods_MFixed(m_Currentbus, this.Parent, item); } DataRow[] rows = sorce.Select(string.Format("PID={0} and LB='子目-增加费'", item.ID)); if (IsEsixt(rows, row["Code"].ToString())) { List <_Entity_SubInfo> list = new List <_Entity_SubInfo>(); _Entity_SubInfo info = new _Entity_SubInfo(); info.OLDXMBM = row["Code"].ToString(); info.XMBM = row["Code"].ToString(); info.XMMC = row["Name"].ToString(); info.LB = "子目-增加费"; info.GCL = 1; list.Add(info); fix.Create(list); calculator.Entities.Add(info); } fix.Begin(null); calculator.Entities.Add(item); }
/// <summary> /// 特殊计算 /// </summary> private void SpecialCalculate() { if (this.splitContainerControl1.PanelVisibility == SplitPanelVisibility.Both) { string m_deh = this.lblDEH.Text; //定额号 decimal m_tzl = Convert.ToDecimal(this.lblTZL.Text); //调整量 decimal m_jbl = Convert.ToDecimal(this.lblJBL.Text); //基本量 decimal m_sjz = Convert.ToDecimal(this.txtSJZ.Text); //实际值 if (m_sjz != m_jbl) { int xs = Math.Abs((int)((m_sjz - m_jbl) / m_tzl)); //(实际值-基本量) = 正整数倍数 decimal b = Math.Abs((m_sjz - m_jbl)); //(实际值-基本量)= 差数 decimal c = (xs * m_tzl); //(基本量*调整量) = 实际差数 decimal d = b - c; //(实际差数-差数)= 余数 if (d > 0 && d < m_jbl) //余数在调整量之间时进位 { xs = xs + 1; } _SubSegmentsSource m_SubSegmentsSource = null; if (this.m_Methods_Subheadings.Current.SSLB == 0) { m_SubSegmentsSource = this.Activitie.StructSource.ModelSubSegments; } else { m_SubSegmentsSource = this.Activitie.StructSource.ModelMeasures; } DataRow dr = m_SubSegmentsSource.GetRowByOther(this.m_Methods_Subheadings.Current.PID.ToString()); if (dr != null) { _Entity_SubInfo m_Entity_SubInfo = new _Entity_SubInfo(); _ObjectSource.GetObject(m_Entity_SubInfo, dr); _Methods_Fixed m_Methods_Fixed = null; if (m_Entity_SubInfo.SSLB.Equals(0)) { m_Methods_Fixed = new _Methods_Fixed(this.CurrentBusiness, this.Activitie, m_Entity_SubInfo); } else { m_Methods_Fixed = new _Mothods_MFixed(this.CurrentBusiness, this.Activitie, m_Entity_SubInfo); } DataRow de_dr = this.Activitie.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["定额表"].Select(string.Format("DINGEH='{0}'", m_deh)).FirstOrDefault(); if (de_dr != null) { _Entity_SubInfo m_ZM_Entity_SubInfo = new _Entity_SubInfo(); GLODSOFT.QDJJ.BUSINESS._Methods.SetSubheadingsInfo(m_ZM_Entity_SubInfo, de_dr, this.Activitie.Property.Libraries.FixedLibrary.FullName); m_ZM_Entity_SubInfo.XMBM += " *" + xs + ""; m_Methods_Fixed.Create(this.m_Methods_Subheadings.Current.Sort, m_ZM_Entity_SubInfo); this.m_IFHS = true; } } //SubSegmentForm m_ParentForm = this.AParentForm as SubSegmentForm; //if (m_ParentForm != null) //{ // m_ParentForm.BindSubSegmentList(); //} this.m_IFHS = true; } } }
/// <summary> /// 删除子目包括当前清单 /// </summary> public override void RemoveAllChild() { DataRow[] gljRows = null; DataRow[] scRows = null; DataRow[] zmqfRows = null; DataRow[] cszmqfRows = null; DataRow[] azzjfRows = null; _SubSegmentsSource source = this.Unit.StructSource.ModelSubSegments; DataRow[] rows = source.Select(string.Format("PID = {0}", this.Current.ID)); foreach (DataRow row in rows) { gljRows = this.Unit.StructSource.ModelQuantity.Select("ZMID = " + row["id"].ToString()); scRows = this.Unit.StructSource.ModelStandardConversion.Select("ZMID = " + row["id"].ToString()); zmqfRows = this.Unit.StructSource.ModelSubheadingsFee.Select("ZMID = " + row["id"].ToString()); cszmqfRows = this.Unit.StructSource.ModelPSubheadingsFee.Select("ZMID = " + row["id"].ToString()); azzjfRows = this.Unit.StructSource.ModelIncreaseCosts.Select("ZMID = " + row["id"].ToString()); foreach (DataRow glj in gljRows) { glj.Delete(); } foreach (DataRow sc in scRows) { sc.Delete(); } foreach (DataRow zmqf in zmqfRows) { zmqf.Delete(); } foreach (DataRow cszmqf in cszmqfRows) { cszmqf.Delete(); } foreach (DataRow azzjf in azzjfRows) { azzjf.Delete(); } row.Delete(); } DataRow r = source.GetRowByOther(this.Current.ID.ToString()); if (r != null) { this.RemoveParent(r); } //DataRow[] rows = source.Select(string.Format("UnId = {0} and SSLB ={1} and PID = {2}", this.Current.UnID, this.Current.SSLB, this.Current.PID), string.Empty, DataViewRowState.CurrentRows); //if (rows.Length < 2) //{ // DataRow row = source.GetRowByOther(this.Current.PID.ToString()); // if(row!=null) // this.RemoveParent(row); //} //else //{ // DataRow r= source.GetRowByOther(this.Current.ID.ToString()); // if (r != null) r.Delete(); //} }