Example #1
0
        public static List <Door> GetDoorsByDevice(string deviceId)
        {
            List <Door> doors = new List <Door>();
            DataTable   dt    = null;

            try
            {
                ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient();
                DataSet ds = client.DeviceQuery("D", deviceId, "", "");
                dt = ds.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    string Id       = dr["doorId"].ToString();
                    string Name     = dr["doorName"].ToString();
                    int    readerNo = Convert.ToInt32(dr["readerNumber"]);
                    int    inputNo  = Convert.ToInt32(dr["inputNumber"]);
                    int    outputNo = Convert.ToInt32(dr["outputNumber"]);
                    int    relayNo  = Convert.ToInt32(dr["relayNumber"]);

                    Device device = Device.GetDeviceByDoorId(Id);
                    Door   door   = new Door(Id, Name, readerNo, inputNo, outputNo, readerNo, device);
                    doors.Add(door);
                }
                return(doors);
            }

            catch (Exception ex)
            {
                return(doors);
            }
        }
Example #2
0
        public List <Device> GetDevices()
        {
            List <Device> devices = new List <Device>();
            DataTable     dt      = null;

            try
            {
                ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient();
                DataSet ds = client.DeviceQuery("Q", id, name, ip);
                dt = ds.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    string id   = dr["deviceId"].ToString();
                    string name = dr["deviceName"].ToString();
                    string ip   = dr["deviceIP"].ToString();

                    Device device = new Device(id, name, ip);
                    devices.Add(device);
                }
                return(devices);
            }
            catch (Exception ex)
            {
                return(devices);
            }
        }