private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { // if (e.Button == MouseButtons.Right) return; TreeListNode node = treeList1.FocusedNode; if (node == null) { return; } string deviceid = node["DeviceID"].ToString(); string strID = node["devicetype"].ToString(); string dtype = DeviceTypeHelper.DeviceClassbyType(strID); if (string.IsNullOrEmpty(dtype)) { if (curDevice != null) { curDevice.Hide(); } return; } UCDeviceBase device = null; if (devicTypes.ContainsKey(dtype)) { device = devicTypes[dtype]; device.ID = strID; try { device.Show(); } catch { } } else { device = createInstance(dtype); device.ID = strID; device.ProjectID = Itop.Client.MIS.ProgUID; devicTypes.Add(dtype, device); showDevice(device); } if (curDevice != null && curDevice != device) { curDevice.Hide(); } curDevice = device; if (curDevice != null) { curDevice.strCon = " where 1=1 and suid='" + deviceid + "'and "; curDevice.Init(); } }
public static void initprojectDeviceTypes_SH1(DevExpress.XtraTreeList.TreeList treeList1) { TreeListColumn column = new TreeListColumn(); column.Caption = "设备分类"; column.FieldName = "name"; column.VisibleIndex = 0; column.Width = 180; column.OptionsColumn.AllowEdit = false; column.OptionsColumn.AllowSort = false; treeList1.Columns.AddRange(new TreeListColumn[] { column }); treeList1.KeyFieldName = "keyid"; treeList1.ParentFieldName = "parentid"; treeList1.DataSource = DeviceTypeHelper.GetprojectDeviceTypes_SH1(); }
//添加元件所关联的设备 private void adducdevice(string Devicetype) { string dtype = DeviceTypeHelper.DeviceClassbyType(Devicetype); if (string.IsNullOrEmpty(dtype)) { if (curDevice != null) { curDevice.Hide(); } return; } UCDeviceBase device = null; if (devicTypes.ContainsKey(dtype)) { device = devicTypes[dtype]; device.ID = Devicetype; try { device.Show(); } catch { } } else { device = createInstance(dtype); device.ID = Devicetype; device.ProjectID = Itop.Client.MIS.ProgUID; devicTypes.Add(dtype, device); showDevice(device); } if (curDevice != null && curDevice != device) { curDevice.Hide(); } curDevice = device; if (curDevice != null) { //给一个空的选择 curDevice.strCon = " where 1=1 and suid='1111' and"; curDevice.Init(); } }
private void InitDeviceType(string[] type, string year) { DataTable dt = DeviceTypeHelper.GetDeviceTypes(type); if (dt.Rows.Count > 0) { string strID = dt.Rows[0]["id"].ToString(); string dtype = dt.Rows[0]["class"].ToString(); UCDeviceBase device = null; device = createInstance(dtype); device.ID = strID; device.ProjectID = Itop.Client.MIS.ProgUID; showDevice(device); string strCon = " year(cast(OperationYear as datetime))<" + year + " and Type='" + strID + "' "; device.Statictable(strCon); curDevice = device; } }
/// <summary> /// 初始设备分类 /// </summary> private void InitDeviceType() { TreeListColumn column = new TreeListColumn(); column.Caption = "项目名称"; column.FieldName = "Name"; column.VisibleIndex = 0; column.Width = 180; column.OptionsColumn.AllowEdit = false; column.OptionsColumn.AllowSort = false; this.treeList1.Columns.AddRange(new TreeListColumn[] { column }); PSP_ELCPROJECT pj = new PSP_ELCPROJECT(); pj.ProjectID = Itop.Client.MIS.ProgUID; IList list = UCDeviceBase.DataService.GetList("SelectPSP_ELCPROJECTList", pj); datatable = Itop.Common.DataConverter.ToDataTable(list, typeof(PSP_ELCPROJECT)); treeList1.DataSource = datatable; // DeviceTypeHelper.InitDeviceTypes(treeList2); DeviceTypeHelper.initprojectDeviceTypes_SH(treeList2); }
/// <summary> /// 初始设备分类 /// </summary> private void InitDeviceType() { DeviceTypeHelper.InitDeviceTypes(treeList1); }
private void InitDeviceType(string[] type) { DeviceTypeHelper.InitDeviceTypes(treeList1, type); }