예제 #1
0
        /// <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);
            }
        }
예제 #2
0
 public IEnumerable <CountryDto.StateProvinceRow> GetRegionOptionsByCountryCode(string countryCode)
 {
     CountryDto.CountryRow country = _countryManager.GetCountryByCountryCode(countryCode);
     if (country != null)
     {
         return(GetRegionOptionsFromCountry(country));
     }
     return(Enumerable.Empty <CountryDto.StateProvinceRow>());
 }
예제 #3
0
        /// <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);
        }
예제 #4
0
 private IEnumerable <string> GetRegionsForCountry(CountryDto.CountryRow country)
 {
     return(country == null
         ? Enumerable.Empty <string>()
         : country.GetStateProvinceRows().Select(x => x.Name).ToList());
 }
예제 #5
0
 private IEnumerable <CountryDto.StateProvinceRow> GetRegionOptionsFromCountry(CountryDto.CountryRow country)
 {
     if (country == null)
     {
         return(_emptyRegionList);
     }
     return(country.GetStateProvinceRows().ToList());
 }