Beispiel #1
0
        void barSelectDevice_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode node;

            if (strID == null)
            {
                MessageBox.Show("请先选择电气计算方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //strID = node["ID"].ToString();
            DataTable     dt         = new DataTable();
            frmDeviceList frmDevList = new frmDeviceList();

            frmDevList.ProjectID   = this.ProjectUID;
            frmDevList.ProjectSUID = strID;
            frmDevList.BelongYear  = parentobj.BelongYear;
            node = treeList2.FocusedNode;
            string devicenodename = null;

            if (node != null)
            {
                devicenodename = node["name"].ToString();
            }
            frmDevList.DeviceName = devicenodename;
            frmDevList.Init();
            if (frmDevList.ShowDialog() == DialogResult.OK)
            {
                foreach (DataRow row in frmDevList.DT.Rows)
                {
                    try {
                        if ((bool)row["C"])
                        {
                            PSP_ElcDevice elcDevice = new PSP_ElcDevice();
                            elcDevice.DeviceSUID  = row["A"].ToString();
                            elcDevice.ProjectSUID = strID;
                            UCDeviceBase.DataService.Create <PSP_ElcDevice>(elcDevice);
                        }
                        else
                        {
                            PSP_ElcDevice elcDevice = new PSP_ElcDevice();
                            elcDevice.DeviceSUID  = row["A"].ToString();
                            elcDevice.ProjectSUID = strID;
                            UCDeviceBase.DataService.Delete <PSP_ElcDevice>(elcDevice);
                        }
                    } catch (System.Exception ex) {
                    }
                }
                if (curDevice != null)
                {
                    curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + strID + "' and ";
                    curDevice.Init();
                }
            }
        }
Beispiel #2
0
        private void barCopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode node = treeList1.FocusedNode;

            if (node == null)
            {
                MessageBox.Show("请先选择电气计算方案!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                if (MessageBox.Show("是否复制方案:" + node["Name"].ToString() + "?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    string name  = "副本" + node["Name"].ToString();
                    string strC  = " Name like '" + name + "%'";
                    IList  list1 = UCDeviceBase.DataService.GetList("SelectPSP_ELCPROJECTByWhere", strC);
                    if (list1.Count > 0)
                    {
                        name = "副本" + node["Name"].ToString() + "-" + list1.Count.ToString();
                    }
                    string         strCon = " WHERE ProjectSUID = '" + node["ID"].ToString() + "'";
                    IList          list   = UCDeviceBase.DataService.GetList("SelectPSP_ElcDeviceByCondition", strCon);
                    PSP_ELCPROJECT elcPro = new PSP_ELCPROJECT();
                    elcPro.FileType  = node["FileType"].ToString();
                    elcPro.Name      = name;
                    elcPro.ProjectID = Itop.Client.MIS.ProgUID;
                    elcPro.Class     = System.DateTime.Now.ToString();
                    DataRow row = datatable.NewRow();
                    Itop.Common.DataConverter.ObjectToRow(elcPro, row);
                    datatable.Rows.Add(row);
                    UCDeviceBase.DataService.Create <PSP_ELCPROJECT>(elcPro);
                    SVGFILE svg    = UCDeviceBase.DataService.GetOneByKey <SVGFILE>(node["ID"].ToString());
                    SVGFILE svgNew = new SVGFILE();
                    svgNew.SUID     = elcPro.ID;
                    svgNew.FILENAME = elcPro.Name;
                    svgNew.SVGDATA  = svg.SVGDATA;
                    UCDeviceBase.DataService.Create <SVGFILE>(svgNew);
                    foreach (PSP_ElcDevice elcDEV in list)
                    {
                        PSP_ElcDevice elcElement = new PSP_ElcDevice();
                        elcElement.ProjectSUID = elcPro.ID;
                        elcElement.DeviceSUID  = elcDEV.DeviceSUID;
                        UCDeviceBase.DataService.Create <PSP_ElcDevice>(elcElement);
                    }
                }
                return;
            }
        }
