public User Login(string LoginName, string Password) { try { if(IsLoggedOn == true) { //mvarLoggedOnUser = new User(); IsLoggedOn = false; } Functions F = new Functions(); //Check to see if Login is valid and Fill User try { mvarLoggedOnUser = new User(); mvarLoggedOnUser = F.GetUser(LoginName,Password); if(mvarLoggedOnUser == null) { throw new ApplicationException("Invalid Login Name or Password!"); } //myConnection.Close(); } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } //Check if SystemAdmin SectionType ST = mvarLoggedOnUser.HighestAuthorityLevel; if(ST.mvarPreviousSectionTypeID == -99) { //Check to see if SystemAdmin already logged in if(OysterTimer.Enabled == false) { SystemAdminAlreadyLoggedIn = F.IsSystemAdminLoggedIn(); if(SystemAdminAlreadyLoggedIn == false) { AcquireSystemLock(); OysterTimer.Enabled = true; } } } IsLoggedOn = true; return mvarLoggedOnUser; } catch(Exception Err) { throw new Exception(Err.Message,Err.InnerException); } }