Ejemplo n.º 1
0
        public bool Update()
        {
            foreach (UserRole rl in new UserRole().GetUserRoles(UserName))
            {
                rl.Delete();
            }

            foreach (UserPrivilege upr in new UserPrivilege().GetUserPrivileges(UserName))
            {
                upr.Delete();
            }

            //
            foreach (Role rl in lstRole)
            {
                UserRole oUserRole = new UserRole(UserName, rl.RoleID);
                oUserRole.Save();
            }
            foreach (Privilege pr in lstPrivilege)
            {
                UserPrivilege oUserPrivilege = new UserPrivilege(UserName, pr.PrivilegeID);
                oUserPrivilege.Save();
            }
            return(new Data.User().Update(UserName, FullName, Position, Password));
        }
Ejemplo n.º 2
0
 public bool Save()
 {
     foreach (Role rl in lstRole)
     {
         UserRole oUserRole = new UserRole(UserName, rl.RoleID);
         oUserRole.Save();
     }
     foreach (Privilege pr in lstPrivilege)
     {
         UserPrivilege oUserPrivilege = new UserPrivilege(UserName, pr.PrivilegeID);
         oUserPrivilege.Save();
     }
     return(new Data.User().Save(UserName, FullName, Position, Password));
 }
        public UserPrivilege[] GetUserRoles()
        {
            List <UserPrivilege> lstUserPrivilege = new List <UserPrivilege>(0);
            DataTable            dt = new Data.UserPrivilege().GetUserPrivileges();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    UserPrivilege oUserPrivilege = new UserPrivilege();
                    oUserPrivilege.UserName    = string.Empty + dr["ME06_USERNAME"].ToString();
                    oUserPrivilege.PrivilegeID = string.Empty + dr["ME06_PRIVILEGEID"].ToString();

                    if (!lstUserPrivilege.Contains(oUserPrivilege))
                    {
                        lstUserPrivilege.Add(oUserPrivilege);
                    }
                }
            }
            return(lstUserPrivilege.ToArray());
        }