コード例 #1
0
        /// <summary>
        /// 得到一个对象实体(重载,带事务)
        /// </summary>
        public Model.Forum_Board GetModel(SqlConnection conn, SqlTransaction trans, int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1  " + column);
            strSql.Append(" from " + databaseprefix + "forum_board ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.Forum_Board model = new Model.Forum_Board();
            DataSet           ds    = DbHelperSQL.Query(conn, trans, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: board_edit.aspx.cs プロジェクト: hui3694/forcomp
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.Forum_Board   bll   = new BLL.Forum_Board();
            Model.Forum_Board model = bll.GetModel(_id);

            //编写编辑操作Begin
            model.Icon        = txtIcon.Text;
            model.Rule        = txtRule.Text;
            model.Description = txtDescription.Text;
            model.ChildCol    = Convert.ToInt32(txtChildCol.Text);
            model.ParentId    = int.Parse(ddlParentId.SelectedValue);
            model.Show        = int.Parse(rblShow.SelectedValue);
            model.Url         = txtUrl.Text;
            model.Name        = txtName.Text;
            model.SortId      = Convert.ToInt32(txtSortId.Text);
            //编写编辑操作End

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.Name); //记录日志
                result = true;
            }

            return(result);
        }
コード例 #3
0
ファイル: board_edit.aspx.cs プロジェクト: hui3694/forcomp
        private bool DoAdd()
        {
            Model.Forum_Board model = new Model.Forum_Board();
            BLL.Forum_Board   bll   = new BLL.Forum_Board();
            //编写添加操作Begin

            model.Icon        = txtIcon.Text;
            model.Rule        = txtRule.Text;
            model.Description = txtDescription.Text;
            model.ChildCol    = Convert.ToInt32(txtChildCol.Text);
            model.ParentId    = int.Parse(ddlParentId.SelectedValue);
            model.Show        = int.Parse(rblShow.SelectedValue);
            model.Url         = txtUrl.Text;
            model.Name        = txtName.Text;
            model.SortId      = Convert.ToInt32(txtSortId.Text);

            //编写添加操作End

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加dt_Forum_Board:"
                            + model.Name); //记录日志
                return(true);
            }
            return(false);
        }
コード例 #4
0
        /// <summary>
        /// 增加一条数据,内部已经处理分表回贴,版块统计,属归作者表,积分
        /// </summary>
        public int Add(Model.Forum_Topic model, out int _subTable_id, out int _post_id)
        {
            Forum_PostSubTable bllSubTable = new Forum_PostSubTable();
            Forum_Board        bllBoard    = new Forum_Board();

            Model.Forum_PostSubTable modelSubTable = bllSubTable.GetModel("Avail=1");

            //分表ID
            _subTable_id = modelSubTable.Id;

            model.PostSubTable = _subTable_id;

            //主题表ID
            int _topic_id = dal.Add(model);

            //回复表ID
            _post_id = new Forum_PostId().Add(new Model.Forum_PostId {
                TopicId = _topic_id
            });

            new Forum_Post(_subTable_id).Add(model, new Model.Forum_Post
            {
                BoardId      = model.BoardId,
                Message      = model.Message,
                Title        = model.Title,
                PostDateTime = model.PostDatetime,
                PostNickname = model.PostNickname,
                PostUsername = model.PostUsername,
                PostUserId   = model.PostUserId,
                Id           = _post_id,
                TopicId      = _topic_id,
                First        = 1
            });

            //版块包括父级版块的统计、标记最后发贴

            string strValue = "[TodayTopicCount]=[TodayTopicCount]+1,[TopicCount]=[TopicCount]+1,[LastPostUserId]=" + model.PostUserId + ",[LastPostUsername]='" + model.PostUsername.Replace("'", "") + "',[LastPostNickname]='" + model.PostNickname.Replace("'", "") + "',[LastTopicId]=" + _topic_id + ",[LastTopicTitle]='" + model.Title.Replace("'", "") + "'";

            Model.Forum_Board modelBoard = bllBoard.GetModel(model.BoardId);

            bllBoard.UpdateField(" Id in (0" + modelBoard.ClassList + "0) ", strValue);

            //文章归属
            new Forum_MyTopic().Add(new Model.Forum_MyTopic {
                TopicId = _topic_id, UserId = model.PostUserId
            });

            //获得实际积分
            int _point = new BLL.Forum_BoardActionPoint().GetRealPoint(model.BoardId, 1);

            new Forum_UserExtended().UpdateField(model.PostUserId, " TopicCount=TopicCount+1 ,Credit=Credit+" + _point);

            modelSubTable.TopicCount += 1;

            bllSubTable.Update(modelSubTable);

            return(_topic_id);
        }
