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 OpenForm(string sql, string type) { SqlDataReader sqlData = YRHelper.GetDataReader(sql); if (sqlData.HasRows) { switch (type) { case "student": FrmStudent stu = new FrmStudent(txtAccount.Text); stu.Show(); this.Hide(); break; case "teacher": FrmTeacher tea = new FrmTeacher(txtAccount.Text); tea.Show(); this.Hide(); break; case "admin": FrmAdmin admin = new FrmAdmin(txtAccount.Text); admin.Show(); this.Hide(); break; } } else { MessageBox.Show("登录失败,请检查账号或密码!"); } sqlData.Close(); }
private void mnuAdmin_Click(object sender, EventArgs e) { FrmAdmin frmAdmin = new FrmAdmin(); this.Hide(); frmAdmin.ShowDialog(); this.Show(); }
public void pregledKorisnika_Click(object sender, EventArgs e) { FrmAdmin tempFrm = new FrmAdmin(); tempFrm.korisnik = Korisnik; tempFrm.Show(); ZatvoriTrenutnu(); }
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; } } }
private void adminToolStripMenuItem_Click(object sender, EventArgs e) { FrmAdmin form = new FrmAdmin(); form.CondicaoAtualizar = false; form.CondicaoDeletar = false; form.CondicaoDetalhes = false; form.modelo = new Admin(); form.MdiParent = this; form.Show(); }
public static void OpenFormsForUsers(this UserModel u) { if (u.Calisan.Pozisyonu == (int)Common.calisanPozisyonu.admin) { FrmAdmin fa = new FrmAdmin(u); fa.Show(); } else { FrmGarson fg = new FrmGarson(u); fg.Show(); } }
public static void OpenFormsForUsers(UserModel um) { if (um.Calisan.Pozisyonu == 1) { FrmAdmin fa = new FrmAdmin(um); fa.Show(); } else { FrmGarson fg = new FrmGarson(um); fg.Show(); } }
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 Btlogin_Click(object sender, EventArgs e) { if (Txtusuario.Text == string.Empty || Txtpassword.Text == string.Empty) { MessageBox.Show("!Faltan algunos datos, estos seran remarcados¡", "Sistema Academico Gestion De Notas", MessageBoxButtons.OK, MessageBoxIcon.Error); errorIcono.SetError(Txtusuario, "Por Favor Ingrese Usuario"); errorIcono.SetError(Txtpassword, "Por Favor Ingrese Contraseña"); } else { if (p.Login(Txtusuario.Text, Txtpassword.Text).Equals("Administrador")) { MessageBox.Show("Bienvenido", "Sistema Academico Gestion De Notas", MessageBoxButtons.OK, MessageBoxIcon.Information); FrmAdmin admin = new FrmAdmin(); admin.Show(); this.Hide(); } else if (p.Login(Txtusuario.Text, Txtpassword.Text).Equals("Estudiante")) { MessageBox.Show("Bienvenido", "Sistema Academico Gestion De Notas", MessageBoxButtons.OK, MessageBoxIcon.Information); FrmEstudiante estudiante = new FrmEstudiante(); estudiante.Show(); this.Hide(); } else if (p.Login(Txtusuario.Text, Txtpassword.Text).Equals("Docente")) { MessageBox.Show("Bienvenido", "Sistema Academico Gestion De Notas", MessageBoxButtons.OK, MessageBoxIcon.Information); FrmDocente docente = new FrmDocente(); docente.Show(); this.Hide(); } else { MessageBox.Show("Datos Erroneo, Verifique..!", "Sistema Academico Gestion Notas", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } }
private void BtnLogin_Click(object sender, EventArgs e) { Trabajador account = repTrabajador.Authentication(TxtUsuario.Text, MTxtPassword.Text); if (account != null) { if (account.ID_Admin != null) { FrmAdmin frmadmin = new FrmAdmin(); frmadmin.Show(); frmadmin.FrmAdmin_Load(sender, e, account); } //else if (account.ID_Supervisor != null) //{ // FrmStock frmStock = new FrmStock(); // frmStock.Show(); // frmStock.FrmStock_Load(sender, e, account); //} } else { MessageBox.Show("Usuario o contraseña incorrecta. \nIntente de nuevo"); } }
private void aDMINToolStripMenuItem_Click_1(object sender, EventArgs e) { FrmAdmin frmad = new FrmAdmin(); frmad.ShowDialog(); }
private void btnSupplier_Click(object sender, EventArgs e) { FrmAdmin frm = new FrmAdmin(); OpenChildForm(frm, sender); }