private void ProjectTAdjust(decimal d) { _Projects p = this.CurrentBusiness.Current as _Projects; DataRow[] EnRows = this.CurrentBusiness.Current.StructSource.ModelProject.Select("PID = 1"); foreach (DataRow row in EnRows) { _Engineering einfo = this.CurrentBusiness.Current.Create() as _Engineering; _ObjectSource.GetObject(einfo, row); DataRow[] UnRows = this.CurrentBusiness.Current.StructSource.ModelProject.Select(string.Format("PID = {0}", einfo.ID)); _UnitProject pinfo = null; foreach (DataRow r in UnRows) { pinfo = r["UnitProject"] as _UnitProject; if (pinfo == null) { //反序列化 pinfo = (this.CurrentBusiness as _Pr_Business).GetObject(r["OBJECT"]) as _UnitProject; //回写到表中 pinfo.InSerializable(einfo); _ObjectSource.GetObject(pinfo, r); this.CurrentBusiness.Current.StructSource.ModelProject.AppendUnit(pinfo); //pinfo.Property = new _Un_Property(pinfo); //pinfo.Reveal = new } UnitProject(d, pinfo); } } }
/// <summary> /// 循环添加数据 /// </summary> /// <param name="o"></param> /// <param name="Pid"></param> private void BuildRow(_COBJECTS o, int Pid, _Engineering P_ID) { DataRow row = this.m_Table.NewRow(); switch (o.ObjectType) { case EObjectType.Default: break; case EObjectType.PROJECT: row["ID"] = ++m; row["PID"] = Pid; row["XH"] = "整个项目"; row["XMMC"] = o.Property.Basis.Name; this.m_Table.Rows.Add(row); DataRow[] EnRows = this.CurrentBusiness.Current.StructSource.ModelProject.Select("PID = 1"); foreach (DataRow r in EnRows) { _Engineering einfo = this.CurrentBusiness.Current.Create() as _Engineering; _ObjectSource.GetObject(einfo, r); BuildRow(einfo, ToolKit.ParseInt(row["ID"]), einfo); } break; case EObjectType.Engineering: row["ID"] = ++m; row["PID"] = Pid; row["XH"] = "单项工程"; row["XMMC"] = o.Property.Basis.Name; this.m_Table.Rows.Add(row); _UnitProject pinfo = null; DataRow[] UnRows = this.CurrentBusiness.Current.StructSource.ModelProject.Select(string.Format("PID = {0}", P_ID.ID)); foreach (DataRow r in UnRows) { pinfo = r["UnitProject"] as _UnitProject; if (pinfo == null) { //反序列化 pinfo = (this.CurrentBusiness as _Pr_Business).GetObject(r["OBJECT"]) as _UnitProject; //回写到表中 pinfo.InSerializable(P_ID); _ObjectSource.GetObject(pinfo, r); this.CurrentBusiness.Current.StructSource.ModelProject.AppendUnit(pinfo); //pinfo.Property = new _Un_Property(pinfo); //pinfo.Reveal = new } BuildRow(pinfo, ToolKit.ParseInt(row["ID"]), null); } break; case EObjectType.UnitProject: row["ID"] = ++m; row["PID"] = Pid; row["XH"] = "单位工程"; row["XMMC"] = o.Property.Basis.Name; this.m_Table.Rows.Add(row); SetCUnitProjectOther(o, ToolKit.ParseInt(row["ID"])); break; default: break; } }