Exemple #1
0
 public override void Add()
 {
     frmBDZdlg dlg = new frmBDZdlg();
     dlg.ProjectID = Itop.Client.MIS.ProgUID;
     dlg.Name = "";
     dlg.CsbuttonVisble(true);
     dlg.IsRead = false;
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         //���Ӽ�¼
         PSP_Substation_Info dev = dlg.DeviceMx;
         dev.AreaID = Itop.Client.MIS.ProgUID;
         if (dlg.bcflag)   //�ڵ���豸������ʱ�� �Ѿ������˱���
         {
             DataService.Update<PSP_Substation_Info>(dev);
         }
         else
             DataService.Create<PSP_Substation_Info>(dev);
         DataRow row = datatable1.NewRow();
         Itop.Common.DataConverter.ObjectToRow(dev, row);
         datatable1.Rows.Add(row);
     }
     else
     {
         if (dlg.bcflag)
         {
             PSP_Substation_Info dev = dlg.DeviceMx;
             dev.AreaID = Itop.Client.MIS.ProgUID;
             DataService.Update<PSP_Substation_Info>(dev);
             DataRow row = datatable1.NewRow();
             Itop.Common.DataConverter.ObjectToRow(dev, row);
             datatable1.Rows.Add(row);
         }
     }
 }
Exemple #2
0
        public override void Edit()
        {
            frmBDZdlg dlg = new frmBDZdlg();

            dlg.CsbuttonVisble(true);
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                PSP_Substation_Info dev = Itop.Common.DataConverter.RowToObject <PSP_Substation_Info>(row);
                dlg.DeviceMx = dev;
                dlg.IsRead   = false;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //更新记录
                    dev        = dlg.DeviceMx;
                    dev.AreaID = Itop.Client.MIS.ProgUID;
                    DataService.Update <PSP_Substation_Info>(dev);
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                }
            }
        }
Exemple #3
0
        public override void Add()
        {
            frmBDZdlg dlg = new frmBDZdlg();

            dlg.ProjectID = Itop.Client.MIS.ProgUID;
            dlg.Name      = "";
            dlg.CsbuttonVisble(true);
            dlg.IsRead = false;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //增加记录
                PSP_Substation_Info dev = dlg.DeviceMx;
                dev.AreaID = Itop.Client.MIS.ProgUID;
                if (dlg.bcflag)   //在点击设备参数的时候 已经进行了保存
                {
                    DataService.Update <PSP_Substation_Info>(dev);
                }
                else
                {
                    DataService.Create <PSP_Substation_Info>(dev);
                }
                DataRow row = datatable1.NewRow();
                Itop.Common.DataConverter.ObjectToRow(dev, row);
                datatable1.Rows.Add(row);
            }
            else
            {
                if (dlg.bcflag)
                {
                    PSP_Substation_Info dev = dlg.DeviceMx;
                    dev.AreaID = Itop.Client.MIS.ProgUID;
                    DataService.Update <PSP_Substation_Info>(dev);
                    DataRow row = datatable1.NewRow();
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                    datatable1.Rows.Add(row);
                }
            }
        }
Exemple #4
0
 public override void Edit()
 {
     frmBDZdlg dlg = new frmBDZdlg();
     dlg.CsbuttonVisble(true);
     DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);
     if (row != null) {
         PSP_Substation_Info dev = Itop.Common.DataConverter.RowToObject<PSP_Substation_Info>(row);
         dlg.DeviceMx = dev;
         dlg.IsRead = false;
         if (dlg.ShowDialog() == DialogResult.OK) {
             //���¼�¼
             dev = dlg.DeviceMx;
             dev.AreaID = Itop.Client.MIS.ProgUID;
             DataService.Update<PSP_Substation_Info>(dev);
             Itop.Common.DataConverter.ObjectToRow(dev, row);
         }
     }
 }
