Example #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);
 }
Example #2
0
 public void CreateEdit(string parentid, string sYear, string eYear, string status, string vol, string mark, string col5)
 {
     Ps_Table_Edit edit = new Ps_Table_Edit();
     edit.ID += "|" + GetProjectID;
     edit.ParentID = parentid;
     edit.StartYear = sYear;
     edit.FinishYear = eYear;
     edit.ProjectID = GetProjectID;
     edit.Status = status;
     edit.Volume = vol;
     edit.Col4 = mark;
     edit.Col5 = col5;
     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);
 }
Example #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();
        }
Example #4
0
        //修改
        private void simpleButton3_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;
                }

            }
            if (gridView1.FocusedRowHandle < 0)
            {
                MessageBox.Show("请选择一条记录!"); return;
            }
            string id = this.gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString();

            Ps_Table_Edit edit = Common.Services.BaseService.GetOneByKey<Ps_Table_Edit>(id);

            if (edit.Status == "扩建/改造" || edit.Status == "拆除")
            {
                Ps_Table_Edit edit1 = new Ps_Table_Edit();
                edit1.ID = edit.ID;
                edit1.ParentID = edit.ParentID;
                edit1.Sort = edit.Sort;
                edit1.Status = comboBoxEdit1.Text;
                edit1.StartYear = comboBoxEdit2.Text;
                edit1.FinishYear = comboBoxEdit3.Text;
                edit1.Volume = spinEdit1.Value.ToString();
                edit1.ProjectID = GetProject;
                edit.Col4 = mark;
                Common.Services.BaseService.Update("UpdatePs_Table_Edit", edit1);
                string conn = "ParentID='" + parentid + "'";
                list = Common.Services.BaseService.GetList<Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
                LoadGridData();
                label7.Text = GetCurVolumn();
               }

               else
               MessageBox.Show("只能修改扩建/改造或拆除的记录。");
        }
Example #5
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();
        }