void CheckLogin(object a, LoginArgs e) { //Check whether the loginDetails are comparable to the ones we have in database and give user according userAccess. //e.LoginDetails returns a String in the format "username%%password" //Currently temp code which will be replaced by a query to database Console.WriteLine( "PRIVILEDGE NOT SET"); if (e.LoginDetails.CompareTo(e.LoginDetails) == 0) { userAccess = AccessLevels.Admin; } else { userAccess = AccessLevels.None; } this.StartPosition = FormStartPosition.Manual; //Show this main form again slightly above where the Login page was (Incase it was moved) this.Location = new Point(((Form)a).Location.X, ((Form)a).Location.Y - 150); ((Form)a).Close(); //Close the Login Screen and return to whatever screen launched it. // priviledgeLabels. ShowUserPriviledges(userAccess); }
void CheckLogin(object a, LoginArgs e) { //Check whether the loginDetails are comparable to the ones we have in database and give user according userAccess. //e.LoginDetails returns a String in the format "username%%password" //Currently temp code which will be replaced by a query to database Console.WriteLine("PRIVILEDGE NOT SET"); if (e.LoginDetails.CompareTo(e.LoginDetails) == 0) { userAccess = AccessLevels.Admin; } else { userAccess = AccessLevels.None; } this.StartPosition = FormStartPosition.Manual; //Show this main form again slightly above where the Login page was (Incase it was moved) this.Location = new Point(((Form)a).Location.X, ((Form)a).Location.Y - 150); ((Form)a).Close(); //Close the Login Screen and return to whatever screen launched it. // priviledgeLabels. ShowUserPriviledges(userAccess); }
private void LoginUser() { incorrectUsernameLabel.Visible = false; incorrectPasswordLabel.Visible = false; String username = cTextUsername.Text; String pass = cTextPassword.Text; if (!checkCredentials(username, pass)) { return; } LoginArgs loginArgs = new LoginArgs(username); OnLogin(this, loginArgs); }
void setPrivilige(object a, LoginArgs e) { //Check in the database for worker's job and assign priviliges accordingly //e.LoginDetails returns a username uname = e.LoginDetails.ToString(); int priv = getJob(uname); if (priv == 0) { Program.userAccess = AccessLevels.None; } else if (priv == 10700001 || priv == 10700002) { Program.userAccess = AccessLevels.Admin; } else if (priv == 10700003) { Program.userAccess = AccessLevels.Manager; } else { Program.userAccess = AccessLevels.Regular; } Console.WriteLine(Program.userAccess.ToString()); this.StartPosition = FormStartPosition.Manual; //Show this main form again slightly above where the Login page was (In case it was moved) this.Location = new Point(((Form)a).Location.X, ((Form)a).Location.Y); ((Form)a).Close(); //Close the Login Screen and return to whatever screen launched it. // privilegeLabels. ShowUserPrivileges(Program.userAccess); }
private void LoginUser() { LoginArgs loginArgs = new LoginArgs(cTextUsername.Text + "%%" + cTextPassword.Text); OnLogin(this, loginArgs); }