Beispiel #3
0
        //排除设备
        void barDeleteDevice_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (strID == null || curDevice == null)
            {
                MessageBox.Show("选择有问题!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (curDevice.SelectedDevice != null)
            {
                if (curDevice.SelectedDevice.GetType() == typeof(PSPDEV))
                {
                    PSPDEV        dev       = curDevice.SelectedDevice as PSPDEV;
                    PSP_ElcDevice elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.SUID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
                else if (curDevice.SelectedDevice.GetType() == typeof(PSP_Substation_Info))
                {
                    PSP_Substation_Info dev       = curDevice.SelectedDevice as PSP_Substation_Info;
                    PSP_ElcDevice       elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.UID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
                else if (curDevice.SelectedDevice.GetType() == typeof(PSP_PowerSubstation_Info))
                {
                    PSP_PowerSubstation_Info dev       = curDevice.SelectedDevice as PSP_PowerSubstation_Info;
                    PSP_ElcDevice            elcdevice = new PSP_ElcDevice();
                    elcdevice.ProjectSUID = strID;
                    elcdevice.DeviceSUID  = dev.UID;
                    Services.BaseService.Delete <PSP_ElcDevice>(elcdevice);
                }
            }


            if (curDevice != null)
            {
                curDevice.strCon = ",psp_elcdevice where psp_elcdevice.devicesuid = pspdev.suid and psp_elcdevice.projectsuid = '" + strID + "' and ";
                curDevice.Init();
            }
        }
Beispiel #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            dt.Clear();
            object obj = comboBox1.SelectedItem;

            if (obj != null)
            {
                DataRowView row1 = obj as DataRowView;
                string      id   = row1.Row["id"].ToString();
                string      con  = " where type = '" + id + "'";
                string      con2 = " and ProjectID = '" + this.ProjectID + "'";
                con = con + con2;
                IList list = Services.BaseService.GetList("SelectPSPDEVByCondition", con);
                foreach (PSPDEV dev in list)
                {
                    PSP_ElcDevice pspDev = new PSP_ElcDevice();
                    pspDev.DeviceSUID  = dev.SUID;
                    pspDev.ProjectSUID = ProjectSUID;
                    IList list1 = Services.BaseService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                    if (list1.Count > 0)
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = true;
                        dt.Rows.Add(row);
                    }
                    else
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = false;
                        dt.Rows.Add(row);
                    }
                }
            }
            gridControl1.DataSource = dt;
        }
Beispiel #5
0
        public void Init()
        {
            dt.Columns.Add("A");
            dt.Columns.Add("B");
            dt.Columns.Add("C", typeof(bool));
            Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Itop.TLPSP.DEVICE.devicetypes.xml");
            //Assembly.GetExecutingAssembly().GetManifestResourceStream
            XmlDocument xml = new XmlDocument();

            xml.Load(fs);
            XmlNodeList nodes = xml.GetElementsByTagName("device");
            DataTable   table = new DataTable();

            table.Columns.Add("id", typeof(string));
            table.Columns.Add("name", typeof(string));
            table.Columns.Add("class", typeof(string));
            foreach (XmlNode node in nodes)
            {
                if (((XmlElement)node).GetAttribute("name") == "变电站" || ((XmlElement)node).GetAttribute("name") == "电源" || Convert.ToInt32(((XmlElement)node).GetAttribute("id")) >= 40)
                {
                    continue;
                }
                DataRow row = table.NewRow();
                row["id"]    = node.Attributes["id"].Value;
                row["name"]  = node.Attributes["name"].Value;
                row["class"] = node.Attributes["class"].Value;
                table.Rows.Add(row);
            }
            comboBox1.DataSource    = table;
            comboBox1.DisplayMember = "name";
            if (DeviceName != null)
            {
                comboBox1.Text = DeviceName;
            }
            {
                dt.Clear();
                object obj = comboBox1.SelectedItem;
                if (obj != null)
                {
                    DataRowView row1 = obj as DataRowView;
                    string      id   = row1.Row["id"].ToString();
                    string      con  = " where type = '" + id + "'";
                    string      con2 = " and ProjectID = '" + this.ProjectID + "'";
                    con = con + con2;
                    IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                    if (!string.IsNullOrEmpty(belongyear))   //根据参与计算设备属于那一年先进行一次筛选
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!string.IsNullOrEmpty((list[i] as PSPDEV).OperationYear) && (list[i] as PSPDEV).OperationYear.Length == 4 && belongyear.Length == 4)
                            {
                                if (Convert.ToInt32((list[i] as PSPDEV).OperationYear) > Convert.ToInt32(belongyear))
                                {
                                    list.RemoveAt(i);
                                    i--;
                                    continue;
                                }
                            }
                            if (!string.IsNullOrEmpty((list[i] as PSPDEV).Date2) && (list[i] as PSPDEV).Date2.Length == 4 && belongyear.Length == 4)
                            {
                                if (Convert.ToInt32((list[i] as PSPDEV).Date2) > Convert.ToInt32(belongyear))
                                {
                                    list.RemoveAt(i);
                                    i--;
                                    continue;
                                }
                            }
                        }
                    }
                    foreach (PSPDEV dev in list)
                    {
                        PSP_ElcDevice pspDev = new PSP_ElcDevice();
                        pspDev.DeviceSUID  = dev.SUID;
                        pspDev.ProjectSUID = ProjectSUID;
                        IList list1 = UCDeviceBase.DataService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                        if (list1.Count > 0)
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = true;
                            dt.Rows.Add(row);
                        }
                        else
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = false;
                            dt.Rows.Add(row);
                        }
                    }
                }
                gridControl1.DataSource = dt;
            }
        }