コード例 #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Forum_Board model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        //先判断选中的父节点是否被包含
                        if (IsContainNode(model.Id, model.ParentId))
                        {
                            //查找旧数据
                            Model.Forum_Board oldModel = GetModel(model.Id);
                            //查找旧父节点数据
                            string class_list  = "," + model.ParentId + ",";
                            int    class_layer = 1;
                            if (oldModel.ParentId > 0)
                            {
                                Model.Forum_Board oldParentModel = GetModel(conn, trans, oldModel.ParentId); //带事务
                                class_list  = oldParentModel.ClassList + model.ParentId + ",";
                                class_layer = oldParentModel.ClassLayer + 1;
                            }
                            //先提升选中的父节点
                            DbHelperSQL.ExecuteSql(conn, trans, "update " + databaseprefix + "Forum_Board set ParentId=" + oldModel.ParentId + ",ClassList='" + class_list + "', ClassLayer=" + class_layer + " where id=" + model.ParentId); //带事务
                            UpdateChilds(conn, trans, model.ParentId);                                                                                                                                                                        //带事务
                        }
                        //更新子节点
                        if (model.ParentId > 0)
                        {
                            Model.Forum_Board model2 = GetModel(conn, trans, model.ParentId); //带事务
                            model.ClassList  = model2.ClassList + model.Id + ",";
                            model.ClassLayer = model2.ClassLayer + 1;
                        }
                        else
                        {
                            model.ClassList  = "," + model.Id + ",";
                            model.ClassLayer = 1;
                        }

                        UpdateModel(model);

                        //更新子节点
                        UpdateChilds(conn, trans, model.Id);
                        trans.Commit();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
コード例 #6
0
ファイル: board_edit.aspx.cs プロジェクト: hui3694/forcomp
        private void ShowInfo(int _id)
        {
            BLL.Forum_Board   bll   = new BLL.Forum_Board();
            Model.Forum_Board model = bll.GetModel(_id);
            //编写赋值操作Begin

            txtIcon.Text        = model.Icon;
            txtRule.Text        = model.Rule;
            txtDescription.Text = model.Description;
            txtChildCol.Text    = model.ChildCol.ToString();

            ddlParentId.SelectedValue = model.ParentId.ToString();
            rblShow.SelectedValue     = model.Show.ToString();
            txtUrl.Text    = model.Url;
            txtSortId.Text = model.SortId.ToString();
            txtName.Text   = model.Name;


            //编写赋值操作End
        }
コード例 #7
0
        /// <summary>
        /// 修改子节点的ID列表及深度(自身迭代)
        /// </summary>
        /// <param name="parent_id"></param>
        private void UpdateChilds(SqlConnection conn, SqlTransaction trans, int parent_id)
        {
            //查找父节点信息
            Model.Forum_Board model = GetModel(conn, trans, parent_id);
            if (model != null)
            {
                //查找子节点
                string  strSql = "select id from " + databaseprefix + "forum_board where parentId=" + parent_id;
                DataSet ds     = DbHelperSQL.Query(conn, trans, strSql); //带事务
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //修改子节点的ID列表及深度
                    int    id          = int.Parse(dr["id"].ToString());
                    string class_list  = model.ClassList + id + ",";
                    int    class_layer = model.ClassLayer + 1;
                    DbHelperSQL.ExecuteSql(conn, trans, "update " + databaseprefix + "forum_board set classList='" + class_list + "', classLayer=" + class_layer + " where id=" + id); //带事务

                    //调用自身迭代
                    this.UpdateChilds(conn, trans, id); //带事务
                }
            }
        }
