コード例 #1
0
        private void barButtonItem4_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                Psp_Attachtable PD  = Itop.Common.DataConverter.RowToObject <Psp_Attachtable>(row);
                Psp_Attachtable pdr = new Psp_Attachtable();
                Itop.Common.DataConverter.CopyTo <Psp_Attachtable>(PD, pdr);
                pdr.ID = Guid.NewGuid().ToString();
                pdr.S2 = "扩容";
                PD.S2  = "作废";
                Psp_AttachtableEdit PDT = new Psp_AttachtableEdit();
                PDT.SateType = "扩容";
                PDT.type     = Type;
                PDT.RowData  = pdr;
                if (PDT.ShowDialog() == DialogResult.OK)
                {
                    pdr = PDT.RowData;
                    string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + pdr.S1 + "'";
                    IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                    if (list.Count > 0)
                    {
                        PSPDEV dv = list[0];
                        dv.Name          = pdr.S1;
                        dv.OperationYear = pdr.S3;
                        dv.Date1         = pdr.startYear;
                        dv.Date2         = pdr.endYear;
                        if (!string.IsNullOrEmpty(pdr.S4))
                        {
                            if (pdr.S4.Contains("三绕组"))
                            {
                                dv.SiN  = pdr.ZHI;
                                dv.X1   = pdr.D1;
                                dv.X2   = pdr.D2;
                                dv.Type = "03";
                            }
                            else
                            {
                                dv.Burthen  = (decimal)pdr.ZHI;
                                dv.HuganTQ1 = pdr.D1;
                                dv.HuganTQ2 = pdr.D2;
                                dv.Type     = "02";
                            }
                        }
                        Services.BaseService.Update <PSPDEV>(dv);
                    }
                    Itop.Client.Common.Services.BaseService.Create <Psp_Attachtable>(pdr);
                    Itop.Client.Common.Services.BaseService.Update <Psp_Attachtable>(pdr);
                    //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));

                    //gridControl1.DataSource = datatable;
                }
            }
        }
コード例 #2
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                Psp_Attachtable     PD  = Itop.Common.DataConverter.RowToObject <Psp_Attachtable>(row);
                Psp_AttachtableEdit PDT = new Psp_AttachtableEdit();
                PDT.SateType = "修改";
                PDT.type     = Type;
                PDT.RowData  = PD;
                if (PDT.ShowDialog() == DialogResult.OK)
                {
                    Psp_Attachtable pdr = PDT.RowData;
                    Itop.Client.Common.Services.BaseService.Update <Psp_Attachtable>(pdr);
                    datatable.Rows.Remove(row);
                    ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + pdr.S1 + "'";
                    IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                    if (list.Count > 0)
                    {
                        PSPDEV dv = list[0];
                        dv.Name          = pdr.S1;
                        dv.OperationYear = pdr.S3;
                        dv.Date1         = pdr.startYear;
                        dv.Date2         = pdr.endYear;
                        if (!string.IsNullOrEmpty(pdr.S4))
                        {
                            if (pdr.S4.Contains("三绕组"))
                            {
                                dv.SiN  = pdr.ZHI;
                                dv.X1   = pdr.D1;
                                dv.X2   = pdr.D2;
                                dv.Type = "03";
                            }
                            else
                            {
                                dv.Burthen  = (decimal)pdr.ZHI;
                                dv.HuganTQ1 = pdr.D1;
                                dv.HuganTQ2 = pdr.D2;
                                dv.Type     = "02";
                            }
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }

                        dv.ProjectID = Itop.Client.MIS.ProgUID;
                        if (MessageBox.Show("是否需要修改更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (dv.Type == "02")
                            {
                                frmBYQ2dlg dlg = new frmBYQ2dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Update <PSPDEV>(dv);
                                }
                            }
                            else
                            {
                                frmBYQ3dlg dlg = new frmBYQ3dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Update <PSPDEV>(dv);
                                }
                            }
                        }
                    }
                    else
                    {
                        PSPDEV dv = new PSPDEV();
                        dv.Name          = pdr.S1;
                        dv.OperationYear = pdr.S3;
                        dv.Date1         = pdr.startYear;
                        dv.Date2         = pdr.endYear;
                        if (!string.IsNullOrEmpty(pdr.S4))
                        {
                            if (pdr.S4.Contains("三绕组"))
                            {
                                dv.SiN  = pdr.ZHI;
                                dv.X1   = pdr.D1;
                                dv.X2   = pdr.D2;
                                dv.Type = "03";
                            }
                            else
                            {
                                dv.Burthen  = (decimal)pdr.ZHI;
                                dv.HuganTQ1 = pdr.D1;
                                dv.HuganTQ2 = pdr.D2;
                                dv.Type     = "02";
                            }
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }

                        dv.ProjectID = Itop.Client.MIS.ProgUID;
                        dv.AreaID    = parentID;
                        if (MessageBox.Show("是否需要添加更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (dv.Type == "02")
                            {
                                frmBYQ2dlg dlg = new frmBYQ2dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Create <PSPDEV>(dv);
                                }
                            }
                            else
                            {
                                frmBYQ3dlg dlg = new frmBYQ3dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Create <PSPDEV>(dv);
                                }
                            }
                        }
                    }

                    //gridControl1.DataSource = datatable;
                }
            }
        }
