Exemple #1
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void DisplayData()
 {
     try
     {
         URBasicInfoService biService = new URBasicInfoService();
         //特定用户类型要限定特定角色
         List <Role> rangeRoles = biService.GetRoles(SelectedSysID);
         User        user       = biService.GetUser(UserID);
         if (user.AccountType == UserTypeOptions.Channel)
         {
             rangeRoles = rangeRoles.Where(a => a.RoleType == RoleTypeOptions.Channel).ToList();
         }
         else if (user.AccountType == UserTypeOptions.ChannelPartner)
         {
             rangeRoles = rangeRoles.Where(a => a.RoleType == RoleTypeOptions.ChannelPartner).ToList();
         }
         cbkListrole.DataSource     = rangeRoles;
         cbkListrole.DataTextField  = "Name";
         cbkListrole.DataValueField = "ID";
         cbkListrole.DataBind();
         List <int> selectedRoleIds = new URRightsService().GetUserRoles(SelectedSysID, UserID);
         foreach (ListItem item in cbkListrole.Items)
         {
             if (selectedRoleIds.Exists(a => int.Parse(item.Value) == a))
             {
                 item.Selected = true;
             }
         }
     }
     catch (NotRightException)
     {
         AlertBack("您没有权限执行此操作");
     }
 }
        private void BindData()
        {
            URBasicInfoService biService = new URBasicInfoService();
            int         pageIndex        = string.IsNullOrEmpty(Request["page"]) ? 1 : Convert.ToInt32(Request["page"]);
            int         pageSize         = string.IsNullOrEmpty(Request["pagesize"]) ? 15 : Convert.ToInt32(Request["pagesize"]);
            int         count            = 0;
            List <Role> list             = biService.GetRoles(SelectedSysID, pageIndex, pageSize, ref count);

            repeaData.DataSource = list;
            repeaData.DataBind();
            AspNetPager1.RecordCount      = count;
            AspNetPager1.PageSize         = pageSize;
            AspNetPager1.CurrentPageIndex = pageIndex;
        }