public Subscription GetById(string id) { Subscription subscription = null; try { var query = $"select * from AccountModel a where a.id='{id}'"; var subList = _dbase.SelectByQuery <Subscription>(query); if (subList[0] != null) { subscription = subList[0]; } } catch (Exception err) { throw new Exception(Errors.ERR_ACCOUNT_BADREQUEST, err); } return(subscription); }
public DataSet GetDataSetById(string id) { DataSet dataset = null; try { var query = $"select * from DataSet d where d.id='{id}'"; var datasetList = _dbase.SelectByQuery <DataSet>(query); if (datasetList.Count > 0) { dataset = datasetList[0]; } } catch (Exception err) { throw new Exception(Errors.ERR_SIMULATION_BADREQUEST, err); } return(dataset); }
public Organization GetById(string id) { Organization organization = null; try { var query = $"select * from Customer o where o.id='{id}'"; var orgList = _dbase.SelectByQuery <Organization>(query); if (orgList[0] != null) { organization = orgList[0]; } } catch (Exception err) { throw new Exception(Errors.ERR_Customer_BADREQUEST, err); } return(organization); }
public Manifest GetById(string id) { Manifest manifest = null; try { var query = $"select * from Manifest m where m.SerialNumber='{id}'"; var manifestList = _dbase.SelectByQuery <Manifest>(query); if (manifestList[0] != null) { manifest = manifestList[0]; } } catch (Exception err) { throw new Exception(Errors.ERR_DEVICE_BAGREQUEST, err); } return(manifest); }
public Profiles GetAllByType(int type) { Profiles profiles = new Profiles(); try { var query = $"SELECT * FROM ProfileModel p WHERE p.type={type}"; var profileList = _dbase.SelectByQuery <Profile>(query); if (profileList != null) { foreach (var p in profileList) { profiles.list.Add(p); } } } catch (Exception err) { throw new Exception(Errors.ERR_PROFILE_BADREQUEST, err); } return(profiles); }
public Entities GetAllByDomain(string domain) { Entities entities = new Entities(); try { var query = "SELECT * FROM Entity e WHERE e.domain='" + domain + "'"; var entityList = _dbase.SelectByQuery <Entity>(query); if (entityList != null) { foreach (var e in entityList) { entities.list.Add(e); } } } catch (Exception err) { throw new Exception(Errors.ERR_REF_BADREQUEST, err); } return(entities); }
// select list from store public List <T> SelectByQuery <T>(string query) { return(_dbase.SelectByQuery <T>(query)); }