public HttpResponseMessage StaticProperty(string key, string name)
        {
            HttpContext.Current.Response.ContentType = "text/plain";
            HttpContext.Current.Response.StatusCode  = 200;

            try
            {
                if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(name))
                {
                    StaticProperty CurrentStaticProperty = StaticPropertyDAO.LoadByKeyName(key);

                    string PropertyAlreadyExists = CurrentStaticProperty.PropertyNameValues.Where(e => e.ToUpper().Equals(name.ToUpper())).FirstOrDefault();

                    if (string.IsNullOrWhiteSpace(PropertyAlreadyExists))
                    {
                        CurrentStaticProperty.PropertyNameValues.Add(name);

                        if (StaticPropertyDAO.Save(CurrentStaticProperty))
                        {
                            HttpContext.Current.Response.Write(name);
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Write("Property Already Exists");
                    }
                }
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Admin.UploadController.StaticProperty(): ", e);
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
        /// <summary>
        /// Get a dictionary where the shipping method type is the key and the value is the global price when selecting that shipping method.
        /// </summary>
        /// <param name="shippingMethods"></param>
        /// <param name="paypalPurchaseSettings"></param>
        /// <returns></returns>
        public static Dictionary <string, decimal> GetGlobalShippingMethodDictionary(StaticProperty shippingMethods = null, SettingGroup paypalPurchaseSettings = null)
        {
            if (shippingMethods == null)
            {
                shippingMethods = StaticPropertyDAO.LoadByKeyName(StaticProperty.SHIPPING_METHOD_PROPERTY_KEY);
            }

            if (paypalPurchaseSettings == null)
            {
                paypalPurchaseSettings = SettingGroupDAO.LoadSettingGroupByName(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS);
            }

            Dictionary <string, decimal> GlobalShippingMethodDictionary = new Dictionary <string, decimal>();

            if (shippingMethods != null && shippingMethods.PropertyNameValues != null && shippingMethods.PropertyNameValues.Count > 0)
            {
                foreach (var ShippValueKey in shippingMethods.PropertyNameValues)
                {
                    Setting GlobalShippingPriceSetting = paypalPurchaseSettings.SettingsList.Where(e => e.Key.Equals("GlobalBaseShippingAmt_" + ShippValueKey)).FirstOrDefault();

                    decimal GlobalShippingPrice = 0.00m;

                    if (GlobalShippingPriceSetting != null && !string.IsNullOrWhiteSpace(GlobalShippingPriceSetting.Value))
                    {
                        GlobalShippingPrice = Decimal.Parse(GlobalShippingPriceSetting.Value);
                    }

                    GlobalShippingMethodDictionary.Add(ShippValueKey, GlobalShippingPrice);
                }
            }

            return(GlobalShippingMethodDictionary);
        }
Beispiel #3
0
        /// <summary>
        /// Get the model for the view cart view
        /// </summary>
        /// <returns></returns>
        private ShoppingCartModel GetModel()
        {
            List <SettingGroup> SettingGroupList = SettingGroupDAO.LoadByMultipleGroupNames(new List <string> {
                SettingGroupKeys.ECOMMERCE_SETTINGS, SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS
            });

            SettingGroup EcommerceSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.ECOMMERCE_SETTINGS)).FirstOrDefault();

            SettingGroup PaypalPurchaseSettings = SettingGroupList.Where(e => e.GroupKey.Equals(SettingGroupKeys.PAYPAL_PURCHASE_SETTINGS)).FirstOrDefault();

            StaticProperty ShippingMethods = StaticPropertyDAO.LoadByKeyName(StaticProperty.SHIPPING_METHOD_PROPERTY_KEY);

            return(new ShoppingCartModel(PaypalPurchaseSettings, EcommerceSettings.GetSettingVal(ECommerceSettingKeys.ViewShoppingCartPage), ShippingMethods));
        }