Beispiel #1
0
        /// <summary>
        /// Gets a shipping method
        /// </summary>
        /// <param name="ShippingMethodID">The shipping method identifier</param>
        /// <returns>Shipping method</returns>
        public static ShippingMethod GetShippingMethodByID(int ShippingMethodID)
        {
            if (ShippingMethodID == 0)
            {
                return(null);
            }

            string key  = string.Format(SHIPPINGMETHODS_BY_ID_KEY, ShippingMethodID);
            object obj2 = NopCache.Get(key);

            if (ShippingMethodManager.CacheEnabled && (obj2 != null))
            {
                return((ShippingMethod)obj2);
            }

            DBShippingMethod dbItem = DBProviderManager <DBShippingMethodProvider> .Provider.GetShippingMethodByID(ShippingMethodID);

            ShippingMethod shippingMethod = DBMapping(dbItem);

            if (ShippingMethodManager.CacheEnabled)
            {
                NopCache.Max(key, shippingMethod);
            }
            return(shippingMethod);
        }
Beispiel #2
0
        /// <summary>
        /// Inserts a shipping method
        /// </summary>
        /// <param name="Name">The name</param>
        /// <param name="Description">The description</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <returns>Shipping method</returns>
        public static ShippingMethod InsertShippingMethod(string Name, string Description, int DisplayOrder)
        {
            DBShippingMethod dbItem = DBProviderManager <DBShippingMethodProvider> .Provider.InsertShippingMethod(Name,
                                                                                                                  Description, DisplayOrder);

            ShippingMethod shippingMethod = DBMapping(dbItem);

            if (ShippingMethodManager.CacheEnabled)
            {
                NopCache.RemoveByPattern(SHIPPINGMETHODS_PATTERN_KEY);
            }
            return(shippingMethod);
        }
        private static ShippingMethod DBMapping(DBShippingMethod dbItem)
        {
            if (dbItem == null)
            {
                return(null);
            }

            var item = new ShippingMethod();

            item.ShippingMethodId = dbItem.ShippingMethodId;
            item.Name             = dbItem.Name;
            item.Description      = dbItem.Description;
            item.DisplayOrder     = dbItem.DisplayOrder;

            return(item);
        }
Beispiel #4
0
 private bool Update()
 {
     return(DBShippingMethod.Update(
                this.shippingMethodID,
                this.siteID,
                this.shippingProvider,
                this.name,
                this.description,
                this.shippingFee,
                this.freeShippingOverXEnabled,
                this.freeShippingOverXValue,
                this.displayOrder,
                this.isActive,
                this.guid,
                this.isDeleted));
 }
Beispiel #5
0
 private void GetShippingMethod(int shippingMethodId)
 {
     using (IDataReader reader = DBShippingMethod.GetOne(shippingMethodId))
     {
         if (reader.Read())
         {
             this.shippingMethodID         = Convert.ToInt32(reader["ShippingMethodID"]);
             this.siteID                   = Convert.ToInt32(reader["SiteID"]);
             this.shippingProvider         = Convert.ToInt32(reader["ShippingProvider"]);
             this.name                     = reader["Name"].ToString();
             this.description              = reader["Description"].ToString();
             this.shippingFee              = Convert.ToDecimal(reader["ShippingFee"]);
             this.freeShippingOverXEnabled = Convert.ToBoolean(reader["FreeShippingOverXEnabled"]);
             this.freeShippingOverXValue   = Convert.ToDecimal(reader["FreeShippingOverXValue"]);
             this.displayOrder             = Convert.ToInt32(reader["DisplayOrder"]);
             this.isActive                 = Convert.ToBoolean(reader["IsActive"]);
             this.guid                     = new Guid(reader["Guid"].ToString());
             this.isDeleted                = Convert.ToBoolean(reader["IsDeleted"]);
         }
     }
 }
Beispiel #6
0
        private bool Create()
        {
            int newID = 0;

            this.guid = Guid.NewGuid();

            newID = DBShippingMethod.Create(
                this.siteID,
                this.shippingProvider,
                this.name,
                this.description,
                this.shippingFee,
                this.freeShippingOverXEnabled,
                this.freeShippingOverXValue,
                this.displayOrder,
                this.isActive,
                this.guid,
                this.isDeleted);

            this.shippingMethodID = newID;

            return(newID > 0);
        }
Beispiel #7
0
        public static List <ShippingMethod> GetByActive(int siteId, int activeStatus, int languageId)
        {
            IDataReader reader = DBShippingMethod.GetByActive(siteId, activeStatus, languageId);

            return(LoadListFromReader(reader));
        }
Beispiel #8
0
 public static bool Delete(int shippingMethodId)
 {
     return(DBShippingMethod.Delete(shippingMethodId));
 }