Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
        private void SetUnitProject(object o)
        {
            SetInfo      info        = (SetInfo)o;
            _Engineering Engineering = info.Engineering;
            _UnitProject UnitProject = info.UnitProject;
            单位工程         dx          = info.dw;

            SetOtherProject(UnitProject.Property.OtherProject, dx.其他项目表, dx);

            _Common.Activitie = UnitProject;//给当前的单位工程赋值



            #region 分部分项对象以及赋值
            //UnitProject.Property.SubSegments = new _SubSegments(UnitProject);//分部分项对象
            SetSubSegments(UnitProject.Property.SubSegments, dx.分部分项表, UnitProject, dx);
            #endregion


            #region 措施项目对象以及赋值
            //UnitProject.Property.MeasuresProject = new _MeasuresProject(UnitProject);//措施项目对象
            //UnitProject.Property.MeasuresProject.IsInit = false;
            SetMeasuresProject(UnitProject.Property.MeasuresProject, dx.措施项目表, UnitProject, dx);
            #endregion

            //UnitProject.Property.Metaanalysis = new _Metaanalysis(UnitProject);//单位工程汇总对象
            //UnitProject.Property.Metaanalysis.IsInit = false;
            SetMetaanalysis(UnitProject.Property.Metaanalysis, dx);


            // UnitProject.Property.QuantityUnitSummaryList = new _QuantityUnitSummaryList(UnitProject);
        }
Beispiel #3
0
        /// <summary>
        /// 单项工程赋值
        /// </summary>
        /// <param name="Engineering"></param>
        /// <param name="dx"></param>
        private void SetEngineering(_Engineering Engineering, 单项工程 dx)
        {
            //添加到项目结构表
            (this.m_Business as _Pr_Business).Add(Engineering);
            if (dx.单位工程 == null)
            {
                return;
            }
            string[] fNames = this.FileName.Split('.');
            if (fNames.Length < 2)
            {
                MsgBox.Alert("文件类型错误!");
                return;
            }
            foreach (单位工程 item in dx.单位工程)
            {
                XmlUnitWorker unit = new XmlUnitWorker(this.m_Business, item, Engineering, this);

                unit.FileType               = fNames[1];
                unit.RunWorkerCompleted    += new System.ComponentModel.RunWorkerCompletedEventHandler(unit_RunWorkerCompleted);
                unit.RunTreadPoolCompleted += new RunTreadPoolCompleted(unit_RunTreadPoolCompleted);
                unit.js = this.建设项目;
                unit.Begin();
            }
        }
Beispiel #4
0
        private void Remove(DataRowView p_View)
        {
            //如果当前有子行
            //如果深度是2 直接删除 如果深度是1 删除所有子节点
            int deep = ToolKit.ParseInt(p_View["DEEP"]);

            if (deep == 1)
            {
                int id = ToolKit.ParseInt(p_View["ID"]);
                //单项删除
                DataRow[] rows = CurrentSource.Select(string.Format("PID = {0}", id));
                if (rows != null)
                {
                    foreach (DataRow r in rows)
                    {
                        switch (r.RowState)
                        {
                        case DataRowState.Added:    //新增的数据直接删除
                            r.Delete();
                            break;

                        case DataRowState.Modified:
                        case DataRowState.Unchanged:
                            //添加到删除对象清单
                            _COBJECTS info = new _COBJECTS();
                            _ObjectSource.GetObject(info, r);
                            DelTable.Add(info.ID, info);
                            r.Delete();
                            break;
                        }
                    }
                }
            }

            //处理删除单项工程
            switch (p_View.Row.RowState)
            {
            case DataRowState.Added:
                p_View.Delete();
                break;

            case DataRowState.Modified:
            case DataRowState.Unchanged:
                //添加到删除对象清单
                _COBJECTS info = new _COBJECTS();
                _ObjectSource.GetObject(info, p_View);
                DelTable.Add(info.ID, info);
                p_View.Delete();
                break;
            }

            p_View.Delete();
            CurrEn = null;
        }
