예제 #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (comboBoxEdit3.Text == "")
            {
                MessageBox.Show("竣工年份不能为空"); return;
            }
            if (comboBoxEdit2.Text != "")
            {
                if (int.Parse(comboBoxEdit3.Text) < int.Parse(comboBoxEdit2.Text))
                {
                    MessageBox.Show("结束年必须大于开工年!"); return;
                }
            }
            DialogResult = DialogResult.OK;
            Ps_Table_Edit edit = new Ps_Table_Edit();

            edit.ID        += "|" + GetProject;
            edit.ParentID   = parentid;
            edit.StartYear  = comboBoxEdit2.Text;
            edit.FinishYear = comboBoxEdit3.Text;
            edit.ProjectID  = projectid;
            edit.Status     = "新建";
            edit.Volume     = spinEdit1.Text;
            edit.Col1       = comboBoxEdit1.Text;
            try
            {
                edit.Sort = OperTable.GetChildMaxSort() + 1;
            }
            catch { edit.Sort = 4; }
            if (edit.Sort < 4)
            {
                edit.Sort = 4;
            }
            Common.Services.BaseService.Create("InsertPs_Table_Edit", edit);
        }
예제 #2
0
        //增加
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (comboBoxEdit3.Text == "")
            {
                MessageBox.Show("竣工年份不能为空"); return;
            }
            if (comboBoxEdit1.Text != "已有" && comboBoxEdit2.Text != "")
            {
                if (int.Parse(comboBoxEdit3.Text) < int.Parse(comboBoxEdit2.Text))
                {
                    MessageBox.Show("竣工年必须大于开工年!"); return;
                }
            }
            // DialogResult = DialogResult.OK;
            Ps_Table_Edit edit = new Ps_Table_Edit();

            edit.ID        += "|" + GetProject;
            edit.ParentID   = parentid;
            edit.StartYear  = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit2.Text;
            edit.FinishYear = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit3.Text;
            edit.Status     = comboBoxEdit1.Text;
            edit.Volume     = this.spinEdit1.Text;
            edit.ProjectID  = GetProject;
            edit.Col4       = mark;
            try
            {
                edit.Sort = OperTable.GetChildMaxSort() + 1;
            }
            catch { edit.Sort = 4; }
            if (edit.Sort < 4)
            {
                edit.Sort = 4;
            }
            Common.Services.BaseService.Create("InsertPs_Table_Edit", edit);
            strResult.Add(textEdit1.Text);
            strResult.Add(comboBoxEdit3.Text);
            strResult.Add(spinEdit1.Value.ToString());
            string conn = "ParentID='" + parentid + "'";

            list = Common.Services.BaseService.GetList <Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
            LoadGridData();
            label7.Text = GetCurVolumn();
        }
예제 #3
0
        //增加
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (comboBoxEdit3.Text == "")
            {
                MessageBox.Show("竣工年份不能为空"); return;
            }
            if (comboBoxEdit1.Text != "已有" && comboBoxEdit2.Text != "")
            {
                if (int.Parse(comboBoxEdit3.Text) < int.Parse(comboBoxEdit2.Text))
                {
                    MessageBox.Show("竣工年必须大于开工年!"); return;
                }
            }
            // DialogResult = DialogResult.OK;
            Ps_Table_Edit edit = new Ps_Table_Edit();

            edit.ID        += "|" + GetProject;
            edit.ParentID   = parentid;
            edit.StartYear  = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit2.Text;
            edit.FinishYear = comboBoxEdit1.Text == "已有" ? "" : comboBoxEdit3.Text;
            edit.Status     = comboBoxEdit1.Text;
            edit.Volume     = this.spinEdit1.Text;
            edit.ProjectID  = GetProject;
            edit.Col4       = mark;
            try
            {
                edit.Sort = OperTable.GetChildMaxSort() + 1;
            }
            catch { edit.Sort = 4; }
            if (edit.Sort < 4)
            {
                edit.Sort = 4;
            }
            Common.Services.BaseService.Create("InsertPs_Table_Edit", edit);
            strResult.Add(textEdit1.Text);
            strResult.Add(comboBoxEdit3.Text);
            strResult.Add(spinEdit1.Value.ToString());
            string conn = "ParentID='" + parentid + "'";

            list = Common.Services.BaseService.GetList <Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
            if (typeTable == "500")
            {
                Ps_Table_500PH table = new Ps_Table_500PH();
                table = Common.Services.BaseService.GetOneByKey <Ps_Table_500PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {
                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();

                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_500PH", table);
                }
            }
            else if (typeTable == "200")
            {
                Ps_Table_200PH table = new Ps_Table_200PH();
                table = Common.Services.BaseService.GetOneByKey <Ps_Table_200PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {
                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();
                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_200PH", table);
                }
            }
            else if (typeTable == "100")
            {
                Ps_Table_100PH table = new Ps_Table_100PH();
                table = Common.Services.BaseService.GetOneByKey <Ps_Table_100PH>(parentid);
                if (comboBoxEdit1.Text == "扩建/改造")
                {
                    for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                    {
                        string a = table.GetType().GetProperty("y" + i.ToString()).GetValue(table, null).ToString();
                        table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) + Convert.ToDouble(spinEdit1.Text), null);
                    }
                    Common.Services.BaseService.Update("UpdatePs_Table_100PH", table);
                }
            }



            LoadGridData();
            label7.Text = GetCurVolumn();
        }