Exemple #1
0
 /// <summary>
 /// 获取角色
 /// </summary>
 /// <param name="user"></param>
 private void GetRoles(SysUser user)
 {
     if (user == null) return;
     var items = chkRoleID.Items;
     user.SysUser_Role.Clear();
     foreach (ListItem item in items)
     {
         if (!item.Selected) continue;
         var rp = new SysUser_Role
         {
             SysUser_RoleID = Guid.NewGuid(),
             RoleID =  new Guid(item.Value),
             UID = user.UID,
             LastUpdateTime = DateTime.Now
         };
         user.SysUser_Role.Add(rp);
     }
 }
 /// <summary>
 /// 获取数据
 /// </summary>
 private void GetDataFromPage(Role role)
 {
     if (role == null) return;
     var dataSouce = (IList<SysUser>) Session["lvwUserSource"];
     role.SysUser_Role.Clear();
     if (dataSouce == null || dataSouce.Count == 0)
     {
         return;
     }
     foreach (var item in dataSouce)
     {
         var rp = new SysUser_Role
                      {
                          SysUser_RoleID = Guid.NewGuid(),
                          RoleID = role.RoleID,
                          UID = item.UID
                      };
         role.SysUser_Role.Add(rp);
     }
 }