Exemple #1
0
        public bool SaveConfig(BaseConfig_DT model, int DT_id)
        {
            //return SerializationHelper.Save(model, this.xmlpath);
            Type           type = model.GetType();
            Lebi_DT_Config cf;

            foreach (System.Reflection.PropertyInfo p in type.GetProperties())
            {
                if (p.GetValue(model, null) == null)
                {
                    continue;
                }
                cf = B_Lebi_DT_Config.GetModel("DT_id = " + DT_id + " and Name='" + p.Name + "'");
                if (cf == null)
                {
                    cf       = new Lebi_DT_Config();
                    cf.Name  = p.Name;
                    cf.Value = p.GetValue(model, null).ToString();
                    cf.DT_id = DT_id;
                    B_Lebi_DT_Config.Add(cf);
                }
                else
                {
                    cf.Name  = p.Name;
                    cf.Value = p.GetValue(model, null).ToString();
                    B_Lebi_DT_Config.Update(cf);
                }
            }
            ShopCache.SetBaseConfig(DT_id);//更新缓存
            return(true);
        }