Exemple #5
0
        public static bool ShowDeviceDlg(string stype, string uid, bool isread)
        {
            object dev = null;

            if (stype == "20")
            {
                dev = GetDevice <PSP_Substation_Info>(uid);
            }
            else if (stype == "30")
            {
                dev = GetDevice <PSP_PowerSubstation_Info>(uid);
            }
            else
            {
                dev = GetDevice <PSPDEV>(uid);
            }
            if (dev == null)
            {
                return(false);
            }
            switch (stype)
            {
            case "20":    //变电站

                frmBDZdlg dlg = new frmBDZdlg();
                dlg.StartYear = StartYear;
                dlg.DeviceMx  = dev as PSP_Substation_Info;

                dlg.IsRead     = isread;
                dlg.IsonlyRead = true;
                if (dlg.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSP_Substation_Info>(dlg.DeviceMx);
                    dev = dlg.DeviceMx;
                }
                else
                {
                    dev = null;
                }
                break;

            case "30":    //电源
                frmDYdlg dlg21 = new frmDYdlg();
                dlg21.DeviceMx   = dev as PSP_PowerSubstation_Info;
                dlg21.IsRead     = isread;
                dlg21.IsonlyRead = true;
                dlg21.StartYear  = StartYear;
                if (dlg21.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSP_PowerSubstation_Info>(dlg21.DeviceMx);
                    dev = dlg21.DeviceMx;
                }
                else
                {
                    dev = null;
                }
                break;

            case "01":
                frmMXdlg dlg1 = new frmMXdlg();
                dlg1.DeviceMx = dev as PSPDEV;

                // dlg1.ShowDialog();
                if (dlg1.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg1.DeviceMx);
                }
                break;

            case "02":
                frmBYQ2dlg dlg2 = new frmBYQ2dlg();
                dlg2.DeviceMx = dev as PSPDEV;
                dlg2.ShowDialog();
                break;

            case "03":
                frmBYQ3dlg dlg3 = new frmBYQ3dlg();
                dlg3.DeviceMx = dev as PSPDEV;
                dlg3.ShowDialog();
                break;

            case "04":
                frmFDJdlg dlg4 = new frmFDJdlg();
                dlg4.DeviceMx = dev as PSPDEV;
                dlg4.ShowDialog();
                break;

            case "05":
                frmXLdlg dlg5 = new frmXLdlg();
                dlg5.DeviceMx = dev as PSPDEV;
                dlg5.glist    = glist;
                dlg5.isread   = true;
                DialogResult rst = dlg5.ShowDialog();
                if (rst == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg5.DeviceMx);
                }
                break;

            case "06":
                frmDLQdlg dlg6 = new frmDLQdlg();
                dlg6.DeviceMx = dev as PSPDEV;
                dlg6.ShowDialog();
                break;

            case "07":
                frmKGdlg dlg7 = new frmKGdlg();
                dlg7.DeviceMx = dev as PSPDEV;
                dlg7.ShowDialog();
                break;

            case "08":
                frmCLDRdlg dlg8 = new frmCLDRdlg();
                dlg8.DeviceMx = dev as PSPDEV;
                dlg8.ShowDialog();
                break;

            case "09":
                frmBLDRdlg dlg9 = new frmBLDRdlg();
                dlg9.DeviceMx = dev as PSPDEV;
                dlg9.ShowDialog();
                break;

            case "10":
                frmCLDKdlg dlg10 = new frmCLDKdlg();
                dlg10.DeviceMx = dev as PSPDEV;
                dlg10.ShowDialog();
                break;

            case "11":
                frmBLDKdlg dlg11 = new frmBLDKdlg();
                dlg11.DeviceMx = dev as PSPDEV;
                dlg11.ShowDialog();
                break;

            case "12":
                frmFHdlg dlg12 = new frmFHdlg();
                dlg12.DeviceMx = dev as PSPDEV;
                dlg12.ShowDialog();
                break;

            case "13":
                frmMLdlg dlg13 = new frmMLdlg();
                dlg13.DeviceMx = dev as PSPDEV;
                dlg13.ShowDialog();
                break;

            case "14":
                frmML2dlg dlg14 = new frmML2dlg();
                dlg14.DeviceMx = dev as PSPDEV;
                dlg14.ShowDialog();
                break;

            case "15":
                frmHGdlg dlg15 = new frmHGdlg();
                dlg15.DeviceMx = dev as PSPDEV;
                dlg15.ShowDialog();
                break;

            case "50":
            case "51":
            case "52":
                frmPWdlg dlg18 = new frmPWdlg();
                dlg18.DeviceMx = dev as PSPDEV;
                dlg18.ShowDialog();
                break;

            case "54":
            case "56":
            case "57":
            case "58":
            case "59":
                frmPWKGdlg dlg17 = new frmPWKGdlg();
                dlg17.DeviceMx = dev as PSPDEV;
                dlg17.ShowDialog();
                break;

            case "61":
            case "62":
            case "63":
            case "64":
            case "65":
                frmPWKGdlg dlg88 = new frmPWKGdlg();
                dlg88.DeviceMx = dev as PSPDEV;
                dlg88.ShowDialog();
                break;

            case "70":
                frmZXdlg dlg19 = new frmZXdlg();
                dlg19.DeviceMx = dev as PSPDEV;
                if (dlg19.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg19.DeviceMx);
                }
                break;

            case "72":
                frmBYQTWOdlg dlg20 = new frmBYQTWOdlg();
                dlg20.DeviceMx = dev as PSPDEV;
                dlg20.ShowDialog();
                break;

            case "73":
                frmDXdlg DX = new frmDXdlg();
                DX.DeviceMx = dev as PSPDEV;
                DX.isread   = true;
                DX.ShowDialog();
                break;

            case "75":
                frmLUXdlg LUX = new frmLUXdlg();
                LUX.DeviceMx = dev as PSPDEV;
                LUX.isread   = true;
                LUX.ShowDialog();
                break;

            case "71":
                frmRDQdlg dlg22 = new frmRDQdlg();
                dlg22.DeviceMx = dev as PSPDEV;
                dlg22.ShowDialog();
                break;

            case "76":

                break;
            }
            return(dev != null);
        }
        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;
            }
        }