private void Bind() { int totalCount = 0; if (bll == null) { bll = new BLL.SystemProfile(); } 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.SystemProfile(); } Model.SystemProfile model = bll.GetModel(nId); if (model != null) { txtTitle.Value = model.Title; hEditor1.Value = model.ContentText; } } }
/// <summary> /// 保存数据 /// </summary> private void OnSave() { #region 获取输入并验证 string sTitle = txtTitle.Value.Trim(); string sContentText = hEditor1.Value; #endregion if (bll == null) { bll = new BLL.SystemProfile(); } Model.SystemProfile model = new Model.SystemProfile(); model.Title = sTitle; model.ContentText = sContentText; model.LastUpdatedDate = DateTime.Now; int result = -1; if (!string.IsNullOrEmpty(nId)) { model.NumberID = nId; result = bll.Update(model); } else { result = bll.Insert(model); } if (result == 110) { WebHelper.MessageBox.Messager(this.Page, lbtnSave, "已存在相同记录!"); return; } if (result > 0) { WebHelper.MessageBox.MessagerShow(this.Page, lbtnSave, "提交成功!"); } else { WebHelper.MessageBox.Messager(this.Page, lbtnSave, "提交失败,系统异常!", "系统提示"); } }
/// <summary> /// 获取系统预设,并绑定到页面显示 /// </summary> /// <param name="productId"></param> private void BindSystemProfile(Literal ltr, string title) { if (!string.IsNullOrEmpty(productId)) { if (list == null) { if (syspBll == null) { syspBll = new BLL.SystemProfile(); } list = syspBll.GetModelInTitle("'关于本站','产品服务','常见问题'"); } if (list != null) { Model.SystemProfile model = list.Find(delegate(Model.SystemProfile m) { return(m.Title == title); }); if (model != null) { ltr.Text = HttpUtility.UrlDecode(model.ContentText); } } } }
/// <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.SystemProfile(); } string[] itemsAppendArr = itemsAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List <string> list = new List <string>(); foreach (string item in itemsAppendArr) { list.Add(item); } if (list.Count > 0) { if (bll.DeleteBatch(list)) { WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功"); GetSearchItem(); Bind(); } else { WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败,请检查", "系统提示"); } } }