コード例 #8
0
ファイル: board.cs プロジェクト: hui3694/forcomp
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            board_id = DTRequest.GetQueryInt("board_id");

            modelBoard = new BLL.Forum_Board().GetModel(board_id);

            //显示列表时
            if (modelBoard.ChildCount == 0)
            {
                int _groupId = 0;

                if (modelUserExtended != null)
                {
                    _groupId = modelUserExtended.GroupId;
                }

                if (!BLL.Forum_BoardPermission.CheckPermission(board_id + "|" + _groupId, "VisitBoard"))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("不好意思,目前您还没有权限进入!")));
                    return;
                }
            }


            page = DTRequest.GetQueryInt("page", 1);

            drTopList = new BLL.Forum_Topic().GetTopList(board_id).Select(" 1=1 ");

            drTopicList = new BLL.Forum_Topic().GetList(25, page, " BoardId=" + board_id + " and [Top]=0 and [Id] not in (" + Global.GetForumTopTopicIds(board_id) + ")", " LastPostDatetime desc ", out totalcount).Tables[0].Select(" 1=1 ", " LastPostDatetime desc ");

            drModeratorList = new BLL.Forum_Moderator().GetList("BoardId=" + board_id).Tables[0].Select(" 1=1 ");

            pagelist = OutPageList(25, page, totalcount, linkurl("forum_board", board_id, "__id__"), 10);

            //权限
            bolOperate = CheckOperate(board_id);
        }
コード例 #9
0
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            topic_id = DTRequest.GetQueryInt("topic_id", 0);
            page     = DTRequest.GetQueryInt("page", 1);

            if (page < 0)
            {
                page = 900000;
            }

            if (topic_id != 0)
            {
                BLL.Forum_Topic bllTopic = new BLL.Forum_Topic();


                modelTopic = bllTopic.GetModel(topic_id);

                if (modelTopic == null)
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("我的天,贴子没啦!")));

                    return;

                    //modelTopic = new Model.Forum_Topic();
                }

                int _groupId = 0;

                if (modelUserExtended != null)
                {
                    _groupId = modelUserExtended.GroupId;
                }

                if (!BLL.Forum_BoardPermission.CheckPermission(modelTopic.BoardId + "|" + _groupId, "VisitTopic"))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("不好意思,目前您还没有权限进入!")));
                    return;
                }


                bool bolViewCount = false;

                //禁止过于频繁的过度刷新
                if (HttpContext.Current.Session["SESSION_FORUM_TOPIC"] == null)
                {
                    HttpContext.Current.Session["SESSION_FORUM_TOPIC"] = topic_id;

                    bolViewCount = true;
                }
                else if (Convert.ToInt32(HttpContext.Current.Session["SESSION_FORUM_TOPIC"]) != topic_id)
                {
                    bolViewCount = true;
                }

                if (bolViewCount)
                {
                    bllTopic.UpdateField(topic_id, "ViewCount=ViewCount+1");
                }

                board_id = modelTopic.BoardId;
            }

            modelBoard = new BLL.Forum_Board().GetModel(board_id);

            if (modelBoard == null)
            {
                modelBoard = new Model.Forum_Board();
            }

            drPostList = new BLL.Forum_Post(modelTopic.PostSubTable).GetList(20, page, "", topic_id, "id asc", out totalcount).Tables[0].Select(" 1=1 ", "id asc");

            pagelist = OutPageList(20, page, totalcount, linkurl("forum_topic", topic_id, "__id__"), 10);

            //权限
            bolOperate = CheckOperate(board_id);
        }
