示例#1
0
        void PopulateAuthorList()
        {
            _authorList.Items.Clear();
            AWAPI_BusinessLibrary.library.UserLibrary userLib = new AWAPI_BusinessLibrary.library.UserLibrary();
            System.Collections.Generic.IList <AWAPI_Data.CustomEntities.UserExtended> list
                = userLib.GetList(App_Code.SessionInfo.CurrentSite.siteId, "", "");

            var tmp = from l in list
                      orderby l.firstName, l.lastName
            select l;

            foreach (AWAPI_Data.CustomEntities.UserExtended usr in tmp)
            {
                ListItem li = new ListItem();
                li.Text  = usr.firstName + " " + usr.lastName + " - " + usr.username + " ";
                li.Value = usr.userId.ToString();
                if (usr.userId == App_Code.SessionInfo.CurrentUser.userId)
                {
                    li.Selected = true;
                }

                _authorList.Items.Add(li);
            }
            _authorList.Items.Insert(0, new ListItem("- Please select the author", ""));
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userNameOrEmail"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static AWAPI_Data.CustomEntities.UserExtended ValidateUser(string userNameOrEmail, string password)
        {
            AWAPI_BusinessLibrary.library.UserLibrary usr  = new AWAPI_BusinessLibrary.library.UserLibrary();
            AWAPI_Data.CustomEntities.UserExtended    user = usr.Login(userNameOrEmail, password);

            return(user);
        }
 void PopulateUser()
 {
     if (UserId > 0)
     {
         AWAPI_Data.CustomEntities.UserExtended usr = new AWAPI_BusinessLibrary.library.UserLibrary().Get(UserId);
         if (usr != null)
         {
             _pageTitle.Text = "User Roles - " + usr.username;
         }
     }
 }
示例#4
0
        /// <summary>
        /// Fills the session objects based on the userId and the siteId
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="siteId"></param>
        public static bool FillSession(long userId, long siteId)
        {
            CurrentUser      = null;
            CurrentSite      = null;
            CurrentUserRoles = null;

            if (userId > 0)
            {
                CurrentUser = new AWAPI_BusinessLibrary.library.UserLibrary().Get(userId);
                if (siteId > 0)
                {
                    CurrentSite      = new AWAPI_BusinessLibrary.library.SiteLibrary().Get(siteId);
                    CurrentUserRoles = new AWAPI_BusinessLibrary.library.RoleLibrary().GetUserRoleList(userId, siteId);
                }
            }

            //if the current user is null, then the form authnentication cookie will be deleted...
            if (CurrentUser == null)
            {
                return(false);
            }
            return(true);
        }
示例#5
0
 void PopulateUserList()
 {
     _userList.Items.Clear();
     System.Collections.Generic.IList <AWAPI_Data.CustomEntities.UserExtended> list = new AWAPI_BusinessLibrary.library.UserLibrary().
                                                                                      GetList(App_Code.SessionInfo.CurrentSite.siteId, "isEnabled=1", "firstname, lastname");
     if (list == null)
     {
         return;
     }
     foreach (AWAPI_Data.CustomEntities.UserExtended usr in list)
     {
         if (usr.userId != App_Code.SessionInfo.CurrentUser.userId)
         {
             _userList.Items.Add(new ListItem(usr.firstName + " " + usr.lastName + " - " + usr.email,
                                              usr.userId.ToString()));
         }
     }
 }