public void GivenDateSelectPackageByDate() { var pack = CreateTestPackage(); _packageManager.AddPackage(pack); var list = _db.GetPackagesByDate(new DateTime(2015, 7, 16), new DateTime(2015, 7, 26)); foreach (Package item in list) { if (item.Name.Equals("testpack")) { Assert.That(item.BeginDate == pack.BeginDate && item.EndDate == pack.EndDate); } } _packageManager.RemovePackage(pack); }
public async void Initialize() { IsOperationInProgress = true; DbWrapper = new DbWrapper(); UserManager = new UserManager(DbWrapper); if (VacationMasters.MainPage.search_criterion == 1) { List = new ObservableCollection <Package>(DbWrapper.GetPackagesByName(VacationMasters.MainPage.pk_name)); } if (VacationMasters.MainPage.search_criterion == 2) { List = new ObservableCollection <Package>(DbWrapper.GetPackagesByPrice(VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price)); } if (VacationMasters.MainPage.search_criterion == 3) { List = new ObservableCollection <Package>(DbWrapper.GetPackagesByDate(VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date)); } if (VacationMasters.MainPage.search_criterion == 4) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByType(VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 5) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByPriceDate(VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date)); } if (VacationMasters.MainPage.search_criterion == 6) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByPriceType(VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 7) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByDateType(VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 8) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNamePrice(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price)); } if (VacationMasters.MainPage.search_criterion == 9) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNameDate(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date)); } if (VacationMasters.MainPage.search_criterion == 10) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNameType(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 11) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNamePriceDate(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date)); } if (VacationMasters.MainPage.search_criterion == 12) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNamePriceType(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 13) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByNameDateType(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 14) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByPriceDateType(VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date, VacationMasters.MainPage.pk_type)); } if (VacationMasters.MainPage.search_criterion == 15) { List = new ObservableCollection <Package>(DbWrapper.getPackagesByAll(VacationMasters.MainPage.pk_name, VacationMasters.MainPage.pk_min_price, VacationMasters.MainPage.pk_max_price, VacationMasters.MainPage.pk_begin_date, VacationMasters.MainPage.pk_end_date, VacationMasters.MainPage.pk_type)); } IsOperationInProgress = false; }
private void Search(object sender, RoutedEventArgs e) { if (!String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.GetPackagesByName(name.Text); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.GetPackagesByPrice(Convert.ToInt32(min_price.Text), Convert.ToInt32(max_price.Text)); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.GetPackagesByDate(begin_date.Date.DateTime, end_date.Date.DateTime); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByType(type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.getPackagesByPriceDate(Convert.ToInt32(min_price.Text), Convert.ToInt32(max_price.Text), begin_date.Date.DateTime, end_date.Date.DateTime); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByPriceType(Convert.ToInt32(min_price.Text), Convert.ToInt32(max_price.Text), type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByDateType(begin_date.Date.DateTime, end_date.Date.DateTime, type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.getPackagesByNamePrice(name.Text, Convert.ToInt32(min_price.Text), Convert.ToInt32(min_price.Text)); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.getPackagesByNameDate(name.Text, begin_date.Date.DateTime, end_date.Date.DateTime); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByNameType(name.Text, type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem == null) { var packages = DbWrapper.getPackagesByNamePriceDate(name.Text, Convert.ToInt32(min_price), Convert.ToInt32(max_price), begin_date.Date.DateTime, end_date.Date.DateTime); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date == DateTimeOffset.MinValue && end_date.Date == DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByNamePriceType(name.Text, Convert.ToInt32(min_price), Convert.ToInt32(max_price), type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && String.IsNullOrEmpty(min_price.Text) && String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByNameDateType(name.Text, begin_date.Date.DateTime, end_date.Date.DateTime, type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByPriceDateType(Convert.ToInt32(min_price), Convert.ToInt32(max_price), begin_date.Date.DateTime, end_date.Date.DateTime, type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } if (!String.IsNullOrEmpty(name.Text) && !String.IsNullOrEmpty(min_price.Text) && !String.IsNullOrEmpty(max_price.Text) && begin_date.Date != DateTimeOffset.MinValue && end_date.Date != DateTimeOffset.MinValue && type_combo.SelectedItem != null) { var packages = DbWrapper.getPackagesByAll(name.Text, Convert.ToInt32(min_price), Convert.ToInt32(max_price), begin_date.Date.DateTime, end_date.Date.DateTime, type_combo.SelectedValue.ToString()); foreach (Package pack in packages) { //set gridview components } } }