コード例 #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 barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                Psp_Attachtable dev = Itop.Common.DataConverter.RowToObject <Psp_Attachtable>(row);
                if (Itop.Common.MsgBox.ShowYesNo("是否确认删除?") == DialogResult.Yes)
                {
                    string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + dev.S1 + "'";
                    IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                    if (list.Count > 0)
                    {
                        Services.BaseService.Delete <PSPDEV>(list[0]);
                    }
                    Itop.Client.Common.Services.BaseService.Delete <Psp_Attachtable>(dev);
                    ((DataTable)gridControl1.DataSource).Rows.Remove(row);
                }
            }
        }
コード例 #3
0
ファイル: UCDeviceBYQ3.cs プロジェクト: github188/myitoppsp
        public override void Edit()
        {
            frmBYQ3dlg dlg = new frmBYQ3dlg();
            DataRow    row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                PSPDEV dev = Itop.Common.DataConverter.RowToObject <PSPDEV>(row);
                if (dev.NodeType == "平衡节点")
                {
                    dev.NodeType = "0";
                }
                else if (dev.NodeType == "PQ节点")
                {
                    dev.NodeType = "1";
                }
                else if (dev.NodeType == "PV节点")
                {
                    dev.NodeType = "2";
                }
                if (dev.KSwitchStatus == "退出运行")
                {
                    dev.KSwitchStatus = "1";
                }
                else
                {
                    dev.KSwitchStatus = "0";
                }
                if (dev.UnitFlag == "p.u.")
                {
                    dev.UnitFlag = "0";
                }
                else
                {
                    dev.UnitFlag = "1";
                }
                dlg.DeviceMx    = dev;
                dlg.ProjectSUID = dev.ProjectID;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //更新记录
                    dev           = dlg.DeviceMx;
                    dev.ProjectID = this.ProjectID;
                    UCDeviceBase.DataService.Update <PSPDEV>(dev);
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "平衡节点";
                    }
                    else if (dev.NodeType == "1")
                    {
                        dev.NodeType = "PQ节点";
                    }
                    else if (dev.NodeType == "2")
                    {
                        dev.NodeType = "PV节点";
                    }
                    else
                    {
                        dev.NodeType = null;
                    }
                    if (dev.KSwitchStatus == "1")
                    {
                        dev.KSwitchStatus = "退出运行";
                    }
                    else
                    {
                        dev.KSwitchStatus = "投入运行";
                    }
                    if (dev.UnitFlag == "0")
                    {
                        dev.UnitFlag = "p.u.";
                    }
                    else
                    {
                        if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                        {
                            dev.UnitFlag = "kV/MW/MVar";
                        }
                        else
                        {
                            dev.UnitFlag = "Ohm/10-6Siem";
                        }
                    }
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                    string sql = "S1='" + dev.Name + "'and S4='三绕组变压器'";
                    IList <Psp_Attachtable> ilist = UCDeviceBase.DataService.GetList <Psp_Attachtable>("SelectPsp_AttachtableByCont", sql);
                    if (ilist.Count > 0)
                    {
                        Psp_Attachtable pdr = ilist[0];
                        pdr.ZHI       = dev.SiN;
                        pdr.S3        = dev.OperationYear;
                        pdr.startYear = dev.Date1;
                        pdr.endYear   = dev.Date2;
                        UCDeviceBase.DataService.Update <Psp_Attachtable>(pdr);
                    }
                }
            }
        }
コード例 #4
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;
                }
            }
        }
コード例 #5
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;
            }
        }