Beispiel #1
0
        /// <summary>
        /// 批量删除数据
        /// </summary>
        private void OnDelete()
        {
            string itemsAppend = hV.Value.Trim();

            if (string.IsNullOrEmpty(itemsAppend))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "请至少勾选一行进行操作", "错误提醒", "error");
                return;
            }

            if (bll == null)
            {
                bll = new BLL.Bbs.ContentDetail();
            }
            string[]      itemsAppendArr = itemsAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> list           = itemsAppendArr.ToList <string>();

            if (bll.DeleteBatch(list))
            {
                WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功");
                Bind();
            }
            else
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败", "系统提示");
            }
        }
        private void OnSave()
        {
            string sTitle = txtTitle.Value.Trim();

            if (string.IsNullOrEmpty(sTitle))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "标题不能为空,请检查", "温馨提醒", "error");
                return;
            }
            string sParent       = txtParent.Value.Trim();
            Guid   contentTypeId = Guid.Empty;

            if (!string.IsNullOrEmpty(sParent))
            {
                Guid.TryParse(sParent, out contentTypeId);
            }
            string sContent = HttpUtility.UrlDecode(hEditor1.Value).Trim();

            if (bll == null)
            {
                bll = new BLL.Bbs.ContentDetail();
            }
            Model.Bbs.ContentDetail model = new Model.Bbs.ContentDetail();
            model.Title           = sTitle;
            model.ContentTypeID   = contentTypeId;
            model.ContentText     = sContent;
            model.Sort            = 0;
            model.LastUpdatedDate = DateTime.Now;
            model.UserId          = WebHelper.Common.GetUserId();

            int effectCount = -1;

            if (!string.IsNullOrEmpty(nId))
            {
                effectCount = bll.Update(model);
            }
            else
            {
                effectCount = bll.Insert(model);
            }

            if (effectCount == 110)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "已存在相同记录", "温馨提醒", "error");
                return;
            }
            if (effectCount > 0)
            {
                WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功");
            }
            else
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败");
            }
        }
Beispiel #3
0
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int totalCount = 0;

            if (bll == null)
            {
                bll = new BLL.Bbs.ContentDetail();
            }

            rpData.DataSource = bll.GetDataSet(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms == null ? null : parms.ToArray());;
            rpData.DataBind();
            AspNetPager1.RecordCount = totalCount;
        }
 private void Bind()
 {
     if (!string.IsNullOrEmpty(nId))
     {
         if (bll == null)
         {
             bll = new BLL.Bbs.ContentDetail();
         }
         Model.Bbs.ContentDetail model = bll.GetModel(nId);
         if (model != null)
         {
             txtTitle.Value  = model.Title;
             txtParent.Value = model.ContentTypeID.ToString();
             hEditor1.Value  = model.ContentText;
         }
     }
 }