Beispiel #6
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            dt.Clear();
            object obj = comboBox1.SelectedItem;

            if (obj != null)
            {
                DataRowView row1 = obj as DataRowView;
                string      id   = row1.Row["id"].ToString();
                string      con  = " where type = '" + id + "'";
                string      con2 = " and ProjectID = '" + this.ProjectID + "'";
                con = con + con2;
                IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                if (!string.IsNullOrEmpty(belongyear))   //根据参与计算设备属于那一年先进行一次筛选
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!string.IsNullOrEmpty((list[i] as PSPDEV).OperationYear) && (list[i] as PSPDEV).OperationYear.Length == 4 && belongyear.Length == 4)
                        {
                            if (Convert.ToInt32((list[i] as PSPDEV).OperationYear) > Convert.ToInt32(belongyear))
                            {
                                list.RemoveAt(i);
                                i--;
                                continue;
                            }
                        }
                        if (!string.IsNullOrEmpty((list[i] as PSPDEV).Date2) && (list[i] as PSPDEV).Date2.Length == 4 && belongyear.Length == 4)
                        {
                            if (Convert.ToInt32((list[i] as PSPDEV).Date2) > Convert.ToInt32(belongyear))
                            {
                                list.RemoveAt(i);
                                i--;
                                continue;
                            }
                        }
                    }
                }
                foreach (PSPDEV dev in list)
                {
                    PSP_ElcDevice pspDev = new PSP_ElcDevice();
                    pspDev.DeviceSUID  = dev.SUID;
                    pspDev.ProjectSUID = ProjectSUID;
                    IList list1 = UCDeviceBase.DataService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                    if (list1.Count > 0)
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = true;
                        dt.Rows.Add(row);
                    }
                    else
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = false;
                        dt.Rows.Add(row);
                    }
                }
            }
            gridControl1.DataSource = dt;
        }