Beispiel #5
0
 /// <summary>
 /// 删除指定单项工程选项卡(如果存在)
 /// </summary>
 /// <param name="infos"></param>
 public void Remove(_Engineering infos)
 {
     foreach (_UnitProject obj in infos.StrustObject.ObjectList.Values)
     {
         XtraTabPageEx xtp = this.Find((obj as _UnitProject));
         if (xtp != null)
         {
             this.TabPages.Remove(xtp);
         }
     }
 }
Beispiel #6
0
        /// <summary>
        /// 单位工程排序对象
        /// </summary>
        void ProjWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            //仅读取数据
            this.m_Business.Create();
            this.CProjects.Name         = this.CProjects.NodeName = m_建设项目.项目名称;
            this.m_Business.Current.Key = this.m_Business.Current.ObjectKey;
            if (!string.IsNullOrEmpty(this.m_建设项目.招标信息表.计价依据))
            {
                this.CProjects.DEGZ = this.m_建设项目.招标信息表.计价依据.ToString();
                this.CProjects.QDGZ = "2009";
            }
            else
            {
                this.CProjects.DEGZ = "2009";
                this.CProjects.QDGZ = "2009";
            }
            _Files file = new _Files();

            file.ChangeExtName(this.FileName, _Files.ProjectExName);
            //创建一个新的对象
            this.m_Business.Current.Files = file;
            UnitCount = this.Count;

            (this.m_Business as _Pr_Business).CreateFile();
            (this.m_Business as _Pr_Business).BeginData();
            // 还原项目结构表(还原当前项目)
            this.m_Business.Current.StructSource.ModelProject.Add(this.m_Business.Current);

            //(this.m_Business as _Pr_Business).AddUnit(this.m_Business.Current);

            foreach (单项工程 item in m_建设项目.单项工程)
            {
                _Engineering Engineering = this.CProjects.Create() as _Engineering;
                //Engineering.Sort = ++this.CProjects.EnSort;
                Engineering.Name     = item.单项工程名称;
                Engineering.NodeName = item.单项工程名称;
                Engineering.Deep     = 1;
                SetEngineering(Engineering, item);
            }


            this.SetZTB();
            //this.m_Business.EndCreate();
            while (true)
            {
                if (Completed)
                {
                    Thread.Sleep(500);
                    break;
                }
            }
        }
Beispiel #7
0
 public _Projects Import()
 {
     this.m_Business.Create();
     this.m_CProjects = this.m_Business.Current as _Projects;
     this.m_CProjects.Property.Name = m_建设项目.项目名称;
     this.m_Business.EndCreate();
     //APP.WorkFlows.Container.EndCreate();
     foreach (单项工程 item in m_建设项目.单项工程)
     {
         _Engineering Engineering = this.m_CProjects.Create() as _Engineering;
         SetEngineering(Engineering, item);
     }
     //  this.m_Business.EndCreate();
     return(this.m_CProjects);
     // return null;
 }
Beispiel #8
0
        private void StartThread(SetInfo info)
        {
            _UnitProject UnitProject = info.UnitProject;
            单位工程         item        = info.dw;
            _Engineering Engineering = info.Engineering;

            UnitProject.Property.Basis.Name = item.单位工程名称;
            UnitProject.Directory.NodeName  = item.单位工程名称;
            UnitProject.Property.Basis.DEGZ = this.m_建设项目.招标信息表.计价依据.ToString();
            UnitProject.Property.Basis.QDGZ = this.m_建设项目.招标信息表.计价依据.ToString();

            SetLibName(UnitProject, item);
            (this.m_Business as _Pr_Business).AddChild(Engineering, UnitProject);
            //UnitProject.Init(APP.Application);
            APP.Methods.Init(UnitProject);
            ThreadPool.SetMaxThreads(10, 10);
            ThreadPool.QueueUserWorkItem(new WaitCallback(SetUnitProject), info);
        }
