public ClientInformation GetClientInformation(string id) { database.Open(); DataTable result = database.Select("SELECT * FROM client where client_id = @client_id", new Dictionary<string, object> { {"@client_id", id} }); if (result.Rows.Count == 0) throw new ArgumentException("There is no client_id " + id, "id"); ClientInformation c = new ClientInformation(); c.Fill(result.Rows[0]); database.Close(); return c; }
public List<ClientInformation> GetClientInformations() { database.Open(); List<ClientInformation> r = new List<ClientInformation>(); DataTable table = database.Select("select * from client"); foreach (DataRow row in table.Rows) { ClientInformation c = new ClientInformation(); c.Fill(row); r.Add(c); } database.Close(); return r; }
public List<ClientInformation> GetClientsByName(string name) { List<ClientInformation> list = new List<ClientInformation>(); var result = database.Select("SELECT * FROM Client WHERE name = @name", new Dictionary<string, object>() { {"@name", name} }); foreach (DataRow row in result.Rows) { ClientInformation c = new ClientInformation(); c.Fill(row); list.Add(c); } return list; }