public bool AddTipBannerTypeConfig(TipBannerTypeConfigModel model, string user)
        {
            var result = false;

            try
            {
                var pkid = dbScopeManagerConfig.Execute(conn => DalTipBannerConfig.AddTipBannerTypeConfig(conn, model));
                if (pkid > 0)
                {
                    result       = true;
                    model.TypeId = pkid;
                    var log = new BaoYangOprLog
                    {
                        LogType     = "TipBannerTypeConfig",
                        IdentityID  = model.TypeName,
                        OldValue    = null,
                        NewValue    = JsonConvert.SerializeObject(model),
                        Remarks     = "AddType",
                        OperateUser = user,
                    };
                    LoggerManager.InsertLog("BYOprLog", log);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("AddTipBannerTypeConfig", ex);
            }

            return(result);
        }
        /// <summary>
        /// 添加新的提示条类型
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int AddTipBannerTypeConfig(SqlConnection conn, TipBannerTypeConfigModel model)
        {
            var sql        = @"INSERT  Configuration..TipBannerTypeConfig
                                ( TypeName )
                        VALUES  ( @TypeName )
                        SELECT  SCOPE_IDENTITY();";
            var parameters = new[]
            {
                new SqlParameter("@TypeName", model.TypeName)
            };

            return(Convert.ToInt32(SqlHelper.ExecuteScalar(conn, CommandType.Text, sql, parameters)));
        }
        public ActionResult AddTipBannerTypeConfig(TipBannerTypeConfigModel model = null)
        {
            if (string.IsNullOrWhiteSpace(model.TypeName))
            {
                return(Json(new { Status = false, Msg = "新类型信息不能为空" }, JsonRequestBehavior.AllowGet));
            }
            TipBannerConfigManager manager = new TipBannerConfigManager();
            var isRepeat = manager.IsRepeatTipBannerTypeConfig(model.TypeName);

            if (isRepeat)
            {
                return(Json(new { Status = false, Msg = "不能添加重复数据" }, JsonRequestBehavior.AllowGet));
            }
            var result = manager.AddTipBannerTypeConfig(model, User.Identity.Name);

            if (result)
            {
                return(Json(new { Status = true, Msg = "添加新类型成功" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Status = false, Msg = "添加新类型失败" }));
            }
        }