Beispiel #9
0
        /// <summary>
        /// 单位工程赋值
        /// </summary>
        /// <param name="Engineering"></param>
        /// <param name="UnitProject"></param>
        /// <param name="dx"></param>
        private void SetUnitProject(_Engineering Engineering, _UnitProject UnitProject, 单位工程 dx)
        {
            //this.m_DWGC = dx;
            //m_UnitProject = UnitProject;
            UnitProject.Property.Basis.Name = dx.单位工程名称;
            //通知正在处理的单位工程
            OnRevertXmlObject(this, UnitProject);
            UnitProject.Directory.NodeName  = dx.单位工程名称;
            UnitProject.Property.Basis.DEGZ = this.m_建设项目.招标信息表.计价依据.ToString();
            UnitProject.Property.Basis.QDGZ = this.m_建设项目.招标信息表.计价依据.ToString();

            SetLibName(UnitProject, dx);
            //APP.WorkFlows.Container.AddChild(Engineering, UnitProject);
            (this.m_Business as _Pr_Business).AddChild(Engineering, UnitProject);
            //UnitProject.Property.OtherProject = new _OtherProject(UnitProject);//其他项目对象
            //UnitProject.Property.OtherProject.IsInit = false;
            //UnitProject.Init(APP.Application);
            APP.Methods.Init(UnitProject);
            SetOtherProject(UnitProject.Property.OtherProject, dx.其他项目表, dx);

            _Common.Activitie = UnitProject;//给当前的单位工程赋值



            #region 分部分项对象以及赋值
            //UnitProject.Property.SubSegments = new _SubSegments(UnitProject);//分部分项对象
            SetSubSegments(UnitProject.Property.SubSegments, dx.分部分项表, UnitProject, dx);
            #endregion


            #region 措施项目对象以及赋值
            //UnitProject.Property.MeasuresProject = new _MeasuresProject(UnitProject);//措施项目对象
            //UnitProject.Property.MeasuresProject.IsInit = false;
            SetMeasuresProject(UnitProject.Property.MeasuresProject, dx.措施项目表, UnitProject, dx);
            #endregion

            //UnitProject.Property.Metaanalysis = new _Metaanalysis(UnitProject);//单位工程汇总对象
            //UnitProject.Property.Metaanalysis.IsInit = false;
            SetMetaanalysis(UnitProject.Property.Metaanalysis, dx);


            // UnitProject.Property.QuantityUnitSummaryList = new _QuantityUnitSummaryList(UnitProject);
        }
Beispiel #10
0
        /// <summary>
        /// 添加一个新的单项工程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            //添加单项工程到列表
            if (this.txt_Name.Text == string.Empty)
            {
                return;
            }
            //项目名称
            string sNewName = this.txt_Name.Text;

            //验证此名称是否存在(在项目中 此单项工程是否存在)
            if (!this.isExist(sNewName, EObjectType.Engineering))
            {
                //创建单项工程
                _Engineering en = this.CurrentBusiness.Current.Create() as _Engineering;
                en.Name = en.NodeName = sNewName;
                //加入单项工程
                //this.projectTrees1.bindingSource1.Add(en.Directory);

                //this.projectTrees1.DataBind(CurrentSource);

                en.Sort = ++this.EnSort;
                en.Key  = ++this.ObjectKey;
                en.PKey = this.CurrentBusiness.Current.Key;
                en.CODE = this.CurrentBusiness.Current.CODE + en.Sort.ToString().PadLeft(2, '0');
                _ObjectSource.Add(en, this.CurrentSource);
                this.AppendUnit(en);

                this.projectTrees1.bindingSource1.ResetBindings(true);
                //可编辑
                this.projectTrees1.repositoryItemTextEdit1          = new RepositoryItemTextEdit();
                this.projectTrees1.repositoryItemTextEdit1.NullText = "请输入名称";
                this.txt_Name.ResetText();
                this.ExaCurr();
            }
            else
            {
                MessageBox.Show(string.Format("您要添加的单项工程[{0}]已经存在,请修改名称后尝试!", sNewName), "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.txt_Name.Focus();
                this.txt_Name.SelectAll();
            }
        }
Beispiel #11
0
        // public delegate void ParameterizedThreadStart(_Engineering e,_UnitProject u,单位工程 d);

        /// <summary>
        /// 单项工程赋值
        /// </summary>
        /// <param name="Engineering"></param>
        /// <param name="dx"></param>
        private void SetEngineering(_Engineering Engineering, 单项工程 dx)
        {
            Engineering.Property.Name = dx.单项工程名称;
            OnRevertXmlObject(this, Engineering);
            // APP.WorkFlows.Container.AddChild(this.m_CProjects, Engineering);
            (this.m_Business as _Pr_Business).Add(Engineering);
            if (dx.单位工程 == null)
            {
                return;
            }
            foreach (单位工程 item in dx.单位工程)
            {
                _UnitProject UnitProject = Engineering.Create();
                SetInfo      info        = new SetInfo();
                info.Engineering = Engineering;
                info.UnitProject = UnitProject;
                info.dw          = item;
                //StartThread(info);
                SetUnitProject(Engineering, UnitProject, item);
            }
        }
Beispiel #12
0
        /// <summary>
        /// 获取并绑定指定的项目对象
        /// </summary>
        private void InitEn(_COBJECTS p_Info)
        {
            //1.弱类型是单项工程
            //2.若为单位工程
            switch (p_Info.ObjectType)
            {
            case EObjectType.Engineering:
                this.CurrEn = p_Info as _Engineering;
                break;

            case EObjectType.UnitProject:
                this.CurrEn = p_Info.Parent as _Engineering;
                break;

            default:
                this.lbl_EnName.Text = "请选择单项工程";
                this.CurrEn          = null;
                return;
            }
            //绑定并且设置当前单项工程对象
            this.lbl_EnName.Text = this.CurrEn.Name;
        }
Beispiel #13
0
        /// <summary>
        ///公开的为CObject对象使用前调用的初始化对象(此前所有初始化数据对象的地方统一在此处调用)
        /// </summary>
        /// <param name="p_obj">业务对象</param>
        public void Init(_COBJECTS p_Info)
        {
            if (p_Info is _UnitProject)
            {
                _UnitProject info = p_Info as _UnitProject;
                this.Init(info);
                return;
            }

            if (p_Info is _Projects)
            {
                _Projects info = p_Info as _Projects;
                this.Init(info);
                return;
            }
            if (p_Info is _Engineering)
            {
                _Engineering info = p_Info as _Engineering;
                this.Init(info);
                return;
            }
        }
Beispiel #14
0
        /// <summary>
        /// 为指定的单位工程配置有关信息
        /// </summary>
        /// <param name="up"></param>
        void SetUnitProject(_UnitProject p_info, DataRowView row)
        {
            /*
             *  ProType  措施项目
             *  PGCDD 其他项目
             *  PJFCX 汇总分析
             */

            //此方法需要初始化所有单项工程信息
            //名称处理
            _Engineering info = this.CurrEn;

            //规则与库处理
            p_info.QDLibName = row["ListBased"].ToString().Trim();
            p_info.DELibName = row["FixedBased"].ToString().Trim();
            //p_info.QDGZ = this.CurrEn.QDGZ;
            //p_info.DEGZ = this.CurrEn.DEGZ;
            //图库
            p_info.TJLibName = row["AtlasBased"].ToString().Trim();
            //专业类别
            p_info.PrfType = row["PrjType"].ToString().Trim();
            //关于默认模板
            p_info.ProType = row["ProType"].ToString().Trim();
            //p_info.PGCDD = this.CurrEn.PGCDD;
            //p_info.PJFCX = this.CurrEn.PJFCX;

            //继承的单项工程属性
            //p_info.Property.Basis = info.Property.Basis.Copy() as _CBasis;
            //重新获取名称
            p_info.Name         = row["Name"].ToString();
            p_info.NodeName     = p_info.Name;
            p_info.Sort         = ++this.UnSoft;
            p_info.CODE         = info.CODE + p_info.Sort.ToString().PadLeft(3, '0');
            p_info.TemplateType = "0";//
            p_info.Key          = ++this.ObjectKey;
            p_info.PKey         = info.Key;
            //APP.Methods.Init(p_info);
        }
Beispiel #15
0
 /// <summary>
 ///公开的为CObject对象使用前调用的初始化对象(此前所有初始化数据对象的地方统一在此处调用)
 /// </summary>
 /// <param name="p_obj">业务对象</param>
 public void Init(_Engineering p_Info)
 {
     p_Info.Application = APP.Application;
 }
Beispiel #16
0
        /// <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;
            }
        }