Beispiel #7
0
        public void Init()
        {
            dt.Columns.Add("A");
            dt.Columns.Add("B");
            dt.Columns.Add("C", typeof(bool));
            Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Itop.TLPSP.DEVICE.devicetypes.xml");
            //Assembly.GetExecutingAssembly().GetManifestResourceStream
            XmlDocument xml = new XmlDocument();

            xml.Load(fs);
            XmlNodeList nodes = xml.GetElementsByTagName("device");
            DataTable   table = new DataTable();

            table.Columns.Add("id", typeof(string));
            table.Columns.Add("name", typeof(string));
            table.Columns.Add("class", typeof(string));
            foreach (XmlNode node in nodes)
            {
                DataRow row = table.NewRow();
                row["id"]    = node.Attributes["id"].Value;
                row["name"]  = node.Attributes["name"].Value;
                row["class"] = node.Attributes["class"].Value;
                table.Rows.Add(row);
            }
            comboBox1.DataSource    = table;
            comboBox1.DisplayMember = "name";
            if (DeviceName != null)
            {
                comboBox1.Text = DeviceName;
            }
            {
                dt.Clear();
                object obj = comboBox1.SelectedItem;
                if (obj != null)
                {
                    DataRowView row1 = obj as DataRowView;
                    string      id   = row1.Row["id"].ToString();
                    string      con  = " where type = '" + id + "'";
                    string      con2 = " and ProjectID = '" + this.ProjectID + "'";
                    con = con + con2;
                    IList list = Services.BaseService.GetList("SelectPSPDEVByCondition", con);
                    foreach (PSPDEV dev in list)
                    {
                        PSP_ElcDevice pspDev = new PSP_ElcDevice();
                        pspDev.DeviceSUID  = dev.SUID;
                        pspDev.ProjectSUID = ProjectSUID;
                        IList list1 = Services.BaseService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                        if (list1.Count > 0)
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = true;
                            dt.Rows.Add(row);
                        }
                        else
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = false;
                            dt.Rows.Add(row);
                        }
                    }
                }
                gridControl1.DataSource = dt;
            }
        }