コード例 #3
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Psp_AttachtableEdit PDT = new Psp_AttachtableEdit();

            if (string.IsNullOrEmpty(parentID))
            {
                Itop.Common.MsgBox.ShowYesNo("变电站或电源为空!");
                return;
            }
            // PDT.parentobj = ParentObj;
            Psp_Attachtable pdr = new Psp_Attachtable();

            pdr.Relatetable   = relatetable;
            pdr.RelatetableID = parentID;
            pdr.startYear     = startyear;
            pdr.endYear       = endyear;
            pdr.D1            = 1;
            pdr.D2            = 1;
            pdr.S2            = "新建";
            PDT.SateType      = "新建";
            pdr.S3            = DateTime.Now.Year.ToString();
            PDT.type          = Type;
            PDT.RowData       = pdr;
            if (PDT.ShowDialog() == DialogResult.OK)
            {
                pdr = PDT.RowData;

                Itop.Client.Common.Services.BaseService.Create <Psp_Attachtable>(pdr);
                //添加绕组变压器
                string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + pdr.S1 + "'";
                IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                if (list.Count > 0)
                {
                    PSPDEV dv = list[0];
                    dv.OperationYear = pdr.S3;
                    dv.AreaID        = parentID;
                    dv.Date1         = pdr.startYear;
                    dv.Date2         = pdr.endYear;
                    if (dv.Type == "02")
                    {
                        dv.HuganTQ1 = pdr.D1;
                        dv.HuganTQ2 = pdr.D2;
                        dv.Burthen  = (decimal)pdr.ZHI;
                    }
                    else
                    {
                        dv.X1       = pdr.D1;
                        dv.X2       = pdr.D2;
                        dv.HuganTQ2 = pdr.D2;
                        dv.SiN      = pdr.ZHI;
                    }
                    Services.BaseService.Update <PSPDEV>(dv);
                }
                else
                {
                    PSPDEV dv = new PSPDEV();
                    dv.Name          = pdr.S1;
                    dv.OperationYear = pdr.S3;
                    dv.Date1         = pdr.startYear;
                    dv.Date2         = pdr.endYear;
                    if (!string.IsNullOrEmpty(pdr.S4))
                    {
                        if (pdr.S4.Contains("三绕组"))
                        {
                            dv.SiN  = pdr.ZHI;
                            dv.X1   = pdr.D1;
                            dv.X2   = pdr.D2;
                            dv.Type = "03";
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }
                    }
                    else
                    {
                        dv.Burthen  = (decimal)pdr.ZHI;
                        dv.HuganTQ1 = pdr.D1;
                        dv.HuganTQ2 = pdr.D2;
                        dv.Type     = "02";
                    }

                    dv.ProjectID = Itop.Client.MIS.ProgUID;
                    dv.AreaID    = parentID;
                    if (MessageBox.Show("是否需要添加更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        if (dv.Type == "02")
                        {
                            frmBYQ2dlg dlg = new frmBYQ2dlg();
                            dlg.DeviceMx = dv;
                            if (dlg.ShowDialog() == DialogResult.OK)
                            {
                                dv = dlg.DeviceMx;
                                Services.BaseService.Create <PSPDEV>(dv);
                            }
                        }
                        else
                        {
                            frmBYQ3dlg dlg = new frmBYQ3dlg();
                            dlg.DeviceMx = dv;
                            if (dlg.ShowDialog() == DialogResult.OK)
                            {
                                dv = dlg.DeviceMx;
                                Services.BaseService.Create <PSPDEV>(dv);
                            }
                        }
                    }
                }

                //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                //gridControl1.DataSource = datatable;
            }
        }