示例#1
0
        protected void RefreshData(object sender, StoreReadDataEventArgs e)
        {
            int start    = e.Start;
            int pageSize = e.Limit;
            int total    = 0;

            //查询条件
            string Where = " 1=1 ";
            string Name  = Request["UserQuery"] + "";

            Name = Name.Replace("输入姓名简拼", "");
            if (!string.IsNullOrEmpty(Name))
            {
                Where += " and SysUserName like '%" + Name + "%' or (" + GetPinyinWhereString("SysUserName", Name) + ")  ";
            }

            if (e.Parameters.GetParameter("PID") != null)
            {
                var PID = e.Parameters.GetParameter("PID").Value;
                if (PID == "root")
                {
                }
                else
                {
                    Where += " and SysGroupID='" + PID + "' ";
                    SysGroupUser[] SysOUserEnt = DataHelper.GetPageList <SysGroupUser>(start, pageSize, new Order[] { new Order("CreateTime", false) }, out total, Expression.Sql(Where));
                    e.Total = total;
                    IList <SysUser> UserList = SysGroupUser.GetUsersByEnts(SysOUserEnt);
                    foreach (var item in SysOUserEnt)
                    {
                        var ent = UserList.Where(ten => ten.ID == item.SysUserID).First();
                        if (ent != null)
                        {
                            UserList.Add(ent);
                        }
                    }
                    UserStore.Data = UserList;
                    UserStore.DataBind();
                    return;
                }
            }
            //默认情况
            SysUser[] Arr = DataHelper.GetPageList <SysUser>(start, pageSize, new Order[] { new Order("CreateTime", false) }, out total, Expression.Sql(Where));
            e.Total        = total;
            UserStore.Data = Arr;
            UserStore.DataBind();
        }