public static ContractType GetContractType(string contractTypeId, QueryHelper qh) { var query = QueryHelper.BuildSelectQuery(ContractType.DB_TABLE_NAME, new[] { "*" }.ToList(), new[] { ContractType.DB_ID }.ToList(), new[] { contractTypeId }.ToList()); var queryResult = qh.QuerySelect(query); return queryResult.Select(ContractType.Parse).FirstOrDefault(); }
public static User GetUser(string userid, QueryHelper qh) { var query = QueryHelper.BuildSelectQuery(User.DB_TABLE_NAME, new[] { "*" }.ToList(), new[] { User.DB_ID }.ToList(), new[] { userid }.ToList()); var queryResult = qh.QuerySelect(query); return queryResult.Select(User.Parse).FirstOrDefault(); }
public static List<ContractForm> GetAllContractForms(QueryHelper qh) { try { var query = QueryHelper.BuildSelectQuery(ContractForm.DB_TABLE_NAME, new[] { "*" }.ToList()); var queryResult = qh.QuerySelect(query); return queryResult.Select(ContractForm.Parse).ToList(); } catch (ArgumentNullException ex) { throw new ArgumentNullException("Can't GetAllContractForms", ex); } }
public static Customer GetCustomer(string customerId, QueryHelper qh) { try { string query = QueryHelper.BuildSelectQuery(Customer.DB_TABLE_NAME, new[] { "*" }.ToList(), new[] { Customer.DB_ID }.ToList(), new[] { customerId }.ToList()); var queryResult = qh.QuerySelect(query); return queryResult.Select(Customer.Parse).FirstOrDefault(); } catch (ArgumentNullException ex) { throw new Exception("Can't GetCustomer", ex); } }