/// <summary> /// Saves the changes. /// </summary> /// <param name="context">The context.</param> public void SaveChanges(IDictionary context) { CountryDto dto = (CountryDto)context[_CountryDtoString]; CountryDto.CountryRow countryRow = null; if (dto == null) { // dto must be created in base control that holds tabs return; } if (dto.Country.Count > 0) { countryRow = dto.Country[0]; } else { countryRow = dto.Country.NewCountryRow(); countryRow.ApplicationId = OrderConfiguration.Instance.ApplicationId; } countryRow.Name = tbCountryName.Text; countryRow.Code = CodeText.Text; countryRow.Ordering = Int32.Parse(SortOrder.Text); countryRow.Visible = IsVisible.IsSelected; if (countryRow.RowState == DataRowState.Detached) { dto.Country.Rows.Add(countryRow); } }
public IEnumerable <CountryDto.StateProvinceRow> GetRegionOptionsByCountryCode(string countryCode) { CountryDto.CountryRow country = _countryManager.GetCountryByCountryCode(countryCode); if (country != null) { return(GetRegionOptionsFromCountry(country)); } return(Enumerable.Empty <CountryDto.StateProvinceRow>()); }
/// <summary> /// Saves the changes. /// </summary> /// <param name="context">The context.</param> public void SaveChanges(IDictionary context) { CountryDto dto = (CountryDto)context[_CountryDtoString]; if (dto == null || dto.Country.Count == 0) { // dto must be created in base control that holds tabs return; } CountryDto.CountryRow countryRow = dto.Country[0]; dto.StateProvince.Merge(_Country.StateProvince, false); //countryRow.Name = tbCountryName.Text; //countryRow.Code = CodeText.Text; //countryRow.Ordering = Int32.Parse(SortOrder.Text); //countryRow.Visible = IsVisible.IsSelected; //if (countryRow.RowState == DataRowState.Detached) // dto.Country.Rows.Add(countryRow); }
private IEnumerable <string> GetRegionsForCountry(CountryDto.CountryRow country) { return(country == null ? Enumerable.Empty <string>() : country.GetStateProvinceRows().Select(x => x.Name).ToList()); }
private IEnumerable <CountryDto.StateProvinceRow> GetRegionOptionsFromCountry(CountryDto.CountryRow country) { if (country == null) { return(_emptyRegionList); } return(country.GetStateProvinceRows().ToList()); }