Beispiel #1
0
        public bool UpdateBoard(BoardGroup board)
        {
            if (board == null)
            {
                throw new XinLuClubException(400, "board不能为null");
            }
            if (string.IsNullOrEmpty(board.ID))
            {
                throw new XinLuClubException(400, "boardID不能为空");
            }
            TopicBLL bll = new TopicBLL();

            return(bll.UpdateBoard(new BoardGroupUpdateForm
            {
                Entity = new BoardGroup
                {
                    Name = board.Name,
                    Description = board.Description,
                    Enabled = board.Enabled,
                },
                QueryForm = new BoardGroupQueryForm
                {
                    ID = board.ID
                }
            }));
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string deleteid = Request.Form["id"];

            if (deleteid != null)
            {
                if (TopicBLL.DeleteTopicLittleInfo(int.Parse(deleteid)))
                {
                    Response.Write("yes");
                    Response.End();
                }

                else
                {
                    Response.Write("no");
                    Response.End();
                }
            }

            if (!IsPostBack)
            {
                string page = Request.QueryString["page"].ToString();
                pageIndex = int.Parse(page);
                dt        = new TopicBLL().GetTopicLitterInfo();
                PagedDataSource pds = new PagedDataSource();
                pds.AllowPaging      = true;
                pds.PageSize         = 10;
                pds.CurrentPageIndex = pageIndex - 1;
                pds.DataSource       = dt.DefaultView;
                pageCount            = pds.PageCount;
                rpInfo.DataSource    = pds;
                rpInfo.DataBind();
            }
        }
Beispiel #3
0
        public List <BoardGroup> GetBoardGroupList()
        {
            TopicBLL bll = new TopicBLL();

            return(bll.GetBoardGroupList(new BoardGroupQueryForm {
            }));
        }
Beispiel #4
0
        public List <FullTopicInfo> SearchMyTopic(string searchContent)
        {
            TopicBLL topicbll = new TopicBLL();
            LoginBLL login    = new LoginBLL();
            var      me       = login.GetMe();

            return(topicbll.SearchMyTopic(searchContent, me.ID));
        }
Beispiel #5
0
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            string    keywords = txtkeyword.Value;
            DataTable dt2      = TopicBLL.GetByKeyWordInfo(keywords);

            rpInfo.DataSource = dt2;
            rpInfo.DataBind();
        }
Beispiel #6
0
        public string AddBoard(BoardGroup board)
        {
            if (board == null)
            {
                throw new XinLuClubException(400, "board不能为null");
            }
            TopicBLL bll = new TopicBLL();

            return(bll.AddBoard(board));
        }
Beispiel #7
0
        public bool DeleteBoard(string boardID)
        {
            if (string.IsNullOrEmpty(boardID))
            {
                throw new XinLuClubException(400, "boardID不能为空");
            }
            TopicBLL bll = new TopicBLL();

            return(bll.DeleteBoard(new BoardGroupQueryForm {
                ID = boardID
            }));
        }
Beispiel #8
0
        /// <summary>
        /// 专题列表
        /// </summary>
        /// <param name="tag"></param>
        private void Topiclist(Tag tag)
        {
            object collection = null;
            PagedResult <Topic> result;
            string topictype = ((StringLiteral)tag.AttributeValue("topictype")).Content;
            string dataId    = ((StringLiteral)tag.AttributeValue("id")).Content;
            // int count = int.Parse(((StringLiteral)tag.AttributeValue("count")).Content);
            int pagesize  = int.Parse(((StringLiteral)tag.AttributeValue("pagesize")).Content);
            int pagecount = int.Parse(((StringLiteral)tag.AttributeValue("pagecount")).Content);
            //if (count.ToString() == null)
            //{
            //    count = 1;
            //}
            TopicBLL topicBLL = Factory.BusinessFactory.CreateBll <TopicBLL>();

            result = topicBLL.GetTopicFrontList("", topictype, pagecount, pagesize);

            if (result.Result == null)
            {
                SetValue("total", 0);
                collection = new List <News>();
            }
            else
            {
                SetValue("total", result.Result.Count);
                collection = result.Result;
            }
            if (pagecount > 1)
            {
                //数据库真实的总页数
                int pageTotal = result.Total % pagesize > 0 ? result.Total / pagesize + 1 : result.Total / pagesize;
                if (pageTotal > 0 && pageTotal < pagecount)
                {
                    pagecount = pageTotal;
                }
                if (pagecount > int.Parse(variables["pagecount"].ToString()))
                {
                    SetValue("pagecount", pagecount.ToString());
                }
            }

            SetValue(dataId, collection);

            Expression expVar = tag.AttributeValue("var");

            if (expVar == null)
            {
                throw new TemplateRuntimeException("foreach 语法缺少 var 属性定义.", tag.Line, tag.Col);
            }

            object varObject = EvalExpression(expVar);

            if (varObject == null)
            {
                varObject = "foreach";
            }
            string     varname   = varObject.ToString();
            Expression expIndex  = tag.AttributeValue("index");
            string     indexname = null;

            if (expIndex != null)
            {
                object obj = EvalExpression(expIndex);
                if (obj != null)
                {
                    indexname = obj.ToString();
                }
            }
            //判断是否循环的最后一条标识
            Expression islastExp = tag.AttributeValue("islast");
            string     islast    = null;

            if (islastExp != null)
            {
                object obj = EvalExpression(islastExp);
                if (obj != null)
                {
                    islast = obj.ToString();
                }
            }
            IEnumerator ienum = ((IEnumerable)collection).GetEnumerator();
            int         index = 0;

            if (islast != null)
            {
                variables[islast] = false;
            }
            while (ienum.MoveNext())
            {
                index++;
                if (index == ((List <Topic>)collection).Count && islast != null)
                {
                    variables[islast] = true;
                }
                object value = ienum.Current;
                variables[varname] = value;
                if (indexname != null)
                {
                    variables[indexname] = index;
                }

                ProcessElements(tag.InnerElements);
            }
        }