public ObservableCollection<DeviceAddTypeOR> GetAllGenerdDevice(string nStationID) { string sql = string.Format(@"select d.*,dt.DeviceTypeID from t_Device d inner join t_DeviceType dt on d.DeviceTypeID=dt.DeviceTypeID and d.stationid={0}", nStationID); DataTable dt = null; try { dt = db.ExecuteQueryDataSet(sql).Tables[0]; } catch (Exception ex) { throw ex; } ObservableCollection<DeviceAddTypeOR> _List = new ObservableCollection<DeviceAddTypeOR>(); foreach (DataRow dr in dt.Rows) { DeviceAddTypeOR obj = new DeviceAddTypeOR(dr); _List.Add(obj); } return _List; }
private void LoadChannce(DeviceAddTypeOR mDevice, TreeViewItem tvi) { var arrs = _DeviceDA.SelectChannelManagements(mDevice.Deviceid, mDevice.Stationid, mDevice.DeviceTypeID); foreach (ChannelManagementOR obj in arrs) { TreeViewItem tvChanncel = new TreeViewItem(); tvChanncel.Header = obj.Channelname; tvChanncel.Selected+=new RoutedEventHandler(tvChanncel_Selected); tvChanncel.Tag = obj; if (obj.ISHavePolice) { tvChanncel.Foreground = BlueSolid; } else { tvChanncel.Foreground = RedSolid; } tvi.Items.Add(tvChanncel); } }