コード例 #1
0
ファイル: UCDeviceFZX.cs プロジェクト: EdgarEDT/myitoppsp
 public override void Add()
 {
     frmFZXdlg dlg = new frmFZXdlg();
     dlg.ProjectSUID = this.ProjectID;
     dlg.Name = "";
     PSPDEV pd = new PSPDEV();
     pd.AreaID = ParentID;
     pd.ProjectID = this.ProjectID;
     dlg.DeviceMx=pd;
     if (dlg.ShowDialog() == DialogResult.OK) {
         //���Ӽ�¼
         PSPDEV dev = dlg.DeviceMx;
         dev.ProjectID = this.ProjectID;
         UCDeviceBase.DataService.Create("InsertPSPDEV", 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";
             }
         }
         DataRow row=datatable1.NewRow();
         Itop.Common.DataConverter.ObjectToRow(dev, row);
         datatable1.Rows.Add(row);
     }
 }
コード例 #2
0
ファイル: UCDeviceFZX.cs プロジェクト: EdgarEDT/myitoppsp
        public override void Edit()
        {
            frmFZXdlg dlg = new frmFZXdlg();
            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);
                }
            }
        }
コード例 #3
0
ファイル: UCDeviceFZX.cs プロジェクト: github188/myitoppsp
        public override void Add()
        {
            frmFZXdlg dlg = new frmFZXdlg();

            dlg.ProjectSUID = this.ProjectID;
            dlg.Name        = "";
            PSPDEV pd = new PSPDEV();

            pd.AreaID    = ParentID;
            pd.ProjectID = this.ProjectID;
            dlg.DeviceMx = pd;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //增加记录
                PSPDEV dev = dlg.DeviceMx;
                dev.ProjectID = this.ProjectID;
                UCDeviceBase.DataService.Create("InsertPSPDEV", 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";
                    }
                }
                DataRow row = datatable1.NewRow();
                Itop.Common.DataConverter.ObjectToRow(dev, row);
                datatable1.Rows.Add(row);
            }
        }
コード例 #4
0
ファイル: UCDeviceFZX.cs プロジェクト: github188/myitoppsp
        public override void Edit()
        {
            frmFZXdlg dlg = new frmFZXdlg();
            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);
                }
            }
        }
コード例 #5
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (GetDevice == null)
            {
                MessageBox.Show("请选择设备种类。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (GetDevice.GetType() == "20")
            {
                frmBDZdlg dlg = new frmBDZdlg();
                //dlg.DeviceMx = dev as PSP_Substation_Info;
                dlg.IsRead = false;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.AreaID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSP_Substation_Info>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.UID);
                    devic.Add("name", dlg.DeviceMx.Title);
                    devic.Add("device", dlg.DeviceMx);
                }
            }

            if (GetDevice.GetType() == "30")
            {
                frmDYdlg dlg21 = new frmDYdlg();
                //dlg21.DeviceMx = dev as PSP_PowerSubstation_Info;
                dlg21.IsRead = false;
                if (dlg21.ShowDialog() == DialogResult.OK)
                {
                    dlg21.DeviceMx.AreaID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSP_PowerSubstation_Info>(dlg21.DeviceMx);
                    devic.Add("id", dlg21.DeviceMx.UID);
                    devic.Add("name", dlg21.DeviceMx.Title);
                    devic.Add("device", dlg21.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "05")
            {
                frmXLdlg dlg5 = new frmXLdlg();
                //dlg5.DeviceMx = dev as PSPDEV;
                if (dlg5.ShowDialog() == DialogResult.OK)
                {
                    dlg5.DeviceMx.ProjectID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg5.DeviceMx);
                    devic.Add("id", dlg5.DeviceMx.SUID);
                    devic.Add("name", dlg5.DeviceMx.Name);
                    devic.Add("device", dlg5.DeviceMx);
                    frmDS fd = new frmDS();
                    fd.ProjectSUID = ProjectID;
                    fd.InitData();
                    if (fd.ShowDialog() == DialogResult.OK)
                    {
                        PSP_ElcDevice pe = new PSP_ElcDevice();
                        pe.ProjectSUID = (string)fd.PJ;
                        pe.DeviceSUID  = dlg5.DeviceMx.SUID;
                        UCDeviceBase.DataService.Create <PSP_ElcDevice>(pe);
                    }
                }
            }
            if (GetDevice.GetType() == "70")
            {
                frmZXdlg dlg = new frmZXdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "71")
            {
                frmRDQdlg dlg = new frmRDQdlg();

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "72")
            {
                frmBYQTWOdlg dlg = new frmBYQTWOdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "50")
            {
                frmPWdlg dlg = new frmPWdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "50";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "51")
            {
                frmPWdlg dlg = new frmPWdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "51";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "52")
            {
                frmPWdlg dlg = new frmPWdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "52";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "55")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "55";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "56")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "56";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "57")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "57";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "58")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "58";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "59")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "59";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "61")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "61";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "62")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "62";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "63")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "63";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "64")
            {
                frmPWKGdlg dlg = new frmPWKGdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "64";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "74")
            {
                frmFZXdlg dlg = new frmFZXdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "74";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "73")
            {
                frmDXdlg dlg = new frmDXdlg();
                dlg.ProjectSUID = this.ProjectID;
                dlg.Name        = "";
                PSPDEV p = new PSPDEV();
                p.ProjectID  = this.ProjectID;
                dlg.DeviceMx = p;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "73";

                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (GetDevice.GetType() == "75")
            {
                frmLUXdlg dlg = new frmLUXdlg();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    dlg.DeviceMx.ProjectID = MIS.ProgUID;
                    dlg.DeviceMx.Type      = "75";
                    UCDeviceBase.DataService.Create <PSPDEV>(dlg.DeviceMx);
                    devic.Add("id", dlg.DeviceMx.SUID);
                    devic.Add("name", dlg.DeviceMx.Name);
                    devic.Add("device", dlg.DeviceMx);
                }
            }
            if (device != null && devic.Count > 0)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.Cancel;
            }
        }