public static List <Person> LoadList(BdDatabase database, string mask) { DateTime Jan1 = new DateTime(2017, 1, 1); DateTime Dec31 = new DateTime(2017, 12, 31); return(LoadList(database, Jan1, Dec31, false, 0, mask)); }
public static Person Load(BdDatabase database, int id) { string query = PulpBirthday.Resources.Queries.Person.Load; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("id", id); using (FbDataReader reader = database.ExecuteReader(query, parameters)) { Person person = null; if (reader.Read()) { person = new Classes.Person(reader); } reader.Close(); if (person == null) { throw new ArgumentOutOfRangeException(PulpBirthday.Resources.Message.IdentifierNotFoundError); } return(person); } }
public static List <Person> LoadList(BdDatabase database, DateTime dateFrom, DateTime dateTo, bool forList, int sortingOrder, string mask) { string query = PulpBirthday.Resources.Queries.Person.LoadListSortedByName; if (sortingOrder == 1) { query = PulpBirthday.Resources.Queries.Person.LoadListSortedByBirthday; } Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("dateFrom", dateFrom); parameters.Add("dateTo", dateTo); parameters.Add("isList", forList); parameters.Add("mask", mask); List <Person> personList = new List <Person>(); using (FbDataReader reader = database.ExecuteReader(query, parameters)) { while (reader.Read()) { personList.Add(new Person(reader)); } reader.Close(); } return(personList); }
public void Delete(BdDatabase database) { Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("id", Id); database.ExecuteQuery(DeleteQuery, parameters); }
public void Save(BdDatabase database) { if (Id == 0) { InsertDataItem(database); } else { UpdateDataItem(database); } }
private void InsertDataItem(BdDatabase database) { Id = (int)database.ExecuteScalar(InsertQuery, CreateParameterList()); }
private void UpdateDataItem(BdDatabase database) { database.ExecuteQuery(UpdateQuery, CreateParameterList()); }