public ICollection <T> SelectAll <T>(T type) where T : new() { Type entType = type.GetType(); if (entType == typeof(City)) { return((ICollection <T>)CityTable.Select()); } if (entType == typeof(Customer)) { return((ICollection <T>)CustomerTable.Select()); } if (entType == typeof(Distillation)) { return((ICollection <T>)DistillationTable.Select()); } if (entType == typeof(District)) { return((ICollection <T>)DistrictTable.Select()); } if (entType == typeof(Material)) { return((ICollection <T>)MaterialTable.Select()); } if (entType == typeof(Period)) { return((ICollection <T>)PeriodTable.Select()); } if (entType == typeof(Region)) { return((ICollection <T>)RegionTable.Select()); } if (entType == typeof(Reservation)) { return((ICollection <T>)ReservationTable.Select()); } if (entType == typeof(Season)) { return((ICollection <T>)SeasonTable.Select()); } if (entType == typeof(UserInfo)) { return((ICollection <T>)UserInfoTable.Select()); } return(null); }
public T Select <T>(T type, int primaryKey) where T : new() { Type entType = type.GetType(); if (entType == typeof(City)) { return((T)Convert.ChangeType(CityTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Customer)) { return((T)Convert.ChangeType(CustomerTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Distillation)) { return((T)Convert.ChangeType(DistillationTable.Select(primaryKey), typeof(T))); } if (entType == typeof(District)) { return((T)Convert.ChangeType(DistrictTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Material)) { return((T)Convert.ChangeType(MaterialTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Period)) { return((T)Convert.ChangeType(PeriodTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Region)) { return((T)Convert.ChangeType(RegionTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Reservation)) { return((T)Convert.ChangeType(ReservationTable.Select(primaryKey), typeof(T))); } if (entType == typeof(Season)) { return((T)Convert.ChangeType(SeasonTable.Select(primaryKey), typeof(T))); } if (entType == typeof(UserInfo)) { return((T)Convert.ChangeType(UserInfoTable.Select(primaryKey), typeof(T))); } return(default(T)); }
public int Delete <T>(T entity) { Type type = entity.GetType(); if (type == typeof(City)) { return(CityTable.Delete((entity as City).Id)); } if (type == typeof(Customer)) { return(CustomerTable.Delete((entity as Customer).Id)); } if (type == typeof(Distillation)) { return(DistillationTable.Delete((entity as Distillation).Id)); } if (type == typeof(District)) { return(DistrictTable.Delete((entity as District).Id)); } if (type == typeof(Material)) { return(MaterialTable.Delete((entity as Material).Id)); } if (type == typeof(Period)) { return(PeriodTable.Delete((entity as Period).Id)); } if (type == typeof(Region)) { return(RegionTable.Delete((entity as Region).Id)); } if (type == typeof(Reservation)) { return(ReservationTable.Delete((entity as Reservation).Id)); } if (type == typeof(Season)) { return(SeasonTable.Delete((entity as Season).Id)); } if (type == typeof(UserInfo)) { return(UserInfoTable.Delete((entity as UserInfo).Id)); } return(0); }
/// <summary> /// Open a list of specific seasons. /// </summary> /// <param name="page">Current ContentPage.</param> /// <param name="seasons">List of seasons to display.</param> /// <param name="title">Title to display in the bar.</param> /// <param name="warning">Indicates it show a warning if not seasons provided.</param> public static void OpenSeasons(ContentPage page, SeasonTable seasons, string title, bool warning = true) { if (seasons != null) { page.Navigation.PushAsync(new SeasonsPage(new SeasonViewModel(seasons, title))); } else { ShowWarning(page, warning); } }