Beispiel #8
0
        private void comboBox1_EditValueChanged(object sender, EventArgs e)
        {
            string bdzordy = string.Empty;

            if (devcetype == 0 || devcetype == 1)
            {
                string        uid     = string.Empty;
                List <string> listuid = new List <string>();
                foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem item in this.comboBoxEdit4.Properties.Items)
                {
                    if (item.CheckState == CheckState.Checked)
                    {
                        listuid.Add(item.Value.ToString());
                    }
                }
                for (int i = 0; i < listuid.Count; i++)
                {
                    uid += "'" + listuid[i] + "',";
                }
                uid = uid.TrimEnd(',');
                if (!string.IsNullOrEmpty(uid))
                {
                    bdzordy = "and SvgUID in(" + uid + ")";
                }
                if (string.IsNullOrEmpty(bdzordy))
                {
                    MessageBox.Show("请选择变电站或电源后再操作!");
                    return;
                }
            }
            dt.Clear();
            string id = comboBox1.EditValue.ToString();

            if (!string.IsNullOrEmpty(id))
            {
                string con  = " where type = '" + id + "'";
                string con2 = " and ProjectID = '" + this.ProjectID + "'";
                con = con + con2;
                IList <PSPDEV> listmx = new List <PSPDEV>();
                if (!string.IsNullOrEmpty(bdzordy))
                {
                    con += bdzordy;
                    if (id != "01")
                    {
                        listmx = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", " where  ProjectID = '" + this.ProjectID + "'and type='01'" + bdzordy);
                        if (listmx.Count == 0)
                        {
                            listmx = UCDeviceBase.DataService.GetList <PSPDEV>("SelectPSPDEVByCondition", " where  ProjectID = '" + this.ProjectID + "'and type='01'and SvgUID IS NULL");
                        }
                    }
                }

                IList list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", con);
                if (listmx.Count > 0 && list.Count == 0)
                {
                    string suidcol = string.Empty;
                    string ed      = string.Empty;
                    for (int i = 0; i < listmx.Count; i++)
                    {
                        ed += "'" + listmx[i].SUID + "',";
                    }
                    ed      = ed.TrimEnd(',');
                    suidcol = "(" + ed + ")";
                    list    = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", "where type = '" + id + "'and ProjectID = '" + this.ProjectID + "'and (IName in " + suidcol + " or JName in" + suidcol + " )");
                }
                if (id == "01" && list.Count == 0) //选择的母线没有数据时
                {
                    list = UCDeviceBase.DataService.GetList("SelectPSPDEVByCondition", " where  ProjectID = '" + this.ProjectID + "'and type='01'and SvgUID IS NULL");
                }
                //if (string.IsNullOrEmpty(bdzordy))       //对所有的数据进行 年份的筛选
                //{
                if (!string.IsNullOrEmpty(belongyear))     //根据参与计算设备属于那一年先进行一次筛选
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (!string.IsNullOrEmpty((list[i] as PSPDEV).OperationYear) && (list[i] as PSPDEV).OperationYear.Length == 4 && belongyear.Length == 4)
                        {
                            if (Convert.ToInt32((list[i] as PSPDEV).OperationYear) > Convert.ToInt32(belongyear))
                            {
                                list.RemoveAt(i);
                                i--;
                                continue;
                            }
                        }
                        if (!string.IsNullOrEmpty((list[i] as PSPDEV).Date2) && (list[i] as PSPDEV).Date2.Length == 4 && belongyear.Length == 4)
                        {
                            if (Convert.ToInt32((list[i] as PSPDEV).Date2) < Convert.ToInt32(belongyear))
                            {
                                list.RemoveAt(i);
                                i--;
                                continue;
                            }
                        }
                    }
                }
                // }

                foreach (PSPDEV dev in list)
                {
                    PSP_ElcDevice pspDev = new PSP_ElcDevice();
                    pspDev.DeviceSUID  = dev.SUID;
                    pspDev.ProjectSUID = ProjectSUID;
                    IList list1 = UCDeviceBase.DataService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                    if (list1.Count > 0)
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = true;
                        dt.Rows.Add(row);
                    }
                    else
                    {
                        DataRow row = dt.NewRow();
                        row["A"] = dev.SUID;
                        row["B"] = dev.Name;
                        row["C"] = false;
                        dt.Rows.Add(row);
                    }
                }
            }
            gridControl1.DataSource = dt;
        }
        public void Init(string obj)
        {
            dt.Columns.Add("A");
            dt.Columns.Add("B");
            dt.Columns.Add("C", typeof(bool));
            //Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("Itop.TLPSP.DEVICE.devicetypes.xml");
            ////Assembly.GetExecutingAssembly().GetManifestResourceStream
            //XmlDocument xml = new XmlDocument();
            //xml.Load(fs);
            //XmlNodeList nodes = xml.GetElementsByTagName("device");
            DataTable table = new DataTable();

            table.Columns.Add("id", typeof(string));
            table.Columns.Add("name", typeof(string));
            table.Columns.Add("class", typeof(string));
            //foreach (XmlNode node in nodes)
            //{
            //    DataRow row = table.NewRow();
            //    row["id"] = node.Attributes["id"].Value;
            //    row["name"] = node.Attributes["name"].Value;
            //    row["class"] = node.Attributes["class"].Value;
            //    table.Rows.Add(row);
            //}
            //comboBox1.DataSource = table;
            //comboBox1.DisplayMember = "name";
            //if (DeviceName != null)
            //{
            //    comboBox1.Text = DeviceName;
            //}

            {
                dt.Clear();
                if (obj != null)
                {
                    //    DataRowView row1 = obj as DataRowView;
                    string id      = obj;
                    string strCon1 = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + ProjectID + "'";
                    string strCon2 = null;
                    string strCon  = null;


                    strCon2 = " AND Type = '" + obj + "'";
                    strCon  = strCon1 + strCon2;
                    IList list = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                    foreach (PSPDEV dev in list)
                    {
                        PSP_ElcDevice pspDev = new PSP_ElcDevice();
                        pspDev.DeviceSUID  = dev.SUID;
                        pspDev.ProjectSUID = ProjectSUID;
                        IList list1 = Services.BaseService.GetList("SelectPSP_ElcDeviceByKey", pspDev);
                        if (list1.Count > 0)
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = true;
                            dt.Rows.Add(row);
                        }
                        else
                        {
                            DataRow row = dt.NewRow();
                            row["A"] = dev.SUID;
                            row["B"] = dev.Name;
                            row["C"] = false;
                            dt.Rows.Add(row);
                        }
                    }
                }
                gridControl1.DataSource = dt;
            }
        }
Beispiel #10
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;
            }
        }