private void ContenedorPrincipal_FormClosed(object sender, FormClosedEventArgs e) { VentanaAdmin VAD = new VentanaAdmin(); this.Hide(); VAD.Show(); }
private void Button1_Click(object sender, EventArgs e) { if (MessageBox.Show("Desea cancelar? ", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { VentanaAdmin admin = new VentanaAdmin(); this.Hide(); admin.Show(); } }
private void Iniciar_Click(object sender, EventArgs e) { try { string CMD = string.Format("Select * FROM tblEmpleado WHERE username='******' AND password='******'", textBox1.Text.Trim(), textBox2.Text.Trim()); DataSet ds = Class1.Ejecutar(CMD); Codigo = ds.Tables[0].Rows[0]["idEmpleado"].ToString().Trim(); string cuenta = ds.Tables[0].Rows[0]["username"].ToString().Trim(); string contra = ds.Tables[0].Rows[0]["password"].ToString().Trim(); if (cuenta == textBox1.Text.Trim() && contra == textBox2.Text.Trim()) { if(Convert.ToBoolean(ds.Tables[0].Rows[0]["statusAdmin"])== true) { VentanaAdmin venAd = new VentanaAdmin(); this.Hide(); venAd.Show(); } else { VentanaUser venUs = new VentanaUser(); this.Hide(); venUs.Show(); } } } catch (Exception) { MessageBox.Show("Usuario y/o contraseƱa incorrecta"); } }