private void btnEliminar_Click(object sender, EventArgs e) { try { if (this.dgvPromociones.SelectedRows.Count == 1) { Promocion Datos = this.ObtenerDatosPromocion(); Promocion_Negocio PromNeg = new Promocion_Negocio(); bool Complete = PromNeg.EliminarPromocion(Comun.Conexion, Datos.IDPromocion, Comun.IDUsuario); if (Complete) { MessageBox.Show("Registro eliminado.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); LlenarGrid(); } else { MessageBox.Show("OcurriĆ³ un error al eliminar el registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmPromociones ~ btnImpresion_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { List <Error> Errores = this.ValidarDatos(); if (Errores.Count == 0) { Promocion_Negocio PromNeg = new Promocion_Negocio(); Datos.TablaPrecios = this.ObtenerTablaPrecios(); int Resultado = PromNeg.ActualizarPreciosXIDPromocionXIDSucursal(Comun.Conexion, Datos, Comun.IDUsuario); if (Resultado == 1) { MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } else { MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { this.MostrarMensajeError(Errores); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmPromocionPreciosModificar ~ btnGuardar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LlenarGridSucursales() { try { Promocion_Negocio PromNeg = new Promocion_Negocio(); this.dgvSucursalesPromo.AutoGenerateColumns = false; this.dgvSucursalesPromo.DataSource = PromNeg.ObtenerPreciosXSucursalPromocion(Comun.Conexion, IDPromocion); } catch (Exception ex) { throw ex; } }
private void LlenarGrid() { try { Promocion_Negocio PromNeg = new Promocion_Negocio(); List <Promocion> Lista = PromNeg.ObtenerPromociones(Comun.Conexion, string.Empty); this.dgvPromociones.AutoGenerateColumns = false; this.dgvPromociones.DataSource = Lista; } catch (Exception ex) { throw ex; } }
private void CargarDatos() { try { this.lblSucursal.Text = Datos.NombreSucursal; Promocion_Negocio PromNeg = new Promocion_Negocio(); dgvServicios.AutoGenerateColumns = false; dgvServicios.DataSource = PromNeg.ObtenerPreciosServicioXIDSucIDPromocion(Comun.Conexion, Datos.IDPromocion, Datos.IDSucursal); } catch (Exception ex) { throw ex; } }
private void btnGuardar_Click(object sender, EventArgs e) { try { this.txtMensajeError.Visible = false; List <Error> Errores = this.ValidarDatos(); if (Errores.Count == 0) { Promocion_Negocio PromNeg = new Promocion_Negocio(); Promocion Datos = this.ObtenerDatos(); int Resultado = 0; if (NuevoRegistro) { Resultado = PromNeg.AgregarPromocion(Comun.Conexion, Datos, Comun.IDUsuario); if (Resultado == 1) { MessageBox.Show("PromociĆ³n registrada existosamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Error al guardar los datos.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { Resultado = PromNeg.ModificarPromocion(Comun.Conexion, Datos, Comun.IDUsuario); if (Resultado == 1) { MessageBox.Show("Datos guardados existosamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Error al guardar los datos.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else { this.MostrarMensajeError(Errores); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmNuevaPromocion ~ btnGuardar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void IniciarDatosModificar() { try { dgvServicios.Visible = false; btnAgregarServicio.Visible = false; btnEliminarServicio.Visible = false; label7.Visible = false; label8.Visible = false; Promocion_Negocio PromNeg = new Promocion_Negocio(); Promocion Datos = PromNeg.ObtenerDetallePromocion(Comun.Conexion, IDPromocion); CargarDatosAModificar(Datos); } catch (Exception ex) { throw ex; } }
private void IniciarDatos() { try { Promocion_Negocio PromNeg = new Promocion_Negocio(); List <Sucursal> Datos = PromNeg.ObtenerSucursalesPromocion(Comun.Conexion); txtNombrePromocion.Text = string.Empty; chkL.Checked = false; chkM.Checked = false; chkX.Checked = false; chkJ.Checked = false; chkV.Checked = false; chkS.Checked = false; chkD.Checked = false; LlenarListaPadecimientos(Datos); LlenarGridServicios(); } catch (Exception ex) { throw ex; } }