public async Task InsertCountryAsync(CountryListItem item) { _context.Countries.Add(new Database.Entities.Country { Id = Guid.NewGuid(), Name = item.Name, TwoLetterIso = item.IsoTwo }); await _context.SaveChangesAsync(); }
private void PickItem(CountryListItem item) { // ISSUE: reference to a compiler-generated field if (item == null || this.CountryPicked == null) return; // ISSUE: reference to a compiler-generated field this.CountryPicked(this, item.Country); }
public async Task UpdateCountryAsync(CountryListItem item) { var country = await _context.Countries.FirstAsync(p => p.Id == item.Id); country.Name = item.Name; country.TwoLetterIso = item.IsoTwo; await _context.SaveChangesAsync(); }
private void CountriesList_OnTap(object sender, System.Windows.Input.GestureEventArgs e) { CountryListItem selectedItem = this.countriesList.SelectedItem as CountryListItem; this._viewModel.SelectItem(selectedItem); this.PickItem(selectedItem); }
private void ConfigureStaySelectorControl() { StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection]; HotelSearchRS objAreaListHotelSearchRS = (HotelSearchRS)Session["AreaListHotelSearchRS"]; HotelSearchRS objPropertyListHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"]; HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"]; CountryListItem[] objCountryListItems = new CountryListItem[0]; AreaListItem[] objAreaListItems = new AreaListItem[0]; HotelListItem[] objHotelListItems = new HotelListItem[0]; if (ConfigurationManager.AppSettings["EnableHotelSearch"] == "1") { objCountryListItems = this.GetCountryList(objAreaListHotelSearchRS.AreaListItems); objAreaListItems = this.GetCountryAreaList(objStayCriteriaSelection.CountryCode, objAreaListHotelSearchRS.AreaListItems); objHotelListItems = this.GetAreaHotelList(objStayCriteriaSelection.AreaID, objPropertyListHotelSearchRS.HotelListItems); } else { objHotelListItems = objPropertyListHotelSearchRS.HotelListItems; } HotelDescriptiveInfo objHotelDescriptiveInfo = new HotelDescriptiveInfo(); if (objHotelDescriptiveInfoRS.HotelDescriptiveInfos.Length != 0) { objHotelDescriptiveInfo = objHotelDescriptiveInfoRS.HotelDescriptiveInfos[0]; } ucStayCriteriaControl.Clear(); ucStayCriteriaControl.ID = "StayCriteriaSelector"; if (ConfigurationManager.AppSettings["EnableHotelSearch"] == "1") ucStayCriteriaControl.StayCriteriaSelectorType = StayCriteriaSelectorType.HotelSearch; else ucStayCriteriaControl.StayCriteriaSelectorType = StayCriteriaSelectorType.HotelList; ucStayCriteriaControl.CountryListItems = objCountryListItems; ucStayCriteriaControl.AreaListItems = objAreaListItems; ucStayCriteriaControl.HotelListItems = objHotelListItems; ucStayCriteriaControl.StayCriteriaSelectorMode = StayCriteriaSelectorMode.Change; ucStayCriteriaControl.StayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection]; ucStayCriteriaControl.HotelDescriptiveInfo = objHotelDescriptiveInfo; return; }
// Other global resource related support methods public CountryListItem[] GetCountryList(AreaListItem[] objAreaListItems) { List<string> lCountryCodes = new List<string>(); for (int i = 0; i < objAreaListItems.Length; i++) { if (!lCountryCodes.Contains(objAreaListItems[i].CountryCode)) lCountryCodes.Add(objAreaListItems[i].CountryCode); } lCountryCodes.Sort(); List<CountryListItem> lCountryListItems = new List<CountryListItem>(); for (int i = 0; i < lCountryCodes.Count; i++) { CountryListItem liCountryListItem = new CountryListItem(); lCountryListItems.Add(liCountryListItem); liCountryListItem.CountryCode = lCountryCodes[i]; liCountryListItem.CountryName = this.GetCountryName(lCountryCodes[i]); } return lCountryListItems.ToArray(); }
private void ConfigureStaySelectorControl() { StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection]; HotelSearchRS objPropertyListHotelSearchRS = (HotelSearchRS)Session["PropertyListHotelSearchRS"]; CountryListItem[] objCountryListItems = new CountryListItem[0]; AreaListItem[] objAreaListItems = new AreaListItem[0]; HotelListItem[] objHotelListItems = objPropertyListHotelSearchRS.HotelListItems; if (objHotelListItems == null) return; if (objHotelListItems.Length == 1) // default hotel selection if only 1 choice objStayCriteriaSelection.HotelCode = objHotelListItems[0].HotelCode; ucStayCriteriaControl.Clear(); ucStayCriteriaControl.ID = "StayCriteriaSelector"; ucStayCriteriaControl.StayCriteriaSelectorType = StayCriteriaSelectorType.HotelList; ucStayCriteriaControl.StayCriteriaSelectorMode = StayCriteriaSelectorMode.New; ucStayCriteriaControl.CountryListItems = objCountryListItems; ucStayCriteriaControl.AreaListItems = objAreaListItems; ucStayCriteriaControl.HotelListItems = objHotelListItems; ucStayCriteriaControl.StayCriteriaSelection = objStayCriteriaSelection; ucStayCriteriaControl.HotelDescriptiveInfo = null; return; }