private void BtnLogin_Click(object sender, EventArgs e) { try { var userLogin = new UserLogin { Username = txtUsername.Text, Password = txtPassword.Text }; var result = _userBUS.Login(userLogin); if (result) { this.Hide(); DashboardForm dashboard = new DashboardForm(); dashboard.FormClosed += (s, args) => this.Close(); dashboard.Show(); } else { lblLoginMessage.Text = string.Format("Invalid Username or Password!"); } } catch (Exception ex) { MessageBox.Show("Some error occur: {0}", ex.Message); } }
public static void RunDashboardForm(MainForm form, int userId) { form.Hide(); DashboardForm dashboardForm = new DashboardForm(userId); dashboardForm.Closed += (s, args) => form.Close(); dashboardForm.Show(); }
private void showDashboard() { this.Invoke( (Action)(() => { UniteEDTeacher.Properties.Settings.Default.activated = true; UniteEDTeacher.Properties.Settings.Default.Save(); DashboardForm dashboardPage = new DashboardForm(); dashboardPage.Show(); } )); }
public void ShowDashboard() { var dashboardForm = Program.FindOpenForm <DashboardForm>(); if (dashboardForm != null) { dashboardForm.Activate(); } else { dashboardForm = new DashboardForm(this); dashboardForm.Show(dockPanel, DockState.Document); } }
private void LoginButton_Click(object sender, EventArgs e) { if (IsValid()) { //MessageBox.Show(conString); using (SqlConnection con = new SqlConnection(conString)) { /* * create PROCEDURE usp_login_VerificationDetails * ( * @UserName NVARCHAR(50), * @Password NVARCHAR(50) * ) * * As * Begin * Select '#' from [dbo].[LoginUser] * Where [userName] = @UserName * and [Password] = @Password * * End */ using (SqlCommand cmd = new SqlCommand("usp_login_VerificationDetails", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@userName", UserNameTextBox.Text.Trim()); cmd.Parameters.AddWithValue("@Password", PasswordTextBox.Text.Trim()); con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.Read()) { //MessageBox.Show("Welcome"); this.Hide(); DashboardForm dbf = new DashboardForm(); dbf.Show(); } else { //Change when done this.Hide(); DashboardForm dbf = new DashboardForm(); dbf.Show(); //MessageBox.Show("UserName or Password is Incorrect", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
//MAIN MENU private void ShowDashboardBtn_Click(object sender, EventArgs e) { foreach (Form frm in this.MdiChildren) { frm.Close(); } DashboardForm form = new DashboardForm { MdiParent = this, Dock = DockStyle.Fill }; form.Show(); Slider.Top = ShowDashboardBtn.Top; Slider.Height = ShowDashboardBtn.Height; }
//This method activates once you click on the LOGIN BUTTON and takes you to the DASHBOARD FORM private void Login(object sender, EventArgs e) { GlobalConfig.ClickEvents.LoginClicks(sender, e, txtUsername, txtPassword, btnLogin, forgotLabel, out string result); switch (result) { case "Success": if (rememberMeCb.Checked == true) { using (SqlConnection conn = new SqlConnection(GlobalConfig.ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("RememberMe", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Username", txtUsername.Text); cmd.Parameters.AddWithValue("@Password", txtPassword.Text); cmd.Parameters.AddWithValue("@Checked", 1); } } } //Hides the current Form this.Hide(); // Creating a DashboardForm Object (This is another FORM we created) var newDashboardForm = new DashboardForm(txtUsername.Text); // Clear the login FORMS information so that no data from that form comes through on this one GlobalConfig.ClearEvents.LoginForm(txtUsername, txtPassword); // Shows the form object we just created newDashboardForm.Show(); // When you click on Login Button it takes you to the Next Form - (Dashboard Form) newDashboardForm.FormClosing += (s, EventArgs) => this.Show(); break; case "Username or Password is Incorrect": MessageBox.Show(GlobalConfig.CheckQueries.Result); GlobalConfig.ClearEvents.LoginForm(txtUsername, txtPassword); break; case "User Does Not Exist": MessageBox.Show(GlobalConfig.CheckQueries.Result); GlobalConfig.ClearEvents.LoginForm(txtUsername, txtPassword); break; default: break; } }
private void btnLogin_Click(object sender, EventArgs e) { string username = tbUsername.Text; string password = tbPassword.Text; // check credentials if (username == "user" && password == "pass") { DashboardForm dashboardForm = new DashboardForm(); dashboardForm.Show(); } else { MessageBox.Show("Error: credentials not valid"); } }
private void SignInButton_Click(object sender, EventArgs e) { int userId = _userAuthenticator.AuthenticateUser(usernameTextBox.Text.Trim(), Int32.Parse(passwordTextBox.Text.Trim())); if (userId != 0) { this.Hide(); DashboardForm dashboardForm = new DashboardForm(userId); dashboardForm.Closed += (s, args) => this.Close(); dashboardForm.Show(); } else { this.infoLabel.Text = "Wrong username or password!"; } }
private void BtnLogin_Click(object sender, EventArgs e) { // forms validation / credential validation traitement if (IsValid()) { /*tring connstring = ApplicationSettings.connectionString(); * MessageBox.Show(connstring , "chaine de connection");*/ using (SqlConnection con = new SqlConnection(ApplicationSettings.connectionString())) { using (SqlCommand cmd = new SqlCommand("usp_Login_VerifyLoginDetails", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Username", usenameTbx.Text.Trim()); cmd.Parameters.AddWithValue("@Password", usenameTbx.Text.Trim()); con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.Read()) { //TODO traitement intent forexemple // fermer le login form puis lancer le dashboard form this.Hide(); DashboardForm dashboard = new DashboardForm(); dashboard.Show(); } else { MetroFramework.MetroMessageBox.Show(this, "Nom d'utilisateur ou mot de pass invalide", "Wrong credential", MessageBoxButtons.OK, MessageBoxIcon.Error); //MessageBox.Show("Nom d'utilisateur ou mot de pass invalide", "Wrong credential", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
private void btnLogin_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Data Source=CCI-LPT-06\\MSSQLSERVER2K14E;Initial Catalog=employeeform;User ID=sa;Password=sa123456#"; SqlCommand cmd = new SqlCommand("Insert into login (name, designation) values ('" + txtName.Text + "','" + txtDesignation.Text + "')", conn); try { conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Connection Open ! "); conn.Close(); } catch (Exception ex) { MessageBox.Show("Cannot open connection ! " + ex.Message); } DashboardForm dashform = new DashboardForm(LoggedInEmployee); this.Hide(); dashform.Show(); }
private void Entradas_FormClosing(object sender, FormClosingEventArgs e) { this.Hide(); caderneta.Show(); }
public void showDashboardForm(DashboardForm dashboardForm) { dashboardForm.Show(); }
public void showDashboardForm(PayrollForm payrollForm, DashboardForm dashboardForm) { payrollForm.Close(); dashboardForm.Show(); }