private void btnIniciar_Secion_Click(object sender, EventArgs e) { CEntidad P = new CProducto() as CEntidad; if (P.Login(txtUsuario.Text, txtContraseña.Text)) { this.Hide(); string tipo = P.ValorAtributo("Tipo").ToString(); string Nombre = P.ValorAtributo("Nombre").ToString(); if (tipo == "ADMINISTRADOR") { FrmAdministrador FA = new FrmAdministrador(txtUsuario.Text, Nombre); FA.Size = new System.Drawing.Size(969, 725); FA.ShowDialog(); } else if (tipo == "VENDEDOR") { FrmVendedor FV = new FrmVendedor(txtUsuario.Text, Nombre); FV.Size = new System.Drawing.Size(969, 725); FV.ShowDialog(); } else if (tipo == "GERENTE") { FrmGerente FG = new FrmGerente(txtUsuario.Text, Nombre); FG.Size = new System.Drawing.Size(969, 725); FG.ShowDialog(); } } else { MessageBox.Show("Ingrese Datos Validos,Error en usuario o contraseña", "Error!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtContraseña.Clear(); txtContraseña.Focus(); } }
private void btnCerrarSes_Click(object sender, EventArgs e) { CEntidad P = new CProducto() as CEntidad; if ((P.VerificarSiHizoDocVenta(lblCodigo.Text) || P.VerificarSiHizoDocVentaCredito(lblCodigo.Text)) && !P.VerificarSiHizoArqueo(lblCodigo.Text)) { MessageBox.Show("No hizo arqueo de caja", "ERROR"); FrmVendedor FV = new FrmVendedor(lblCodigo.Text, lblNombre.Text); FV.Size = new System.Drawing.Size(969, 725); } else { if (!P.VerificarSiHizoDocVenta(lblCodigo.Text)) { this.Hide(); FormLogin L = new FormLogin(); L.ShowDialog(); } else { if ((P.VerificarSiHizoDocVenta(lblCodigo.Text) || P.VerificarSiHizoDocVentaCredito(lblCodigo.Text)) && P.VerificarSiHizoArqueo(lblCodigo.Text)) { this.Hide(); FormLogin L = new FormLogin(); L.ShowDialog(); } } } }