示例#1
0
        /// <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;
        }
        public ActionResult AddNew(string staticPropertyData)
        {
            try
            {
                StaticProperty StaticProperty = new StaticProperty();

                if (!string.IsNullOrWhiteSpace(staticPropertyData))
                {
                    StaticProperty = JsonConvert.DeserializeObject<StaticProperty>(staticPropertyData);
                }

                ViewBag.StaticProperty = StaticProperty;
            }
            catch (Exception e)
            {
                CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.PropertiesController.AddNew() " + e.Message);
            }

            return View();
        }
        public void ProcessFile()
        {
            XmlDocument XmlDoc = new XmlDocument();

            XmlDoc.Load(FilePath);

            foreach (var Node in XmlDoc.DocumentElement.GetElementsByTagName("StaticProperty"))
            {
                XmlElement Element = (XmlElement)Node;

                StaticProperty StaticProp = new StaticProperty();

                StaticProp.KeyName = Element.GetElementsByTagName("KeyName")[0].InnerText;

                foreach (var ChildNode in Element.GetElementsByTagName("Value"))
                {
                    XmlElement ChildElement = (XmlElement)ChildNode;

                    StaticProp.PropertyNameValues.Add(ChildElement.InnerText);
                }

                StaticPropertyDAO.Save(StaticProp);
            }
        }
示例#4
0
 /// <summary>
 /// Save or update a static property with new values
 /// </summary>
 /// <param name="staticProperty"></param>
 /// <returns></returns>
 public static bool Save(StaticProperty staticProperty)
 {
     return Execute.Save<StaticProperty>(COLLECTION_NAME, staticProperty);
 }
 public DataEntryFormField(Setting setting, StaticProperty staticProperty)
 {
     Setting = setting;
     StaticProperty = staticProperty;
 }