Example #1
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        private void Bind()
        {
            //获取列表查询条件项,并构建查询参数集
            GetSearchItem();

            MsSqlRoleProvider r = (MsSqlRoleProvider)Roles.Provider;
            int totalCount      = 0;

            rpData.DataSource = r.GetAllRoles(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms != null ? parms.ToArray() : null);
            rpData.DataBind();
        }
Example #2
0
        /// <summary>
        /// 批量删除数据
        /// </summary>
        private void OnDelete()
        {
            string RoleAppend = hV.Value.Trim();

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

            string[]       items = RoleAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            IList <string> list  = new List <string>();

            foreach (string item in items)
            {
                list.Add(item);
            }
            if (list.Count > 0)
            {
                try
                {
                    MsSqlRoleProvider p = (MsSqlRoleProvider)Roles.Provider;
                    if (p.DeleteBatch(list))
                    {
                        WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功!");
                        GetSearchItem();
                        Bind();
                    }
                    else
                    {
                        WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败,请检查!", "系统提醒");
                    }
                }
                catch (Exception ex)
                {
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, ex.Message, "系统异常提醒");
                }
            }
        }