public void RouteUser(string username, string password) { Form frm; User usr = SearchForUser(username); if (usr != null && Hashing.ValidatePassword(password, usr.password)) { switch (usr.user_type_id) { case 1: frm = new FrmUser(usr); frm.ShowDialog(); break; case 2: frm = new FrmSupervisor(usr); frm.ShowDialog(); break; case 3: frm = new FrmAdmin(usr); frm.ShowDialog(); break; } } else { string title = "Advertencia"; string message = "Contraseña incorrecta o nombre de usuario incorrecto"; Dialogs.OkDialog(title, message); } }
private void mnuAdmin_Click(object sender, EventArgs e) { FrmAdmin frmAdmin = new FrmAdmin(); this.Hide(); frmAdmin.ShowDialog(); this.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { if (txtUsername.Text == String.Empty) { lblMessage.Text = "Kullanıcı adı boş geçilemez."; txtUsername.Focus(); return; } else if (txtPassword.Text == String.Empty) { lblMessage.Text = "Şifre boş geçilemez."; txtPassword.Focus(); return; } using (IUserRepository userRepo = new UserRepository(new BeamDeflectionDbContext())) { var result = userRepo.Login(txtUsername.Text, txtPassword.Text); switch (result.State) { case Basecore.Model.Enums.BusinessResultType.NotSet: lblMessage.Text = result.Message; break; case Basecore.Model.Enums.BusinessResultType.Success: if (result.Result.Username == "admin" && result.Result.IsActive == true) { result.Result.LastLogin = DateTime.UtcNow; FrmAdmin frm = new FrmAdmin(result.Result); frm.ShowDialog(); this.Hide(); } else { result.Result.LastLogin = DateTime.UtcNow; FrmCalculation frm = new FrmCalculation(result.Result); frm.Show(); this.Hide(); } break; case Basecore.Model.Enums.BusinessResultType.Error: lblMessage.Text = result.Message; break; case Basecore.Model.Enums.BusinessResultType.Warning: lblMessage.Text = result.Message; break; case Basecore.Model.Enums.BusinessResultType.Info: lblMessage.Text = result.Message; break; default: break; } } }
public void SignIn(object sender, EventArgs e) { Member member = new Member(); if (!IsEmpty(txtUsername.Text)) { member.Username = txtUsername.Text; } if (!InvalidInt(txtPIN.Text)) { member.PIN = Convert.ToInt32(txtPIN.Text); } if (MemberDB.IsMember(member)) { if (MemberDB.LogIn(member)) { Member dbMember = CurrentMember.GetCurrentMember(); if (chkAdmin2.Checked is true && dbMember.IsAdmin is true) { this.Hide(); FrmAdmin addAdminForm = new FrmAdmin(); addAdminForm.ShowDialog(); this.Close(); } else { this.Hide(); FrmLibrary addLibraryForm = new FrmLibrary(); addLibraryForm.ShowDialog(); this.Close(); } } else { MessageBox.Show("PIN incorrect. Try again."); } }
private void lblNatrag_Click(object sender, EventArgs e) { korisnikZanimanje = baza.Instanca.dohvatiBroj("SELECT zanimanje FROM zaposlenik where id= '" + korisnikId + "' "); if (korisnikZanimanje == 1) { FrmAdmin forma = new FrmAdmin(korisnikId); this.Hide(); forma.ShowDialog(); this.Close(); } else { FrmZaposlenik forma = new FrmZaposlenik(korisnikId); this.Hide(); forma.ShowDialog(); this.Close(); } }
private void aDMINToolStripMenuItem_Click_1(object sender, EventArgs e) { FrmAdmin frmad = new FrmAdmin(); frmad.ShowDialog(); }