private void GuardarServicio() { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtPrecio.Text == string.Empty) { MensajeError("Por favor llene todos los campos con informacion valida"); errorIcono.SetError(txtNombre, "Ingrese un nombre valido"); errorIcono.SetError(txtPrecio, "Ingrese un Numero valido"); } else { rpta = NServicios.Insertar(txtNombre.Text, txtObservaciones.Text, Convert.ToDouble(txtPrecio.Text)); Close(); } if (rpta.Equals("OK")) { this.MensajeOk("Se agrego el Servicio correctamente"); } else { this.MensajeError("Vuelva a intentarlo"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void button2_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("Esta seguro de eliminar el Hotel", "Sistema de reservaciones", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; String Rpta = ""; foreach (DataGridViewRow row in dataListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(row.Cells[1].Value); Rpta = NServicios.Eliminar(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOk("Se Elimino el Servicio Correctamente"); } else { this.MensajeError("No se Elimino el registro"); } } } this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtCosto.Text == string.Empty) { mensajeError("falta ingresar algunos datos"); errorIcono.SetError(txtNombre, "ingrese un datos"); errorIcono.SetError(txtCosto, "ingrese un valor"); } else { if (this.Nuevo) { rpta = NServicios.Insertar(this.txtNombre.Text.ToUpper(), Convert.ToDecimal(this.txtCosto.Text)); } else { rpta = NServicios.Editar(Convert.ToInt32(txtSer_id.Text), this.txtNombre.Text.ToUpper(), Convert.ToDecimal(this.txtCosto.Text)); } if (rpta.Equals("OK")) { if (this.Nuevo) { this.mensajeOk("se registro El Servicio"); } else { this.mensajeOk("se actualizaron los datos del Servicio"); } } else { this.mensajeError(rpta); } this.Nuevo = false; this.Editar = false; this.Botones(); this.limpiar(); this.mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("Desea Eliminar El Servicio De La Base de Datos", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string llave; string eliminar = ""; foreach (DataGridViewRow row in dgServicios.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { llave = Convert.ToString(row.Cells[1].Value); eliminar = NServicios.Eliminar(Convert.ToInt32(llave)); if (eliminar.Equals("OK")) { this.mensajeOk(" SE ELIMINO EL REGISTRO"); } else { this.mensajeError(eliminar); } } } this.mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BuscarServicio() { this.dgServicios.DataSource = NServicios.BuscarServicio(this.txtBuscar.Text); //this.OcultarColumnas(); lblTotalServicios.Text = "Total de registros: " + Convert.ToString(dgServicios.Rows.Count); }
/*private void OcultarColumnas() * { * this.dgServicios.Columns[0].Visible = false; * this.dgServicios.Columns[1].Visible = false; * * }*/ private void mostrar() { this.dgServicios.DataSource = NServicios.Mostrar(); //this.OcultarColumnas(); lblTotalServicios.Text = "Total de registros: " + Convert.ToString(dgServicios.Rows.Count); }
private void BuscarNombre() { dataListado.DataSource = NServicios.Buscar(txtNombre.Text); }
private void Mostrar() { dataListado.DataSource = NServicios.Mostrar(); }