Пример #1
0
        public static ESetting GetSetting(string key)
        {
            ESetting model = null;

            try
            {
                model = BaseDAL.Instance.ExecuteQuery("usp_GetSetting", new List <MySqlParameter>()
                {
                    new MySqlParameter("@KeyE", key)
                }).To <ESetting>().FirstOrDefault();
            }
            catch (Exception ex)
            {
                CoreLogger.Instance.Error(ex);
            }
            if (model == null)
            {
                model = new ESetting()
                {
                    Key   = key,
                    Value = string.Empty
                };
            }
            return(model);
        }
Пример #2
0
        public static int SaveSetting(ESetting model)
        {
            int rs = 0;

            try
            {
                rs = BaseDAL.Instance.ExecuteNonQuery("usp_AddSetting", new List <MySqlParameter>()
                {
                    new MySqlParameter("@KeyE", model.Key),
                    new MySqlParameter("@ValueE", model.Value)
                });
            }
            catch (Exception ex)
            {
                rs = -1;
                CoreLogger.Instance.Error(ex);
            }
            return(rs);
        }