コード例 #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Forum_Board model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into " + databaseprefix + "Forum_Board(");
                        strSql.Append("PostCount,CreateTime,UpdateTime,Icon,[Rule],Description,ChildCol,LastPostUserId,LastPostUsername,LastPostNickname,ParentId,LastTopicId,LastTopicTitle,Url,Show,ClassList,ClassLayer,SortId,LeftNumber,RightNumber,Layer,ChildCount,Name,TodayTopicCount,TopicCount");
                        strSql.Append(") values (");
                        strSql.Append("@PostCount,@CreateTime,@UpdateTime,@Icon,@Rule,@Description,@ChildCol,@LastPostUserId,@LastPostUsername,@LastPostNickname,@ParentId,@LastTopicId,@LastTopicTitle,@Url,@Show,@ClassList,@ClassLayer,@SortId,@LeftNumber,@RightNumber,@Layer,@ChildCount,@Name,@TodayTopicCount,@TopicCount");
                        strSql.Append(") ");
                        strSql.Append(";select @@IDENTITY");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@PostCount",        SqlDbType.Int,         4),
                            new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                            new SqlParameter("@UpdateTime",       SqlDbType.DateTime),
                            new SqlParameter("@Icon",             SqlDbType.NVarChar,  256),
                            new SqlParameter("@Rule",             SqlDbType.NText),
                            new SqlParameter("@Description",      SqlDbType.NText),
                            new SqlParameter("@ChildCol",         SqlDbType.SmallInt,    2),
                            new SqlParameter("@LastPostUserId",   SqlDbType.Int,         4),
                            new SqlParameter("@LastPostUsername", SqlDbType.NVarChar,   32),
                            new SqlParameter("@LastPostNickname", SqlDbType.NVarChar,   50),
                            new SqlParameter("@ParentId",         SqlDbType.Int,         4),
                            new SqlParameter("@LastTopicId",      SqlDbType.Int,         4),
                            new SqlParameter("@LastTopicTitle",   SqlDbType.NVarChar,   64),
                            new SqlParameter("@Url",              SqlDbType.NVarChar,  256),
                            new SqlParameter("@Show",             SqlDbType.Int,         4),
                            new SqlParameter("@ClassList",        SqlDbType.NVarChar,  255),
                            new SqlParameter("@ClassLayer",       SqlDbType.Int,         4),
                            new SqlParameter("@SortId",           SqlDbType.Int,         4),
                            new SqlParameter("@LeftNumber",       SqlDbType.Int,         4),
                            new SqlParameter("@RightNumber",      SqlDbType.Int,         4),
                            new SqlParameter("@Layer",            SqlDbType.Int,         4),
                            new SqlParameter("@ChildCount",       SqlDbType.Int,         4),
                            new SqlParameter("@Name",             SqlDbType.NVarChar,   64),
                            new SqlParameter("@TodayTopicCount",  SqlDbType.Int,         4),
                            new SqlParameter("@TopicCount",       SqlDbType.Int, 4)
                        };

                        parameters[0].Value  = model.PostCount;
                        parameters[1].Value  = model.CreateTime;
                        parameters[2].Value  = model.UpdateTime;
                        parameters[3].Value  = model.Icon;
                        parameters[4].Value  = model.Rule;
                        parameters[5].Value  = model.Description;
                        parameters[6].Value  = model.ChildCol;
                        parameters[7].Value  = model.LastPostUserId;
                        parameters[8].Value  = model.LastPostUsername;
                        parameters[9].Value  = model.LastPostNickname;
                        parameters[10].Value = model.ParentId;
                        parameters[11].Value = model.LastTopicId;
                        parameters[12].Value = model.LastTopicTitle;
                        parameters[13].Value = model.Url;
                        parameters[14].Value = model.Show;
                        parameters[15].Value = model.ClassList;
                        parameters[16].Value = model.ClassLayer;
                        parameters[17].Value = model.SortId;
                        parameters[18].Value = model.LeftNumber;
                        parameters[19].Value = model.RightNumber;
                        parameters[20].Value = model.Layer;
                        parameters[21].Value = model.ChildCount;
                        parameters[22].Value = model.Name;
                        parameters[23].Value = model.TodayTopicCount;
                        parameters[24].Value = model.TopicCount;

                        object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

                        model.Id = Convert.ToInt32(obj);

                        if (model.ParentId > 0)
                        {
                            Model.Forum_Board model2 = GetModel(conn, trans, model.ParentId); //带事务
                            model.ClassList  = model2.ClassList + model.Id + ",";
                            model.ClassLayer = model2.ClassLayer + 1;
                        }
                        else
                        {
                            model.ClassList  = "," + model.Id + ",";
                            model.ClassLayer = 1;
                        }
                        //修改节点列表和深度
                        DbHelperSQL.ExecuteSql(conn, trans, "update " + databaseprefix + "forum_board set classList='" + model.ClassList + "', classLayer=" + model.ClassLayer + " where id=" + model.Id); //带事务
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(0);
                    }
                }
            }

            UpdateChildCount();

            return(model.Id);
        }
