示例#1
0
 /// <summary>
 /// 根据站点、设备类型查询设备
 /// </summary>
 /// <param name="nStationID"></param>
 /// <param name="mDeviceTypeID"></param>
 /// <returns></returns>
 public ObservableCollection<DeviceOR> GetAllGenerdDevice(string nStationID, string mDeviceTypeID)
 {
     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} and dt.DeviceTypeID={1} "
         , nStationID, mDeviceTypeID);
     DataTable dt = null;
     try
     {
         dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
     catch (Exception ex)
     {
         throw ex;
     }
     ObservableCollection<DeviceOR> _List = new ObservableCollection<DeviceOR>();
     foreach (DataRow dr in dt.Rows)
     {
         DeviceOR obj = new DeviceOR(dr);
         _List.Add(obj);
     }
     return _List;
 }
示例#2
0
 /// <summary>
 /// 根据机房ID查询已配置的策略
 /// </summary>
 /// <param name="strStationID"></param>
 /// <returns></returns>
 public ObservableCollection<DeviceOR> selectDevices(string strStationID)
 {
     string sql = string.Format(@"select distinct d.* from t_Device d
     inner join  t_Channel A  on  a.deviceid=d.deviceid
     inner join t_AlarmPolicyManagement B on A.DeviceID=B.DeviceID AND DeviceChannelID=ChannelNo
     where d.stationid={0} order by d.deviceid", strStationID);
     DataTable dt = null;
     try
     {
         dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
     catch (Exception ex)
     {
         throw ex;
     }
     ObservableCollection<DeviceOR> _List = new ObservableCollection<DeviceOR>();
     foreach (DataRow dr in dt.Rows)
     {
         DeviceOR obj = new DeviceOR(dr);
         _List.Add(obj);
     }
     return _List;
 }
示例#3
0
 public ObservableCollection<DeviceOR> selectDevices(string strid)
 {
     string sql = string.Format("select * from t_Device where StationID={0} order by StationID,DeviceName", strid);
        DataTable dt = null;
        try
        {
        dt = db.ExecuteQuery(sql);
        }
        catch (Exception ex)
        {
        throw ex;
        }
        ObservableCollection<DeviceOR> _List = new ObservableCollection<DeviceOR>();
        foreach (DataRow dr in dt.Rows)
        {
        DeviceOR obj = new DeviceOR(dr);
        _List.Add(obj);
        }
        return _List;
 }
        public void cbStation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectStationOR == null)
                return;
            if (DeviceORList != null)
                DeviceORList.Clear();

            var v = _dev.selectDevices(SelectStationOR.Stationid.ToString());

            foreach (DeviceOR obj in v)
            {
                DeviceORList.Add(obj);
            }

            DeviceOR objTemp = new DeviceOR() { Deviceid = -1, Devicename = "所有设备" };
            DeviceORList.Insert(0, objTemp);
            SelectDeviceOR = objTemp;
        }
示例#5
0
        public void Init()
        {
            StartDate = DateTime.Now.AddDays(-7); // Convert.ToDateTime("2011-10-01");
            StartTime = "00:00:00";
            EndDate = DateTime.Now; // Convert.ToDateTime("2011-10-15");
            EndTime = "23:59:59";

            AlarmLogS = new ObservableCollection<AlarmLogOR>();

            StationDA _staDA = new StationDA();
            StationORList = _staDA.selectAllStation();
            StationOR tempOR = new StationOR();
            tempOR.Stationid = -1;
            tempOR.Stationname = "所有站点";
            StationORList.Insert(0,tempOR);
            SelectStationOR = tempOR;

            EventLists = new ObservableCollection<StatusOR>() {
            new StatusOR(){ ID=1, Name="1"},
            new StatusOR(){ ID=2, Name="2"},
            new StatusOR(){ ID=3, Name="3"},
            new StatusOR(){ ID=4, Name="4"},
            new StatusOR(){ ID=5, Name="5"},
            new StatusOR(){ ID=6, Name="6"}
            };
            StatusOR temp = new StatusOR() { ID = -1, Name = "所有事件级别" };
            EventLists.Insert(0, temp);
            SelectEventOR = temp;

            //所有事件
            EventsNames = new ObservableCollection<string>();
            EventsNames = _dev.GetAllEventsName();
            EventsNames.Insert(0,"所有事件名称");
            SelectEventName = "所有事件名称";

            DeviceORList = new ObservableCollection<DeviceOR>();
            //DeviceOR objTemp = new DeviceOR() { Deviceid = -1, Devicename = "所有设备" };
            DeviceOR objTemp = new DeviceOR() { Deviceid = -1, Devicename = "所有设备" };
            DeviceORList.Insert(0, objTemp);
            SelectDeviceOR = objTemp;
        }
示例#6
0
        public void cbStation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Console.WriteLine("start cbStation_SelectionChanged");

            if (SelectStationOR.Stationid == -1)
                return;

               //SelectDeviceOR = null;

            if (DeviceORList != null)
                DeviceORList.Clear();
            else
                DeviceORList = new ObservableCollection<DeviceOR>();

            var v = _dev.selectDevices(SelectStationOR.Stationid.ToString());

            foreach (DeviceOR obj in v)
            {
                DeviceORList.Add(obj);
            }

            DeviceOR objTemp = new DeviceOR() { Deviceid = -1, Devicename = "所有设备" };
            DeviceORList.Insert(0, objTemp);
            SelectDeviceOR = objTemp;

            Console.WriteLine("End cbStation_SelectionChanged");
        }
示例#7
0
 public void Clone(DeviceOR obj)
 {
     //
     Deviceid = obj.Deviceid;
     //
     Devicename = obj.Devicename;
     //
     Communicatetype = obj.Communicatetype;
     //
     Communicateid = obj.Communicateid;
     //
     Subaddr = obj.Subaddr;
     //
     Devicetypeid = obj.Devicetypeid;
     //
     Stationid = obj.Stationid;
     //
     Stationname = obj.Stationname;
     //
     Ip = obj.Ip;
     //
     Userid = obj.Userid;
     //
     Password = obj.Password;
     //
     Enable = obj.Enable;
     //
     Port = obj.Port;
 }