private void Logon() { if (!String.IsNullOrEmpty(txbUsuario.Text) && !String.IsNullOrEmpty(txbPsswd.Text)) { try { BaseDeDatos bd = new BaseDeDatos(); Boolean res = bd.InicioSesion(txbUsuario.Text.ToString(), txbPsswd.Text.ToString()); if (res) { FrmMenuPrincipal mp = new FrmMenuPrincipal(); mp.Show(); Hide(); } else { MessageBox.Show("Datos Incorrectos"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void Cootizar_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(txbTotal.Text) || String.IsNullOrWhiteSpace(cmbCliente.Text)) { MessageBox.Show("Agregue productos y seleccione el cliente."); } else { string info = DGVtoText(dgvData, '\t'); BaseDeDatos bd = new BaseDeDatos(); Boolean res = bd.RegistrarCotizacion(txbDetalles.Text.ToString(), Convert.ToDouble(txbTotal.Text), Convert.ToInt32(cmbCliente.SelectedValue), info); if (res) { MessageBox.Show("Se Registro Cotizacion"); PDF(); try { this.Close(); FrmMenuPrincipal _formularioabierto = Application.OpenForms.OfType <FrmMenuPrincipal>().Where(pre => pre.Name == "FrmMenuPrincipal").SingleOrDefault(); if (_formularioabierto != null) { _formularioabierto.AbrirFormulario(new FrmVentas(idcotizacion)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("No se registro la cotizacion"); } } }