コード例 #1
0
        private static Country DBMapping(DBCountry dbItem)
        {
            if (dbItem == null)
                return null;

            Country item = new Country();
            item.CountryID = dbItem.CountryID;
            item.Name = dbItem.Name;
            item.AllowsRegistration = dbItem.AllowsRegistration;
            item.AllowsBilling = dbItem.AllowsBilling;
            item.AllowsShipping = dbItem.AllowsShipping;
            item.TwoLetterISOCode = dbItem.TwoLetterISOCode;
            item.ThreeLetterISOCode = dbItem.ThreeLetterISOCode;
            item.NumericISOCode = dbItem.NumericISOCode;
            item.Published = dbItem.Published;
            item.DisplayOrder = dbItem.DisplayOrder;

            return item;
        }
コード例 #2
0
        public Country SaveInfo()
        {
            Country country = this.CountryService.GetCountryById(this.CountryId);

            if (country != null)
            {
                country.Name = txtName.Text;
                country.AllowsRegistration = cbAllowsRegistration.Checked;
                country.AllowsBilling = cbAllowsBilling.Checked;
                country.AllowsShipping= cbAllowsShipping.Checked;
                country.TwoLetterIsoCode = txtTwoLetterISOCode.Text;
                country.ThreeLetterIsoCode = txtThreeLetterISOCode.Text;
                country.NumericIsoCode = txtNumericISOCode.Value;
                country.SubjectToVAT = cbSubjectToVAT.Checked;
                country.Published = cbPublished.Checked;
                country.DisplayOrder = txtDisplayOrder.Value;
                this.CountryService.UpdateCountry(country);
            }
            else
            {
                country = new Country()
                {
                    Name = txtName.Text,
                    AllowsRegistration = cbAllowsRegistration.Checked,
                    AllowsBilling = cbAllowsBilling.Checked,
                    AllowsShipping = cbAllowsShipping.Checked,
                    TwoLetterIsoCode = txtTwoLetterISOCode.Text,
                    ThreeLetterIsoCode = txtThreeLetterISOCode.Text,
                    NumericIsoCode = txtNumericISOCode.Value,
                    SubjectToVAT = cbSubjectToVAT.Checked,
                    Published = cbPublished.Checked,
                    DisplayOrder = txtDisplayOrder.Value
                };
                this.CountryService.InsertCountry(country);
            }

            return country;
        }
コード例 #3
0
 /// <summary>
 /// Get Paypal country code
 /// </summary>
 /// <param name="country">Country</param>
 /// <returns>Paypal country code</returns>
 protected CountryCodeType GetPaypalCountryCodeType(Country country)
 {
     CountryCodeType payerCountry = CountryCodeType.US;
     try
     {
         payerCountry = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), country.TwoLetterIsoCode);
     }
     catch
     {
     }
     return payerCountry;
 }
コード例 #4
0
ファイル: TaxManager.cs プロジェクト: netmatrix01/Innocent
        /// <summary>
        /// Gets VAT Number status
        /// </summary>
        /// <param name="country">Country</param>
        /// <param name="vatNumber">VAT number</param>
        /// <returns>VAT Number status</returns>
        public static VatNumberStatusEnum GetVatNumberStatus(Country country,
            string vatNumber)
        {
            if (vatNumber == null)
                vatNumber = string.Empty;

            vatNumber = vatNumber.Trim();

            if (String.IsNullOrEmpty(vatNumber))
                return VatNumberStatusEnum.Empty;

            if (country == null)
                return VatNumberStatusEnum.Unknown;

            if (!TaxManager.EUVatUseWebService)
                return VatNumberStatusEnum.Unknown;

            //UNDONE
            try
            {
                string name = string.Empty;
                string address = string.Empty;
                Exception exception = null;
                return DoVatCheck(country.TwoLetterIsoCode, vatNumber, out name, out address, out exception);
            }
            catch (Exception exc)
            {
                Debug.WriteLine(exc.ToString());
                return VatNumberStatusEnum.Unknown;
            }
        }
コード例 #5
0
ファイル: TaxService.cs プロジェクト: robbytarigan/ToyHouse
 /// <summary>
 /// Gets VAT Number status
 /// </summary>
 /// <param name="country">Country</param>
 /// <param name="vatNumber">VAT number</param>
 /// <returns>VAT Number status</returns>
 public VatNumberStatusEnum GetVatNumberStatus(Country country,
     string vatNumber)
 {
     string name = string.Empty;
     string address = string.Empty;
     return GetVatNumberStatus(country, vatNumber, out name, out address);
 }
コード例 #6
0
        /// <summary>
        /// Updates the country
        /// </summary>
        /// <param name="country">Country</param>
        public void UpdateCountry(Country country)
        {
            if (country == null)
                throw new ArgumentNullException("country");

            country.Name = CommonHelper.EnsureNotNull(country.Name);
            country.Name = CommonHelper.EnsureMaximumLength(country.Name, 100);
            country.TwoLetterIsoCode = CommonHelper.EnsureNotNull(country.TwoLetterIsoCode);
            country.TwoLetterIsoCode = CommonHelper.EnsureMaximumLength(country.TwoLetterIsoCode, 2);
            country.ThreeLetterIsoCode = CommonHelper.EnsureNotNull(country.ThreeLetterIsoCode);
            country.ThreeLetterIsoCode = CommonHelper.EnsureMaximumLength(country.ThreeLetterIsoCode, 3);

            if (!_context.IsAttached(country))
                _context.Countries.Attach(country);

            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(COUNTRIES_PATTERN_KEY);
            }
        }