private void Button_Cancel_Click(object sender, EventArgs e) { dark1.Hide(); dark2.Hide(); dark3.Hide(); dark4.Hide(); Hide(); }
/// <summary> /// on login clicked, go to sqlUser class and attempt to find this user + make a UserObject instance of /// logged user with the details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Login_Click(object sender, EventArgs e) { SqlUser loginUser = new SqlUser(); string tempUsername = TextBox_LoginUsername.Text; string tempPassword = TextBox_LoginPassword.Text; string tempQuery = $"SELECT * from user WHERE username = '******' AND password = '******'"; DataTable db = Connection.GetDbConn().GetDataTable(tempQuery); //login.GetUser(TextBox_LoginUsername.Text, TextBox_LoginPassword.Text); if (db.Rows.Count != 0) { UserObject.loggedUser.username = db.Rows[0].ItemArray[1].ToString(); UserObject.loggedUser.iduser = db.Rows[0].ItemArray[0].ToString(); if (CheckBox_StayLoggedIn.CheckState == CheckState.Checked) { Properties.Settings.Default.StayLoggedIn = true; Properties.Settings.Default.LoggedUserId = UserObject.loggedUser.iduser; Properties.Settings.Default.LoggedUsername = UserObject.loggedUser.username; Properties.Settings.Default.Save(); } else if (CheckBox_StayLoggedIn.CheckState == CheckState.Unchecked) { Properties.Settings.Default.StayLoggedIn = false; Properties.Settings.Default.LoggedUserId = null; Properties.Settings.Default.LoggedUsername = null; Properties.Settings.Default.Save(); } Hide(); loginPanel.Hide(); loginPanelBackTop.Hide(); loginPanelBackBottom.Hide(); SplashPage1.Hide(); SplashPage2.Hide(); SplashPage3.Hide(); SplashPage4.Hide(); Window window = new Window(); window.Show(); } else { Label_LoginUsernameSeparator.BackColor = Color.FromArgb(255, 85, 85); Label_LoginPasswordSeparator.BackColor = Color.FromArgb(255, 85, 85); TextBox_LoginUsername.ForeColor = Color.FromArgb(255, 85, 85); TextBox_LoginPassword.ForeColor = Color.FromArgb(255, 85, 85); PictureBox_LoginUsername.BackgroundImage = ERROR; PictureBox_LoginPassword.BackgroundImage = ERROR; Button_Login.BackColor = Color.FromArgb(255, 85, 85); } }