protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                int shippingMethodId = int.Parse(this.ddlShippingMethod.SelectedItem.Value);
                int countryId = int.Parse(this.ddlCountry.SelectedItem.Value);
                var shippingByWeightAndCountry = new ShippingByWeightAndCountry()
                {
                    ShippingMethodId = shippingMethodId,
                    CountryId = countryId,
                    From = txtFrom.Value,
                    To = txtTo.Value,
                    UsePercentage = cbUsePercentage.Checked,
                    ShippingChargePercentage = txtShippingChargePercentage.Value,
                    ShippingChargeAmount = txtShippingChargeAmount.Value
                };
                this.ShippingByWeightAndCountryService.InsertShippingByWeightAndCountry(shippingByWeightAndCountry);

                BindData();
            }
            catch (Exception exc)
            {
                processAjaxError(exc);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Inserts a ShippingByWeightAndCountry
        /// </summary>
        /// <param name="shippingByWeightAndCountry">ShippingByWeightAndCountry</param>
        public void InsertShippingByWeightAndCountry(ShippingByWeightAndCountry shippingByWeightAndCountry)
        {
            if (shippingByWeightAndCountry == null)
            {
                throw new ArgumentNullException("shippingByWeightAndCountry");
            }



            _context.ShippingByWeightAndCountry.AddObject(shippingByWeightAndCountry);
            _context.SaveChanges();
        }
Beispiel #3
0
        /// <summary>
        /// Updates the ShippingByWeightAndCountry
        /// </summary>
        /// <param name="ShippingByWeightAndCountryID">The ShippingByWeightAndCountry identifier</param>
        /// <param name="ShippingMethodID">The shipping method identifier</param>
        /// <param name="CountryID">The country identifier</param>
        /// <param name="From">The "from" value</param>
        /// <param name="To">The "to" value</param>
        /// <param name="UsePercentage">A value indicating whether to use percentage</param>
        /// <param name="ShippingChargePercentage">The shipping charge percentage</param>
        /// <param name="ShippingChargeAmount">The shipping charge amount</param>
        /// <returns>ShippingByWeightAndCountry</returns>
        public static ShippingByWeightAndCountry UpdateShippingByWeightAndCountry(int ShippingByWeightAndCountryID,
                                                                                  int ShippingMethodID, int CountryID, decimal From, decimal To,
                                                                                  bool UsePercentage, decimal ShippingChargePercentage, decimal ShippingChargeAmount)
        {
            DBShippingByWeightAndCountry dbItem = DBProviderManager <DBShippingByWeightAndCountryProvider> .Provider.UpdateShippingByWeightAndCountry(ShippingByWeightAndCountryID,
                                                                                                                                                      ShippingMethodID, CountryID, From, To, UsePercentage,
                                                                                                                                                      ShippingChargePercentage, ShippingChargeAmount);

            ShippingByWeightAndCountry shippingByWeightAndCountry = DBMapping(dbItem);

            return(shippingByWeightAndCountry);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a ShippingByWeightAndCountry
        /// </summary>
        /// <param name="ShippingByWeightAndCountryID">ShippingByWeightAndCountry identifier</param>
        /// <returns>ShippingByWeightAndCountry</returns>
        public static ShippingByWeightAndCountry GetByID(int ShippingByWeightAndCountryID)
        {
            if (ShippingByWeightAndCountryID == 0)
            {
                return(null);
            }

            DBShippingByWeightAndCountry dbItem = DBProviderManager <DBShippingByWeightAndCountryProvider> .Provider.GetByID(ShippingByWeightAndCountryID);

            ShippingByWeightAndCountry shippingByWeightAndCountry = DBMapping(dbItem);

            return(shippingByWeightAndCountry);
        }
Beispiel #5
0
        /// <summary>
        /// Updates the ShippingByWeightAndCountry
        /// </summary>
        /// <param name="shippingByWeightAndCountry">ShippingByWeightAndCountry</param>
        public void UpdateShippingByWeightAndCountry(ShippingByWeightAndCountry shippingByWeightAndCountry)
        {
            if (shippingByWeightAndCountry == null)
            {
                throw new ArgumentNullException("shippingByWeightAndCountry");
            }


            if (!_context.IsAttached(shippingByWeightAndCountry))
            {
                _context.ShippingByWeightAndCountry.Attach(shippingByWeightAndCountry);
            }

            _context.SaveChanges();
        }
        private static ShippingByWeightAndCountry DBMapping(DBShippingByWeightAndCountry dbItem)
        {
            if (dbItem == null)
                return null;

            ShippingByWeightAndCountry item = new ShippingByWeightAndCountry();
            item.ShippingByWeightAndCountryID = dbItem.ShippingByWeightAndCountryID;
            item.ShippingMethodID = dbItem.ShippingMethodID;
            item.CountryID = dbItem.CountryID;
            item.From = dbItem.From;
            item.To = dbItem.To;
            item.UsePercentage = dbItem.UsePercentage;
            item.ShippingChargePercentage = dbItem.ShippingChargePercentage;
            item.ShippingChargeAmount = dbItem.ShippingChargeAmount;

            return item;
        }
Beispiel #7
0
        private static ShippingByWeightAndCountryCollection DBMapping(DBShippingByWeightAndCountryCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            ShippingByWeightAndCountryCollection collection = new ShippingByWeightAndCountryCollection();

            foreach (DBShippingByWeightAndCountry dbItem in dbCollection)
            {
                ShippingByWeightAndCountry item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Beispiel #8
0
        private static ShippingByWeightAndCountry DBMapping(DBShippingByWeightAndCountry dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            var item = new ShippingByWeightAndCountry();

            item.ShippingByWeightAndCountryId = dbItem.ShippingByWeightAndCountryId;
            item.ShippingMethodId             = dbItem.ShippingMethodId;
            item.CountryId                = dbItem.CountryId;
            item.From                     = dbItem.From;
            item.To                       = dbItem.To;
            item.UsePercentage            = dbItem.UsePercentage;
            item.ShippingChargePercentage = dbItem.ShippingChargePercentage;
            item.ShippingChargeAmount     = dbItem.ShippingChargeAmount;

            return(item);
        }
        /// <summary>
        /// Updates the ShippingByWeightAndCountry
        /// </summary>
        /// <param name="shippingByWeightAndCountry">ShippingByWeightAndCountry</param>
        public void UpdateShippingByWeightAndCountry(ShippingByWeightAndCountry shippingByWeightAndCountry)
        {
            if (shippingByWeightAndCountry == null)
                throw new ArgumentNullException("shippingByWeightAndCountry");

            if (!_context.IsAttached(shippingByWeightAndCountry))
                _context.ShippingByWeightAndCountry.Attach(shippingByWeightAndCountry);

            _context.SaveChanges();
        }
        /// <summary>
        /// Inserts a ShippingByWeightAndCountry
        /// </summary>
        /// <param name="shippingByWeightAndCountry">ShippingByWeightAndCountry</param>
        public void InsertShippingByWeightAndCountry(ShippingByWeightAndCountry shippingByWeightAndCountry)
        {
            if (shippingByWeightAndCountry == null)
                throw new ArgumentNullException("shippingByWeightAndCountry");

            _context.ShippingByWeightAndCountry.AddObject(shippingByWeightAndCountry);
            _context.SaveChanges();
        }