Beispiel #1
0
 public static string getQueryUpdateDevice(Device device)
 {
     return string.Format("UPDATE {0} SET {1}='{2}',{3}='{4}',{5}='{6}',{7}='{8}',{9}='{10}',{11}='{12}',{13}='{14}' WHERE {15}='{16}'",
          ID_TABLE_DEVICE,
          ID_DESCRIPTION_DEVICE, device.Description,
          ID_APPLIANCEID_DEVICE,device.Appliance.Id,
          ID_MANUFACTURERID_DEVICE,device.Manufacturer.Id,
          ID_UPDATETIME_DEVICE, device.UpdateLocalDateTime.ToString(DATETIMEFORMATINSERT_DEVICE),
          ID_UPDATEUSER_DEVICE,device.UpdateUser,
          ID_OUTPUT_DEVICE,device.OutPut.ToString(),
          ID_GATEWAY_DEVICE,device.Gateway.Id,
          ID_DEVICEID_DEVICE,device.Id
         );
 }
Beispiel #2
0
 public static string getQuerySaveDevice(Device device)
 {
     return string.Format("INSERT INTO {0} VALUES('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", ID_TABLE_DEVICE,
         device.Id,
         device.Description,
         device.Appliance.Id,
         device.Manufacturer.Id,
         device.LocalInsertTime.ToString(DATETIMEFORMATINSERT_DEVICE),
         device.InsertUser,
         device.UpdateLocalDateTime.ToString(DATETIMEFORMATINSERT_DEVICE),
         device.UpdateUser,
         device.OutPut.ToString(),
         device.Gateway.Id);
 }
Beispiel #3
0
 public void Update(Device device)
 {
     _repositoryHelper.UpdateDevice(device);
 }
Beispiel #4
0
 public void Save(Device device)
 {
     _repositoryHelper.SaveDevice(device);
 }
Beispiel #5
0
 public bool Exists(Device device)
 {
     return Get(device.Id) != null;
 }
Beispiel #6
0
        public static IList<Device> ParseDataSetToDevice(DataTable dataTable)
        {
            IList<Device> deviceList = new List<Device>();
            foreach (DataRow row in dataTable.Rows)
            {
                Device device = new Device()
                {
                    Id = row[POSITION_DEVICEID_DEVICE].ToString(),
                    Description = row[POSITION_DESCRIPTION_DEVICE].ToString(),
                    Appliance = new Appliance(row[POSITION_APPLIANCEID_DEVICE].ToString()),
                    Manufacturer = new Manufacturer(row[POSITION_MANUFACTURERID_DEVICE].ToString()),
                    LocalInsertTime = getDateTime(row[POSITION_INSERTTIME_DEVICE].ToString(), DATETIMEFORMATINSERT_DEVICE),
                    InsertUser = row[POSITION_INSERTUSER_DEVICE].ToString(),
                    UpdateLocalDateTime = getDateTime(row[POSITION_UPDATETIME_DEVICE].ToString(), DATETIMEFORMATINSERT_DEVICE),
                    UpdateUser = row[POSITION_UPDATEUSER_DEVICE].ToString(),
                    OutPut = TryParseBoolean(row[POSITION_OUTPUT_DEVICE].ToString()),
                    Gateway = new Gateway(row[POSITION_GATEWAY_DEVICE].ToString())
                };
                deviceList.Add(device);
            }

            return deviceList;
        }
Beispiel #7
0
 public void SaveDevice(Device device)
 {
     string query = DeviceQuery.getQuerySaveDevice(device);
     DeviceQuery.ParseDataSetToDevice(_provider.queryExecute(query,INSERT_TYPE));
 }
Beispiel #8
0
 public void UpdateDevice(Device device)
 {
     string query = DeviceQuery.getQueryUpdateDevice(device);
     DeviceQuery.ParseDataSetToDevice(_provider.queryExecute(query,UPDATE_TYPE));
 }