public bool Manage(string filter, Sec_UserDevices dev) { try { return(udDL.Manage(filter, dev.DeviceId, dev.UserId, dev.IMEI, dev.MAC, dev.Manufacturer, dev.Model, dev.IsActive, dev.Password, dev.TranferToId)); } catch { throw; } }
public string Delete(int id = 0) { try { Sec_UserDevicesBL udbl = new Sec_UserDevicesBL(); Sec_UserDevices dev = new Sec_UserDevices(); dev.DeviceId = id; var rec = udbl.Manage("Delete", dev); return(rec.ToString()); } catch (Exception ex) { return(ex.Message); } }
public string Active(int DeviceId, bool Status) { try { Sec_UserDevicesBL udbl = new Sec_UserDevicesBL(); Sec_UserDevices dev = new Sec_UserDevices(); dev.DeviceId = DeviceId; dev.IsActive = Status; var rec = udbl.Manage("UpdateStatus", dev); return(rec.ToString()); } catch (Exception ex) { return(ex.Message); } }
public Sec_UserDevices Single(string filter, string Value = null) { DataTable dt = udDL.Get(filter, Value); Sec_UserDevices ud = new Sec_UserDevices(); if (dt.Rows.Count > 0) { ud.DeviceId = int.Parse(dt.Rows[0]["DeviceId"].ToString()); ud.UserId = int.Parse(dt.Rows[0]["UserId"].ToString()); ud.IMEI = (dt.Columns.Contains("IMEI"))? dt.Rows[0]["IMEI"].ToString():null; ud.IMEI = (dt.Columns.Contains("SerialNo"))? dt.Rows[0]["SerialNo"].ToString():null; ud.MAC = dt.Rows[0]["MAC"].ToString(); ud.Manufacturer = dt.Rows[0]["Manufacturer"].ToString(); ud.Model = dt.Rows[0]["Model"].ToString(); ud.UserFullName = (dt.Columns.Contains("UserFullName")) ? dt.Rows[0]["UserFullName"].ToString() : ""; } return(ud); }
public List <Sec_UserDevices> ToList(string filter, string Value = null) { DataTable dt = udDL.Get(filter, Value); List <Sec_UserDevices> udl = new List <Sec_UserDevices>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Sec_UserDevices ud = new Sec_UserDevices(); ud.DeviceId = (dt.Columns.Contains("DeviceId"))? int.Parse(dt.Rows[i]["DeviceId"].ToString()):0; if (ud.DeviceId == 0) { if (dt.Rows[i]["UEId"].ToString() != "") { ud.DeviceId = (dt.Columns.Contains("UEId")) ? int.Parse(dt.Rows[i]["UEId"].ToString()) : 0; } else { ud.DeviceId = 0; } } ud.UserId = (dt.Columns.Contains("UserId")) ? int.Parse(dt.Rows[i]["UserId"].ToString()):0; ud.IMEI = (dt.Columns.Contains("IMEI")) ? dt.Rows[i]["IMEI"].ToString():null; if (ud.IMEI == null) { ud.IMEI = (dt.Columns.Contains("SerialNo")) ? dt.Rows[i]["SerialNo"].ToString() : null; } ud.MAC = dt.Rows[i]["MAC"].ToString(); ud.Manufacturer = dt.Rows[i]["Manufacturer"].ToString(); ud.Model = dt.Rows[i]["Model"].ToString(); ud.IsActive = (dt.Columns.Contains("isActive")) ? bool.Parse(dt.Rows[i]["isActive"].ToString()):false; ud.UserFullName = (dt.Columns.Contains("UserFullName")) ? dt.Rows[i]["UserFullName"].ToString() : ""; udl.Add(ud); } } return(udl); }
public string New(string[] DeviceId, int UserId, string[] Manufacturer, string[] Model, string[] IMEI, string[] MAC) { try { Sec_UserDevicesBL udb = new Sec_UserDevicesBL(); Sec_UserDevices dev; for (int i = 0; i < Manufacturer.Length; i++) { dev = new Sec_UserDevices(); if (!string.IsNullOrEmpty(DeviceId[i])) { dev.DeviceId = int.Parse(DeviceId[i]); } dev.UserId = UserId; dev.Manufacturer = Manufacturer[i]; dev.Model = Model[i]; dev.IMEI = IMEI[i]; dev.MAC = MAC[i]; if (dev.DeviceId > 0) { udb.Manage("Update", dev); } else if (udb.Manage("Insert", dev)) { // TempData["msg_success"] = "success"; } } return(null); } catch (Exception ex) { // TempData["msg_error"] = ex.Message; return(ex.Message); } }