示例#1
0
        public bool SaveConfig(BaseConfig_Supplier model, int Supplier_id)
        {
            //return SerializationHelper.Save(model, this.xmlpath);
            Type type = model.GetType();
            Lebi_Supplier_Config cf;

            foreach (System.Reflection.PropertyInfo p in type.GetProperties())
            {
                if (p.GetValue(model, null) == null)
                {
                    continue;
                }
                cf = B_Lebi_Supplier_Config.GetModel("Supplier_id = " + Supplier_id + " and Name='" + p.Name + "'");
                if (cf == null)
                {
                    cf             = new Lebi_Supplier_Config();
                    cf.Name        = p.Name;
                    cf.Value       = p.GetValue(model, null).ToString();
                    cf.Supplier_id = Supplier_id;
                    B_Lebi_Supplier_Config.Add(cf);
                }
                else
                {
                    cf.Name  = p.Name;
                    cf.Value = p.GetValue(model, null).ToString();
                    B_Lebi_Supplier_Config.Update(cf);
                }
            }
            ShopCache.SetBaseConfig(Supplier_id);//更新缓存
            return(true);
        }
示例#2
0
        /// <summary>
        /// 设置一个设置值
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public static void Set(string key, string value)
        {
            Lebi_Supplier_Config conf = B_Lebi_Supplier_Config.GetModel("Name='" + key + "'");

            if (conf == null)
            {
                conf       = new Lebi_Supplier_Config();
                conf.Name  = key;
                conf.Value = value;
                B_Lebi_Supplier_Config.Add(conf);
            }
            else
            {
                conf.Value = value;
                B_Lebi_Supplier_Config.Update(conf);
            }
        }