示例#1
0
        /// <summary>
        /// 刷新数据到分部分项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (this.Activitie == null || this.CurrentBusiness == null)
            {
                MsgBox.Alert("请打开单位工程再刷新数据!");
                return;
            }
            //_Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness);
            //AlertForm form = new AlertForm();
            //form.Text = "自动生成分部分项";
            //form.Content.Text = "当清单数据已经自动生成过(不含手动添加的数据),“追加”则直接新增一条新的清单;“替换”只替换自动生成的清单编码中编码最大的一条清单;“取消”则取消当前操作";
            ////form.Content.Text = "当清单数据已经自动生成过(不含手动添加的数据),“追加”则直接新增一条新的清单;“取消”则取消当前操作";
            //DialogResult d = form.ShowDialog();
            //if (d == DialogResult.Yes)
            //{

            //BackgroundWorker OpenUnitWorker = new BackgroundWorker();
            //OpenUnitWorker.WorkerReportsProgress = false;
            //OpenUnitWorker.DoWork += new DoWorkEventHandler(OpenUnitWorker_DoWork);
            //OpenUnitWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OpenUnitWorker_RunWorkerCompleted);
            //OpenUnitWorker.RunWorkerAsync();
            //ProgressFrom pform = new ProgressFrom(OpenUnitWorker);
            //pform.ShowDialog();

            _Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness);

            infomation.CreatAll(true);
            MsgBox.Alert("处理成功");
            this.Close();

            //    //this.Activitie.Property.SubSegments.IsZDSC = true;
            //infomation.CreatAll(true);
            //}
            //if (d == DialogResult.No)
            //{
            //    BackgroundWorker OpenUnitWorker1 = new BackgroundWorker();
            //    OpenUnitWorker1.WorkerReportsProgress = false;
            //    OpenUnitWorker1.DoWork += new DoWorkEventHandler(OpenUnitWorker1_DoWork);
            //    OpenUnitWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OpenUnitWorker1_RunWorkerCompleted);
            //    OpenUnitWorker1.RunWorkerAsync();
            //    ProgressFrom pform1 = new ProgressFrom(OpenUnitWorker1);
            //    pform1.ShowDialog();


            //   // this.Activitie.Property.SubSegments.IsZDSC = true;
            //    //infomation.CreatAll(false);
            //}
        }
示例#2
0
        /// <summary>
        /// 刷新到措施项目
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.Activitie == null || this.CurrentBusiness == null)
            {
                MsgBox.Alert("请打开单位工程再刷新数据!");
                return;
            }
            if (this.dtDE.Rows.Count > 0)
            {
                bool Is_TH = false;
                bool Is_CZ = false;
                using (var calculator = new Calculator(CurrentBusiness, Activitie))
                {
                    foreach (DataRow item in this.dtDE.Rows)
                    {
                        if (Is_CZ)
                        {
                            break;
                        }
                        //根据位置找清单
                        DataRow[] rows = this.Activitie.StructSource.ModelMeasures.Select("XMBM='" + item["WZ"] + "'", "id desc");
                        if (rows.Length > 0)
                        {
                            _Entity_SubInfo info1 = new _Entity_SubInfo();
                            _ObjectSource.GetObject(info1, rows[0]);
                            DataRow[] rowsDE = this.Activitie.StructSource.ModelMeasures.Select(string.Format(" ZDSC=True and XMBM='{0}' and PID='{1}'", item["DEBH"], info1.ID), "id desc");
                            if (rowsDE.Length > 0)
                            {
                                DialogResult dl = MsgBox.Show("措施定额已存在是否替换?", MessageBoxButtons.YesNoCancel);
                                switch (dl)
                                {
                                case DialogResult.Cancel:
                                    return;

                                case DialogResult.Yes:
                                    Is_TH = true;
                                    break;

                                case DialogResult.No:
                                    Is_TH = false;
                                    break;
                                }
                                Is_CZ = true;
                            }

                            calculator.Rows.Add(item);
                        }
                    }
                }
                _Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness);
                try
                {
                    infomation.CreateCSZM(this.dtDE.Select(), Is_TH);
                    MsgBox.Alert("添加成功!");
                }
                catch (Exception)
                {
                    MsgBox.Alert("您选择的定额库不正确!");
                }
            }
            else
            {
                MsgBox.Alert("请先确定措施定额!");
            }
        }
