private void BtnInsertar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (TxtNombre.Text == string.Empty) { this.MensajeError("Falta ingresar algunos datos, serán remarcados."); ErroIcono.SetError(TxtNombre, "Ingrese un nombre."); } else { Rpta = NCategoria.Insertar(TxtNombre.Text.Trim(), TxtDescripcion.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOk("Se insertó de forma correcta el registro"); this.Limpiar(); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (TxtId.Text == string.Empty || CboCategoria.Text == string.Empty || TxtNombre.Text == string.Empty || TxtPrecioVenta.Text == string.Empty || TxtStock.Text == string.Empty) { this.MensajeError("Falta ingresar algunos datos, serán remarcados."); ErroIcono.SetError(CboCategoria, "Seleccione una catageoría."); ErroIcono.SetError(TxtNombre, "Ingrese un nombre."); ErroIcono.SetError(TxtPrecioVenta, "Ingrese un Precio de Venta."); ErroIcono.SetError(TxtStock, "Ingrese un Stock."); } else { Rpta = NArticulo.Actualizar( Convert.ToInt32(TxtId.Text), Convert.ToInt32(CboCategoria.SelectedValue), txtCodigo.Text.Trim(), this.NombreAnt, TxtNombre.Text.Trim(), Convert.ToDecimal(TxtPrecioVenta.Text), Convert.ToInt32(TxtStock.Text), TxtDescripcion.Text.Trim(), TxtImagen.Text.Trim()); if (Rpta.Equals("OK")) { this.MensajeOk("Se actualizó de forma correcta el registro"); if (TxtImagen.Text != string.Empty && this.RutaOrigen != string.Empty) { this.RutaDestino = this.Directorio + TxtImagen.Text; File.Copy(this.RutaOrigen, this.RutaDestino); } this.Listar(); tabGeneral.SelectedIndex = 0; } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnInsertar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (TxtIdCliente.Text == string.Empty || TxtImpuesto.Text == string.Empty || txtNumComprobante.Text == string.Empty || DtDetalle.Rows.Count == 0) { this.MensajeError("Falta ingresar algunos datos, serán remarcados."); ErroIcono.SetError(TxtIdCliente, "Seleccione un cliente."); ErroIcono.SetError(TxtImpuesto, "Ingrese un impuesto."); ErroIcono.SetError(txtNumComprobante, "Ingrese el número del comprobante."); ErroIcono.SetError(DgvDetalle, "Debe tener al menos un detalle."); } else { Rpta = NVenta.Insertar( Convert.ToInt32(TxtIdCliente.Text), Variables.IdUsuario, CboComprobante.Text, txtSerieComprobante.Text.Trim(), txtNumComprobante.Text.Trim(), Convert.ToDecimal(TxtImpuesto.Text), Convert.ToDecimal(TxtTotal.Text), DtDetalle ); if (Rpta.Equals("OK")) { this.MensajeOk("Se insertó de forma correcta el registro"); this.Limpiar(); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void BtnActualizar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (TxtId.Text == string.Empty || CboRol.Text == string.Empty || TxtNombre.Text == string.Empty || TxtEmail.Text == string.Empty) { this.MensajeError("Falta ingresar algunos datos, serán remarcados."); ErroIcono.SetError(CboRol, "Seleccione un Rol."); ErroIcono.SetError(TxtNombre, "Ingrese un nombre."); ErroIcono.SetError(TxtEmail, "Ingrese un Email valido."); } else { Rpta = NUsuario.Actualizar( Convert.ToInt32(TxtId.Text), Convert.ToInt32(CboRol.SelectedValue), TxtNombre.Text.Trim(), CboTipoDocumento.Text, TxtNumDocumento.Text.Trim(), TxtDireccion.Text.Trim(), TxtTelefono.Text.Trim(), this.EmailAnt, TxtEmail.Text.Trim(), TxtClave.Text.Trim() ); if (Rpta.Equals("OK")) { this.MensajeOk("Se actualizó de forma correcta el registro"); this.Listar(); } else { this.MensajeError(Rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }