Esempio n. 1
0
        /// <summary>
        /// Updates the ShippingByWeight
        /// </summary>
        /// <param name="ShippingByWeightID">The ShippingByWeight identifier</param>
        /// <param name="ShippingMethodID">The shipping method 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>ShippingByWeight</returns>
        public static ShippingByWeight UpdateShippingByWeight(int ShippingByWeightID, int ShippingMethodID, decimal From, decimal To,
                                                              bool UsePercentage, decimal ShippingChargePercentage, decimal ShippingChargeAmount)
        {
            DBShippingByWeight dbItem = DBProviderManager <DBShippingByWeightProvider> .Provider.UpdateShippingByWeight(ShippingByWeightID, ShippingMethodID, From, To, UsePercentage,
                                                                                                                        ShippingChargePercentage, ShippingChargeAmount);

            ShippingByWeight shippingByWeight = DBMapping(dbItem);

            return(shippingByWeight);
        }
        /// <summary>
        /// Inserts a ShippingByWeight
        /// </summary>
        /// <param name="shippingByWeight">ShippingByWeight</param>
        public void InsertShippingByWeight(ShippingByWeight shippingByWeight)
        {
            if (shippingByWeight == null)
            {
                throw new ArgumentNullException("shippingByWeight");
            }



            _context.ShippingByWeight.AddObject(shippingByWeight);
            _context.SaveChanges();
        }
Esempio n. 3
0
        /// <summary>
        /// Gets a ShippingByWeight
        /// </summary>
        /// <param name="ShippingByWeightID">ShippingByWeight identifier</param>
        /// <returns>ShippingByWeight</returns>
        public static ShippingByWeight GetByID(int ShippingByWeightID)
        {
            if (ShippingByWeightID == 0)
            {
                return(null);
            }

            DBShippingByWeight dbItem = DBProviderManager <DBShippingByWeightProvider> .Provider.GetByID(ShippingByWeightID);

            ShippingByWeight shippingByWeight = DBMapping(dbItem);

            return(shippingByWeight);
        }
        /// <summary>
        /// Updates the ShippingByWeight
        /// </summary>
        /// <param name="shippingByWeight">ShippingByWeight</param>
        public void UpdateShippingByWeight(ShippingByWeight shippingByWeight)
        {
            if (shippingByWeight == null)
            {
                throw new ArgumentNullException("shippingByWeight");
            }


            if (!_context.IsAttached(shippingByWeight))
            {
                _context.ShippingByWeight.Attach(shippingByWeight);
            }

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

            ShippingByWeight item = new ShippingByWeight();
            item.ShippingByWeightID = dbItem.ShippingByWeightID;
            item.ShippingMethodID = dbItem.ShippingMethodID;
            item.From = dbItem.From;
            item.To = dbItem.To;
            item.UsePercentage = dbItem.UsePercentage;
            item.ShippingChargePercentage = dbItem.ShippingChargePercentage;
            item.ShippingChargeAmount = dbItem.ShippingChargeAmount;

            return item;
        }
Esempio n. 6
0
        private static ShippingByWeightCollection DBMapping(DBShippingByWeightCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            ShippingByWeightCollection collection = new ShippingByWeightCollection();

            foreach (DBShippingByWeight dbItem in dbCollection)
            {
                ShippingByWeight item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
        private static ShippingByWeight DBMapping(DBShippingByWeight dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            var item = new ShippingByWeight();

            item.ShippingByWeightId = dbItem.ShippingByWeightId;
            item.ShippingMethodId   = dbItem.ShippingMethodId;
            item.From                     = dbItem.From;
            item.To                       = dbItem.To;
            item.UsePercentage            = dbItem.UsePercentage;
            item.ShippingChargePercentage = dbItem.ShippingChargePercentage;
            item.ShippingChargeAmount     = dbItem.ShippingChargeAmount;

            return(item);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                int shippingMethodId = int.Parse(this.ddlShippingMethod.SelectedItem.Value);
                var shippingByWeight = new ShippingByWeight()
                {
                    ShippingMethodId = shippingMethodId,
                    From = txtFrom.Value,
                    To = txtTo.Value,
                    UsePercentage = cbUsePercentage.Checked,
                    ShippingChargePercentage = txtShippingChargePercentage.Value,
                    ShippingChargeAmount = txtShippingChargeAmount.Value
                };
                this.ShippingByWeightService.InsertShippingByWeight(shippingByWeight);

                BindData();
            }
            catch (Exception exc)
            {
                processAjaxError(exc);
            }
        }
        /// <summary>
        /// Updates the ShippingByWeight
        /// </summary>
        /// <param name="shippingByWeight">ShippingByWeight</param>
        public void UpdateShippingByWeight(ShippingByWeight shippingByWeight)
        {
            if (shippingByWeight == null)
                throw new ArgumentNullException("shippingByWeight");

            if (!_context.IsAttached(shippingByWeight))
                _context.ShippingByWeight.Attach(shippingByWeight);

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

            _context.ShippingByWeight.AddObject(shippingByWeight);
            _context.SaveChanges();
        }