示例#3
0
        /// <summary>
        /// 打开进度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OpenUnitWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            _Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness);

            infomation.CreatAll(true);
        }
示例#4
0
        /// <summary>
        /// 打开进度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //void OpenUnitWorker_DoWork(object sender, DoWorkEventArgs e)
        void doOpen()
        {
            try
            {
                if (this.Activitie == null || this.CurrentBusiness == null)
                {
                    MsgBox.Alert("请打开单位工程再刷新数据!");
                    return;
                }
                _Methods_Infomation infomation = new _Methods_Infomation(this.Activitie, this.CurrentBusiness);
                DataRowView         v          = this.QDSource.Current as DataRowView;
                if (v == null)
                {
                    MsgBox.Alert("当前没有清单!");
                    return;
                }
                if (ToolKit.ParseBoolen(v["Check"]))
                {
                    //DataRow Einfo = infomation.Exists(v["QDBH"].ToString());
                    DataRow Einfo = null;
                    if (v.DataView.Table.Columns.Contains("BZ"))
                    {
                        //Einfo = infomation.Exists(v["BZ"].ToString());
                        Einfo = infomation.Exists(v["TJ"].ToString());
                    }
                    if (Einfo != null)
                    {
                        //DialogResult dl = MsgBox.Show("清单已存在是否替换?", MessageBoxButtons.YesNoCancel);
                        //switch (dl)
                        //{
                        //   case DialogResult.Cancel:
                        //       return;
                        //    case DialogResult.Yes:
                        string qdbh = v["QDBH"].ToString();
                        infomation.Creat(v.Row, true);
                        MsgBox.Alert("替换清单" + qdbh + "成功!");
                        //        break;
                        //    case DialogResult.No:
                        //        infomation.Creat(v.Row, false);
                        //        MsgBox.Alert("追加清单" + v["QDBH"].ToString() + "成功!");
                        //        break;
                        //}
                    }
                    else
                    {
                        bool      Is_TH     = false;
                        bool      Is_CZ     = false;
                        DataRow[] rowsNewDE = APP.UnInformation.DETable.Select(string.Format("TJ='{0}' and WZLX='措施项目'", v.Row["TJ"]));
                        foreach (DataRow item in rowsNewDE)
                        {
                            if (Is_CZ)
                            {
                                break;
                            }
                            //根据位置找清单
                            DataRow[] rows = this.Activitie.StructSource.ModelMeasures.Select("XMBM='" + item["WZ"] + "'", "id desc");
                            if (rows.Length > 0)
                            {
                                _Entity_SubInfo info1 = new _Entity_SubInfo();
                                _ObjectSource.GetObject(info1, rows[0]);
                                DataRow[] rowsDE = this.Activitie.StructSource.ModelMeasures.Select(string.Format(" ZDSC=True and XMBM='{0}' and PID='{1}'", item["DEBH"], info1.ID), "id desc");
                                if (rowsDE.Length > 0)
                                {
                                    DialogResult dl = MsgBox.Show("措施定额已存在是否替换?", MessageBoxButtons.YesNoCancel);
                                    switch (dl)
                                    {
                                    case DialogResult.Cancel:
                                        return;

                                    case DialogResult.Yes:
                                        Is_TH = true;
                                        break;

                                    case DialogResult.No:
                                        Is_TH = false;
                                        break;
                                    }
                                    Is_CZ = true;
                                }
                            }
                        }
                        infomation.Creat(v.Row, Is_TH);
                        MsgBox.Alert("添加清单" + v["QDBH"].ToString() + "成功!");
                    }
                }
                else
                {
                    MsgBox.Alert("当前清单没有选中!");
                }

                //AlertForm form = new AlertForm();
                //form.Text = "自动生成分部分项";
                //form.Content.Text = "当清单数据已经自动生成过(不含手动添加的数据),\"追加\"则直接新增一条新的清单;\"替换\"只替换自动生成的清单编码中编码最大的一条清单;\"取消\"则取消当前操作";
                //DialogResult d = form.ShowDialog();
                //if (d == DialogResult.Yes)
                //{
                //    this.Activitie.Property.SubSegments.IsZDSC = true;
                //    this.m_Information.CreatAll(true);
                //}
                //if (d == DialogResult.No)
                //{
                //    this.Activitie.Property.SubSegments.IsZDSC = true;
                //    this.m_Information.CreatAll(false);
                //}
            }
            catch (Exception)
            {
                throw;
            }
        }