private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int aux = 0; MotivoCanc AuxMC = this.ObtenerMotivoCombo(); if (AuxMC.IDMotivo == 0) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Seleccione un motivo.", ControlSender = this.cmbMotivoCanc }); } decimal Monto = this.ObtenerMontoPenalizacion(); if (Monto < 0) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "El monto de penalización debe ser mayor o igual a 0.", ControlSender = this.cmbMotivoCanc }); } if (Monto > Datos.Total) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "El monto de penalización no debe ser mayor al total.", ControlSender = this.cmbMotivoCanc }); } return(Errores); } catch (Exception ex) { throw ex; } }
public List <MotivoCanc> ObtenerComboMotivoCanc(MotivoCanc Datos) { try { Venta_Datos VD = new Venta_Datos(); return(VD.ObtenerComboMotivoCanc(Datos)); } catch (Exception ex) { throw ex; } }
private void CargarComboMotivoCanc() { try { MotivoCanc Datos = new MotivoCanc { IncluirSelect = true, Conexion = Comun.Conexion }; Venta_Negocio VN = new Venta_Negocio(); this.cmbMotivoCanc.DataSource = VN.ObtenerComboMotivoCanc(Datos); this.cmbMotivoCanc.DisplayMember = "Descripcion"; this.cmbMotivoCanc.ValueMember = "IDMotivo"; } catch (Exception ex) { throw ex; } }
private MotivoCanc ObtenerMotivoCombo() { try { MotivoCanc Datos = new MotivoCanc(); if (this.cmbMotivoCanc.Items.Count > 0) { if (this.cmbMotivoCanc.SelectedIndex != -1) { Datos = (MotivoCanc)this.cmbMotivoCanc.SelectedItem; } } return(Datos); } catch (Exception ex) { throw ex; } }
private Venta ObtenerDatos() { try { Venta DatosAux = new Venta(); MotivoCanc MCAux = this.ObtenerMotivoCombo(); DatosAux.IDVenta = this.Datos.IDVenta; DatosAux.IDMotivoCan = MCAux.IDMotivo; DatosAux.ComentariosCanc = this.txtMotivo.Text.Trim(); DatosAux.MontoPenalizacionCanc = this.ObtenerMontoPenalizacion(); DatosAux.IDSucursal = Comun.IDSucursalCaja; DatosAux.IDUsuario = Comun.IDUsuario; DatosAux.IDCaja = Comun.IDCaja; DatosAux.Conexion = Comun.Conexion; return(DatosAux); } catch (Exception ex) { throw ex; } }
private void cmbMotivoCanc_SelectedIndexChanged(object sender, EventArgs e) { try { MotivoCanc Datos = this.ObtenerMotivoCombo(); if (Datos.RequiereDatos) { this.txtMotivo.Enabled = true; this.txtMotivo.Text = string.Empty; } else { this.txtMotivo.Enabled = false; this.txtMotivo.Text = string.Empty; } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmCancelar ~ cmbMotivoCanc_SelectedIndexChanged"); } }