Beispiel #1
0
        private bool DoLogin(string userName, string password)
        {
            try
            {
                Users currentUser = manager.GetUserByNameAndPassword(userName, password);
                if (currentUser.UserCode == null)
                {
                    return(false);
                }
                else
                {
                    UserSession _uSession = new STATIC.User();

                    _uSession.IsAdmin      = Convert.ToBoolean(currentUser.IsAdmin);
                    _uSession.IsLoggedIn   = true;
                    _uSession.UserCode     = currentUser.UserCode;
                    _uSession.UserName     = currentUser.UserName;
                    _uSession.PersonName   = currentUser.Name;
                    _uSession.Password     = currentUser.Password;
                    _uSession.EmployeeCode = currentUser.EmpCode;
                    _uSession.EmpName      = currentUser.EmpName;
                    _uSession.Company      = currentUser.Company;
                    _uSession.Department   = currentUser.Department;
                    _uSession.EmpType      = currentUser.EmpType;
                    _uSession.Grade        = currentUser.Grade;
                    _uSession.Designation  = currentUser.Designation;
                    _uSession.EmpKey       = currentUser.EmpKey;

                    ProfileManager           manager_profile = new ProfileManager();
                    CustomList <UserProfile> UserProfileList = new CustomList <UserProfile>();
                    UserProfileList = new CustomList <UserProfile>();

                    if (UserProfileList.Count != 0)
                    {
                        _uSession.DefaultApplicationID = UserProfileList[0].DefaultAppID;
                        _uSession.DefaultTheme         = UserProfileList[0].ThemeName;
                    }
                    else
                    {
                        _uSession.DefaultTheme = "Default";
                    }

                    _uSession.CurrentApplicationID = _uSession.DefaultApplicationID;

                    ((PageBase)Page).CurrentUserSession = _uSession;
                    ((PageBase)Page).OpenPages          = new System.Collections.Generic.List <string>();

                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
Beispiel #2
0
        private bool DoLogin(string userName, string password)
        {
            try
            {
                Users currentUser = manager.GetUserByNameAndPassword(userName, password);
                if (currentUser.UserCode == null)
                    return false;
                else
                {
                    UserSession _uSession = new STATIC.User();

                    _uSession.IsAdmin = Convert.ToBoolean(currentUser.IsAdmin);
                    _uSession.IsLoggedIn = true;
                    _uSession.UserCode = currentUser.UserCode;
                    _uSession.UserName = currentUser.UserName;
                    _uSession.PersonName = currentUser.Name;
                    _uSession.Password = currentUser.Password;
                    _uSession.EmployeeCode = currentUser.EmpCode;
                    _uSession.EmpName = currentUser.EmpName;
                    _uSession.Company = currentUser.Company;
                    _uSession.Department = currentUser.Department;
                    _uSession.EmpType = currentUser.EmpType;
                    _uSession.Grade = currentUser.Grade;
                    _uSession.Designation = currentUser.Designation;
                    _uSession.EmpKey = currentUser.EmpKey;

                    ProfileManager manager_profile = new ProfileManager();
                    CustomList<UserProfile> UserProfileList = new CustomList<UserProfile>();
                    UserProfileList = new CustomList<UserProfile>();

                    if (UserProfileList.Count != 0)
                    {
                        _uSession.DefaultApplicationID = UserProfileList[0].DefaultAppID;
                        _uSession.DefaultTheme = UserProfileList[0].ThemeName;
                    }
                    else
                    {
                        _uSession.DefaultTheme = "Default";
                    }

                    _uSession.CurrentApplicationID = _uSession.DefaultApplicationID;

                    ((PageBase)Page).CurrentUserSession = _uSession;
                    ((PageBase)Page).OpenPages = new System.Collections.Generic.List<string>();

                    return true;
                }
            }
            catch (Exception ex)
            { throw ex; }
        }