private void ObtenerConsecutivo(int OrganizacionId) { var pl = new ChequeraPL(); var list = pl.ObtenerConsecutivo(OrganizacionId); txtChequera.Text = list.ToString(); txtNumeroChequera.Text = list.ToString(); Contexto.NumeroChequera = list.ToString(); }
private bool ValidarSiExisteChequeraActiva(int organizacionId, bool validar, int estatusId) { var result = false; var pl = new ChequeraPL(); if (validar) { result = pl.ValidarSiExisteChequeraActiva(organizacionId, estatusId); } return(result); }
private void ObtenerChequeras() { try { var chequeraPL = new ChequeraPL(); var lista = chequeraPL.ObtenerTodos(); gridDatos.ItemsSource = lista; } catch (Exception) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.AdministrarChequera_ErrorGeneral, MessageBoxButton.OK, MessageImage.Error); } }
private void ObtenerChequerasPorFiltro() { try { var chequeraPL = new ChequeraPL(); if (cmbActivo.SelectedIndex <= 0) { Contexto.EstatusIdString = string.Empty; } var lista = chequeraPL.ObtenerPorFiltro(Contexto); gridDatos.ItemsSource = lista; } catch (Exception) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.AdministrarChequera_ErrorGeneral, MessageBoxButton.OK, MessageImage.Error); } }
private void ObtenerDetalleChequera() { var pl = new ChequeraPL(); if (_esNuevo) { txtDisponible.Text = string.Format("0"); txtGirados.Text = string.Format("0"); txtCancelados.Text = string.Format("0"); } else { var detalle = pl.ObtenerDetalleChequera(Contexto.ChequeraId, Contexto.CentroAcopio.OrganizacionID); txtDisponible.Text = detalle.ChequesDisponibles.ToString(); txtGirados.Text = detalle.ChequesGirados.ToString(); txtCancelados.Text = detalle.ChequesCancelados.ToString(); dtpFecha.SelectedDate = detalle.FechaCreacion.Date; txtNumeroChequera.Text = detalle.NumeroChequera; txtChequeInicial.Text = detalle.ChequeInicial.ToString(); txtChequeFinal.Text = detalle.ChequeFinal.ToString(); txtChequera.Text = detalle.ChequeraId.ToString(); Contexto.NumeroChequera = detalle.ChequeraId.ToString(); } }
private bool ValidarChequesGirados(int organizacionId, int chequeraId) { var pl = new ChequeraPL(); return(pl.ValidarChequesGirados(organizacionId, chequeraId)); }
private void Guardar() { try { if (Validar(true)) { var existeEstatus = false; if (cboEstatus.SelectedValue.GetHashCode() != EstatusChequeraEnum.Cancelada.GetHashCode() && cboEstatus.SelectedValue.GetHashCode() != EstatusChequeraEnum.Cerrada.GetHashCode()) { // Es menos uno ya que el catálogo de centros se definió diferente al de SIAP, allá el consecutivo inicia en 0 y no en 1 existeEstatus = ValidarSiExisteChequeraActiva(Contexto.CentroAcopio.OrganizacionID, true, cboEstatus.SelectedValue.GetHashCode() - 1); } if (!existeEstatus) { var sepuedeRealizarCambio = true; if (!_esNuevo && Contexto.EstatusId + 1 == EstatusChequeraEnum.Cerrada.GetHashCode() && (cboEstatus.SelectedValue.GetHashCode() == EstatusChequeraEnum.Activa.GetHashCode() || cboEstatus.SelectedValue.GetHashCode() == EstatusChequeraEnum.Disponible.GetHashCode())) { if (ValidarChequesGirados(Contexto.CentroAcopio.OrganizacionID, Contexto.ChequeraId)) { sepuedeRealizarCambio = false; SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format(Properties.Resources.RegistrarChequera_ValidarChequesGirados, cboEstatus.Text), MessageBoxButton.OK, MessageImage.Warning); } } if (sepuedeRealizarCambio) { var pl = new ChequeraPL(); Contexto.UsuarioCreacionID = AuxConfiguracion.ObtenerUsuarioLogueado(); Contexto.ChequeraEtapas.EtapaId = cboEstatus.SelectedValue.GetHashCode() - 1; var result = pl.Guardar(Contexto); if (result >= 0) { txtChequera.Text = result.ToString(); txtNumeroChequera.Text = result.ToString(); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format(Properties.Resources.RegistrarChequera_Exito, result), MessageBoxButton.OK, MessageImage.Correct); _seGuardo = true; _confirmar = false; Close(); } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RegistrarChequera_ErrorGuardar, MessageBoxButton.OK, MessageImage.Error); } } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format(Properties.Resources.RegistrarChequera_ExisteChequeraActiva, cboEstatus.Text, Contexto.CentroAcopio.OrganizacionID), MessageBoxButton.OK, MessageImage.Warning); } } } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.RegistrarChequera_ErrorGuardar, MessageBoxButton.OK, MessageImage.Error); } }