コード例 #1
0
ファイル: FrmPsEditWH.cs プロジェクト: github188/myitoppsp
        //删除
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            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 == "改造" || edit.Status == "拆除")
            {
                if (MessageBox.Show("确定删除这条记录吗?", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Common.Services.BaseService.Delete <Ps_Table_Edit>(edit);
                    string conn = "ParentID='" + parentid + "'";
                    list = Common.Services.BaseService.GetList <Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
                    LoadGridData();
                    label7.Text = GetCurVolumn();
                }
            }
            else
            {
                MessageBox.Show("只能删除扩建/改造或拆除的记录。");
            }
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: FrmPsEditWH.cs プロジェクト: github188/myitoppsp
        //修改
        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 == "改造" || 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;
                edit1.Col4       = mark;
                edit1.Col5       = edit.Col5;
                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("只能修改扩建、改造或拆除的记录。");
            }
        }
コード例 #4
0
ファイル: FrmPsEditWH.cs プロジェクト: github188/myitoppsp
        //增加
        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();
        }
コード例 #5
0
ファイル: FrmPsEdit.cs プロジェクト: github188/myitoppsp
 private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (gridView1.FocusedRowHandle == -1)
     {
         MessageBox.Show("请选择一条记录");
         return;
     }
     try
     {
         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 == "拆除")
         {
             comboBoxEdit1.Text = edit.Status;
             comboBoxEdit2.Text = edit.StartYear;
             comboBoxEdit3.Text = edit.FinishYear;
             spinEdit1.Value    = Convert.ToDecimal(edit.Volume);
         }
     }
     catch { }
 }
コード例 #6
0
ファイル: FrmPsEdit.cs プロジェクト: github188/myitoppsp
        //删除
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            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 == "拆除")
            {
                if (MessageBox.Show("确定删除这条记录吗?", "删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    Common.Services.BaseService.Delete <Ps_Table_Edit>(edit);
                    string conn = "ParentID='" + parentid + "'";
                    list = Common.Services.BaseService.GetList <Ps_Table_Edit>("SelectPs_Table_EditListByConn", conn);
                    LoadGridData();
                    label7.Text = GetCurVolumn();
                    if (typeTable == "500")
                    {
                        Ps_Table_500PH table = new Ps_Table_500PH();
                        table = Common.Services.BaseService.GetOneByKey <Ps_Table_500PH>(parentid);
                        if (comboBoxEdit1.Text == "扩建/改造")
                        {
                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                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 == "扩建/改造")
                        {
                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                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 == "扩建/改造")
                        {
                            string a = table.GetType().GetProperty("y" + comboBoxEdit3.Text).GetValue(table, null).ToString();
                            for (int i = int.Parse(comboBoxEdit3.Text); i <= yearRange.FinishYear; i++)
                            {
                                table.GetType().GetProperty("y" + i.ToString()).SetValue(table, Convert.ToDouble(a) - Convert.ToDouble(spinEdit1.Text), null);
                            }
                            Common.Services.BaseService.Update("UpdatePs_Table_100PH", table);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("只能删除扩建/改造或拆除的记录。");
            }
        }
コード例 #7
0
ファイル: FrmPsEdit.cs プロジェクト: github188/myitoppsp
        //增加
        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();
        }