private void btnGuardar_Click(object sender, EventArgs e) { if (this.txtUbicacion.Text == "" || this.cmbTipo.SelectedIndex == -1) { MessageBox.Show("Campos Faltantes o Datos Erróneos", "Error al Guardar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { NVentanilla oVneg = new NVentanilla(); string ubicacion = this.txtUbicacion.Text.ToUpper(); string tipo = this.cmbTipo.SelectedItem.ToString(); string rpta = oVneg.insertarVentanilla(ubicacion, tipo); if (rpta.Equals("OK")) { MessageBox.Show("Ventanilla Registrada", "Guardar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(rpta, "Error al Guardar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.limpiar(); this.inicial(); } }
private void btnModificar_Click(object sender, EventArgs e) { if (existe) { if (this.txtNumero.Text == "" || this.txtUbicacion.Text == "" || this.cmbTipo.SelectedIndex == -1) { MessageBox.Show("Campos Faltantes o Datos Erróneos", "Error al Modficiar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { NVentanilla oVneg = new NVentanilla(); int numero = Convert.ToInt32(this.txtNumero.Text); string ubicacion = this.txtUbicacion.Text.ToUpper(); string tipo = this.cmbTipo.SelectedItem.ToString(); string rpta = oVneg.actualizarVentanilla(numero, ubicacion, tipo); if (rpta.Equals("OK")) { MessageBox.Show("Ventanilla Modificada", "Modificar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(rpta, "Error al Modificar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); } limpiar(); inicial(); } } }
public void TestMethod1() { var c = new NVentanilla(); string ubicacion = "A17"; string tipo = "VIP"; var exp = c.insertarVentanilla(ubicacion, tipo); Assert.AreEqual(exp, c.insertarVentanilla("A17", "VIP")); }
private void btnBuscar_Click(object sender, EventArgs e) { if (this.txtNumero.Text == "") { MessageBox.Show("Ingrese un Número", "Buscar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); limpiar(); inicial(); } else { int codigo = Convert.ToInt32(this.txtNumero.Text); DataTable dt = new NVentanilla().buscarVentanilla_Codigo(codigo); this.existe = false; foreach (DataRow row in dt.Rows) { this.txtNumero.Text = row["NumeroVentanilla"].ToString(); this.txtUbicacion.Text = row["Ubicacion"].ToString(); this.cmbTipo.SelectedItem = row["TipoAtencion"].ToString(); existe = true; break; } if (existe) { this.txtNumero.Enabled = false; this.txtUbicacion.Enabled = true; this.cmbTipo.Enabled = true; this.btnBuscar.Enabled = false; this.btnGuardar.Enabled = false; this.btnEliminar.Enabled = true; this.btnModificar.Enabled = true; this.btnInsertar.Enabled = false; } else { MessageBox.Show("No existe una Ventanilla con ese códgio", "Buscar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); limpiar(); inicial(); } } }
private void btnEliminar_Click(object sender, EventArgs e) { if (existe) { NVentanilla oVneg = new NVentanilla(); int numero = Convert.ToInt32(this.txtNumero.Text); string rpta = oVneg.eliminarVentanilla(numero); if (rpta.Equals("OK")) { MessageBox.Show("Ventanilla Eliminada", "Eliminar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(rpta, "Error al Eliminar Ventanilla", MessageBoxButtons.OK, MessageBoxIcon.Error); } limpiar(); inicial(); } }
private void frmReporteVentanilla_Load(object sender, EventArgs e) { NVentanilla Ven = new NVentanilla(); this.dgvVentanilla.DataSource = Ven.buscarVentanilla_All(); }