예제 #1
0
        /// <summary>
        /// 修改 (可能有其他业务逻辑检查)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultInfo Update(BBSEnum model)
        {
            ResultInfo ri = new ResultInfo();

            if (Edit(model))
            {
                ri.Ok  = true;
                ri.Msg = "修改成功";
            }

            return(ri);
        }
예제 #2
0
 /// <summary>
 /// 判断用户是否能够发表文章
 /// </summary>
 /// <returns></returns>
 public bool CanPublishArticle()
 {
     if (IsLogin)
     {
         BBSEnum levels = BBSEnumBLL.Instance.GetSetArticleRol();
         if (levels != null)
         {
             return(UserExtBLL.Instance.HasEnoughCoin(1, (int)levels.SortIndex, UserInfo.UserID));
         }
     }
     return(false);
 }
예제 #3
0
        /// <summary>
        /// 保存 (可能有其他业务逻辑检查)
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        public ResultInfo Create(BBSEnum model)
        {
            ResultInfo ri = new ResultInfo();

            if (model == null)
            {
                return(ri);
            }

            int result = Add(model);

            if (result > 0)
            {
                ri.Ok  = true;
                ri.Msg = "添加成功";
            }

            return(ri);
        }
예제 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(BBSEnum model, SqlTransaction tran = null)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BBSEnum set ");
            strSql.Append("EnumType=@EnumType,EnumDesc=@EnumDesc,EnumCode=@EnumCode,Url=@Url,IsBBS=@IsBBS,SortIndex=@SortIndex,CreateTime=@CreateTime,CreateUser=@CreateUser,UpdateTime=@UpdateTime,UpdateUser=@UpdateUser,IsDelete=@IsDelete,CanArticle=@CanArticle,FontBGColor=@FontBGColor,PageBGColor=@PageBGColor,FontColor=@FontColor,GroupBy=@GroupBy");

            strSql.Append(" where BBSEnumId=@BBSEnumId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EnumType",    model.EnumType),
                new SqlParameter("@EnumDesc",    model.EnumDesc),
                new SqlParameter("@EnumCode",    model.EnumCode),
                new SqlParameter("@Url",         model.Url),
                new SqlParameter("@IsBBS",       model.IsBBS),
                new SqlParameter("@SortIndex",   model.SortIndex),
                new SqlParameter("@CreateTime",  model.CreateTime),
                new SqlParameter("@CreateUser",  model.CreateUser),
                new SqlParameter("@UpdateTime",  model.UpdateTime),
                new SqlParameter("@UpdateUser",  model.UpdateUser),
                new SqlParameter("@IsDelete",    model.IsDelete),
                new SqlParameter("@CanArticle",  model.CanArticle),
                new SqlParameter("@FontBGColor", model.FontBGColor),
                new SqlParameter("@PageBGColor", model.PageBGColor),
                new SqlParameter("@FontColor",   model.FontColor),
                new SqlParameter("@GroupBy",     model.GroupBy),


                new SqlParameter("@BBSEnumId",   model.BBSEnumId)
            };

            if (tran == null)
            {
                return(SqlHelper.ExecuteSql(strSql.ToString(), CommandType.Text, parameters) > 0);
            }
            else
            {
                return(SqlHelper.ExecuteSql(tran, CommandType.Text, strSql.ToString(), parameters) > 0);
            }
        }
예제 #5
0
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(BBSEnum model, SqlTransaction tran = null)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BBSEnum(");
            strSql.Append(" EnumType,EnumDesc,EnumCode,Url,IsBBS,SortIndex,CreateTime,CreateUser,UpdateTime,UpdateUser,IsDelete,CanArticle,FontBGColor,PageBGColor,FontColor,GroupBy )");
            strSql.Append(" values (");
            strSql.Append("@EnumType,@EnumDesc,@EnumCode,@Url,@IsBBS,@SortIndex,@CreateTime,@CreateUser,@UpdateTime,@UpdateUser,@IsDelete,@CanArticle,@FontBGColor,@PageBGColor,@FontColor,@GroupBy);select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EnumType",    model.EnumType),
                new SqlParameter("@EnumDesc",    model.EnumDesc),
                new SqlParameter("@EnumCode",    model.EnumCode),
                new SqlParameter("@Url",         model.Url),
                new SqlParameter("@IsBBS",       model.IsBBS),
                new SqlParameter("@SortIndex",   model.SortIndex),
                new SqlParameter("@CreateTime",  model.CreateTime),
                new SqlParameter("@CreateUser",  model.CreateUser),
                new SqlParameter("@UpdateTime",  model.UpdateTime),
                new SqlParameter("@UpdateUser",  model.UpdateUser),
                new SqlParameter("@IsDelete",    model.IsDelete),
                new SqlParameter("@CanArticle",  model.CanArticle),
                new SqlParameter("@FontBGColor", model.FontBGColor),
                new SqlParameter("@PageBGColor", model.PageBGColor),
                new SqlParameter("@FontColor",   model.FontColor),
                new SqlParameter("@GroupBy",     model.GroupBy),
            };

            object obj;

            if (tran == null)
            {
                obj = SqlHelper.GetSingle(strSql.ToString(), CommandType.Text, parameters);
            }
            else
            {
                obj = SqlHelper.GetSingle(tran, CommandType.Text, strSql.ToString(), parameters);
            }
            return(obj == null ? 0 : Convert.ToInt32(obj));
        }
예제 #6
0
 /// <summary>
 /// 修改一条记录
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns></returns>
 public bool Edit(BBSEnum model)
 {
     return(dal.Update(model));
 }
예제 #7
0
 /// <summary>
 /// 添加一条记录,没有任何逻辑
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns></returns>
 public int Add(BBSEnum model)
 {
     return(dal.Add(model));
 }