コード例 #11
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Forum_Board DataRowToModel(DataRow row)
        {
            if (row != null)
            {
                Model.Forum_Board model = new Model.Forum_Board();

                if (row["Id"].ToString() != "")
                {
                    model.Id = int.Parse(row["Id"].ToString());
                }
                if (row["PostCount"].ToString() != "")
                {
                    model.PostCount = int.Parse(row["PostCount"].ToString());
                }
                if (row["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
                }
                if (row["UpdateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString());
                }
                model.Icon        = row["Icon"].ToString();
                model.Rule        = row["Rule"].ToString();
                model.Description = row["Description"].ToString();
                if (row["ChildCol"].ToString() != "")
                {
                    model.ChildCol = int.Parse(row["ChildCol"].ToString());
                }
                if (row["LastPostUserId"].ToString() != "")
                {
                    model.LastPostUserId = int.Parse(row["LastPostUserId"].ToString());
                }
                model.LastPostUsername = row["LastPostUsername"].ToString();
                model.LastPostNickname = row["LastPostNickname"].ToString();
                if (row["ParentId"].ToString() != "")
                {
                    model.ParentId = int.Parse(row["ParentId"].ToString());
                }
                if (row["LastTopicId"].ToString() != "")
                {
                    model.LastTopicId = int.Parse(row["LastTopicId"].ToString());
                }
                model.LastTopicTitle = row["LastTopicTitle"].ToString();
                model.Url            = row["Url"].ToString();
                if (row["Show"].ToString() != "")
                {
                    model.Show = int.Parse(row["Show"].ToString());
                }
                model.ClassList = row["ClassList"].ToString();
                if (row["ClassLayer"].ToString() != "")
                {
                    model.ClassLayer = int.Parse(row["ClassLayer"].ToString());
                }
                if (row["SortId"].ToString() != "")
                {
                    model.SortId = int.Parse(row["SortId"].ToString());
                }
                if (row["LeftNumber"].ToString() != "")
                {
                    model.LeftNumber = int.Parse(row["LeftNumber"].ToString());
                }
                if (row["RightNumber"].ToString() != "")
                {
                    model.RightNumber = int.Parse(row["RightNumber"].ToString());
                }
                if (row["Layer"].ToString() != "")
                {
                    model.Layer = int.Parse(row["Layer"].ToString());
                }
                if (row["ChildCount"].ToString() != "")
                {
                    model.ChildCount = int.Parse(row["ChildCount"].ToString());
                }
                model.Name = row["Name"].ToString();
                if (row["TodayTopicCount"].ToString() != "")
                {
                    model.TodayTopicCount = int.Parse(row["TodayTopicCount"].ToString());
                }
                if (row["TopicCount"].ToString() != "")
                {
                    model.TopicCount = int.Parse(row["TopicCount"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #12
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateModel(Model.Forum_Board model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "Forum_Board set ");

            strSql.Append(" PostCount = @PostCount , ");
            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" UpdateTime = @UpdateTime , ");
            strSql.Append(" Icon = @Icon , ");
            strSql.Append(" [Rule] = @Rule , ");
            strSql.Append(" Description = @Description , ");
            strSql.Append(" ChildCol = @ChildCol , ");
            strSql.Append(" LastPostUserId = @LastPostUserId , ");
            strSql.Append(" LastPostUsername = @LastPostUsername , ");
            strSql.Append(" LastPostNickname = @LastPostNickname , ");
            strSql.Append(" ParentId = @ParentId , ");
            strSql.Append(" LastTopicId = @LastTopicId , ");
            strSql.Append(" LastTopicTitle = @LastTopicTitle , ");
            strSql.Append(" Url = @Url , ");
            strSql.Append(" Show = @Show , ");
            strSql.Append(" ClassList = @ClassList , ");
            strSql.Append(" ClassLayer = @ClassLayer , ");
            strSql.Append(" SortId = @SortId , ");
            strSql.Append(" LeftNumber = @LeftNumber , ");
            strSql.Append(" RightNumber = @RightNumber , ");
            strSql.Append(" Layer = @Layer , ");
            strSql.Append(" ChildCount = @ChildCount , ");
            strSql.Append(" Name = @Name , ");
            strSql.Append(" TodayTopicCount = @TodayTopicCount , ");
            strSql.Append(" TopicCount = @TopicCount  ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",               SqlDbType.Int,         4),
                new SqlParameter("@PostCount",        SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                new SqlParameter("@UpdateTime",       SqlDbType.DateTime),
                new SqlParameter("@Icon",             SqlDbType.NVarChar,  256),
                new SqlParameter("@Rule",             SqlDbType.NText),
                new SqlParameter("@Description",      SqlDbType.NText),
                new SqlParameter("@ChildCol",         SqlDbType.SmallInt,    2),
                new SqlParameter("@LastPostUserId",   SqlDbType.Int,         4),
                new SqlParameter("@LastPostUsername", SqlDbType.NVarChar,   32),
                new SqlParameter("@LastPostNickname", SqlDbType.NVarChar,   50),
                new SqlParameter("@ParentId",         SqlDbType.Int,         4),
                new SqlParameter("@LastTopicId",      SqlDbType.Int,         4),
                new SqlParameter("@LastTopicTitle",   SqlDbType.NVarChar,   64),
                new SqlParameter("@Url",              SqlDbType.NVarChar,  256),
                new SqlParameter("@Show",             SqlDbType.Int,         4),
                new SqlParameter("@ClassList",        SqlDbType.NVarChar,  255),
                new SqlParameter("@ClassLayer",       SqlDbType.Int,         4),
                new SqlParameter("@SortId",           SqlDbType.Int,         4),
                new SqlParameter("@LeftNumber",       SqlDbType.Int,         4),
                new SqlParameter("@RightNumber",      SqlDbType.Int,         4),
                new SqlParameter("@Layer",            SqlDbType.Int,         4),
                new SqlParameter("@ChildCount",       SqlDbType.Int,         4),
                new SqlParameter("@Name",             SqlDbType.NVarChar,   64),
                new SqlParameter("@TodayTopicCount",  SqlDbType.Int,         4),
                new SqlParameter("@TopicCount",       SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.PostCount;
            parameters[2].Value  = model.CreateTime;
            parameters[3].Value  = model.UpdateTime;
            parameters[4].Value  = model.Icon;
            parameters[5].Value  = model.Rule;
            parameters[6].Value  = model.Description;
            parameters[7].Value  = model.ChildCol;
            parameters[8].Value  = model.LastPostUserId;
            parameters[9].Value  = model.LastPostUsername;
            parameters[10].Value = model.LastPostNickname;
            parameters[11].Value = model.ParentId;
            parameters[12].Value = model.LastTopicId;
            parameters[13].Value = model.LastTopicTitle;
            parameters[14].Value = model.Url;
            parameters[15].Value = model.Show;
            parameters[16].Value = model.ClassList;
            parameters[17].Value = model.ClassLayer;
            parameters[18].Value = model.SortId;
            parameters[19].Value = model.LeftNumber;
            parameters[20].Value = model.RightNumber;
            parameters[21].Value = model.Layer;
            parameters[22].Value = model.ChildCount;
            parameters[23].Value = model.Name;
            parameters[24].Value = model.TodayTopicCount;
            parameters[25].Value = model.TopicCount;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                UpdateChildCount();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
ファイル: Forum_Board.cs プロジェクト: hui3694/forcomp
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.Forum_Board model)
 {
     return(dal.Update(model));
 }
コード例 #14
0
ファイル: Forum_Board.cs プロジェクト: hui3694/forcomp
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.Forum_Board model)
 {
     return(dal.Add(model));
 }
コード例 #15
0
ファイル: post.cs プロジェクト: hui3694/forcomp
        protected bool bolAttachment = false; //是否有上传附件的权限

        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            board_id = DTRequest.GetQueryInt("board_id", 0);
            topic_id = DTRequest.GetQueryInt("topic_id", 0);
            post_id  = DTRequest.GetQueryInt("post_id", 0);
            action   = DTRequest.GetQueryString("action");

            if (Request.UrlReferrer == null)
            {
                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,源路异常请正确访问!")));

                return;
            }

            if (GetOnlineUser() == null)
            {
                Response.Write("<script> alert('对不起,您还未登录!');window.location.href='" + Request.UrlReferrer.ToString() + "';</script>");
                Response.End();
                return;
            }

            modelBoard = new BLL.Forum_Board().GetModel(board_id);

            if (modelBoard == null)
            {
                modelBoard = new Model.Forum_Board();
            }

            if (topic_id != 0)
            {
                modelTopic = new BLL.Forum_Topic().GetModel(topic_id);

                if (modelTopic == null)
                {
                    modelTopic = new Model.Forum_Topic();
                }
            }

            if (action != "reply")
            {
                if (post_id != 0)
                {
                    modelPost = new BLL.Forum_Post(modelTopic.PostSubTable).GetModel(post_id);

                    if (modelPost == null)
                    {
                        modelPost = new Model.Forum_Post();
                    }
                }

                if (post_id != 0)
                {
                    drAttList = new BLL.Forum_Attachment().GetList(" UserId=" + modelUserExtended.UserId + " and BoardId=" + board_id + " and TopicId=" + topic_id + " and PostId=" + post_id + " ").Tables[0].Select(" 1=1 ", "id asc");
                }
            }

            drSubList = new BLL.Forum_Board().GetAllList(board_id).Select(" 1=1 ", "SortId asc");

            turl = Request.UrlReferrer.ToString();


            int _groupId = 0;

            if (modelUserExtended != null)
            {
                _groupId = modelUserExtended.GroupId;
            }

            bolAttachment = BLL.Forum_BoardPermission.CheckPermission(board_id + "|" + _groupId, "UploadAttachment");
        }