/// <summary> /// Carga los datos de corrales disponibles para reimplate /// </summary> private void CargarCorralesParaReimplante() { //Validamos que no exista programacion para el dia seleccionado try { var progReimplantePl = new ProgramacionReimplantePL(); //validar si para la fecha seleccionada existe programacion de reimplante registrada var existeProgramacion = progReimplantePl.ExisteProgramacionReimplante(_organizacionId, dtfFecha.SelectedDate.Value); if (existeProgramacion && !programacionRealizada) { programacionRealizada = true; MessageBoxResult confirmar = SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.OrdenReimplante_ImprimirProgramacionCerrada, MessageBoxButton.OK, MessageImage.Warning); } else { var lotes = progReimplantePl.ObtenerLotesDisponiblesReimplante(_organizacionId); _lotesDisponibles = lotes.Lista; if (_lotesDisponibles != null) { dgCorrales.ItemsSource = _lotesDisponibles; } else { dgCorrales.ItemsSource = null; SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.OrdenReimplante_NoExisteCorralesDisponibles, MessageBoxButton.OK, MessageImage.Warning); } } } catch (ExcepcionGenerica) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ErrorObtenerCorrales, MessageBoxButton.OK, MessageImage.Error); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ErrorObtenerCorrales, MessageBoxButton.OK, MessageImage.Error); } }
/// <summary> /// Guarda la programacion de reimplante /// </summary> private void GuardarProgramacion() { try { var programacionReimplantePl = new ProgramacionReimplantePL(); var resultado = programacionReimplantePl.GuardarProgramacionReimplante(_lotesDisponibles); if (resultado) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ExitoGuardarProgramacion, MessageBoxButton.OK, MessageImage.Correct); CargarCorralesParaReimplante(); } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ErrorGuardarProgramacion, MessageBoxButton.OK, MessageImage.Error); } } catch (ExcepcionGenerica) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ErrorGuardarProgramacion, MessageBoxButton.OK, MessageImage.Error); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ProgramacionReimplante_ErrorGuardarProgramacion, MessageBoxButton.OK, MessageImage.Error); } }
public static int ObtenerHabilitarEstadoComedero(int loteID) { int resultado = 0; ProgramacionReimplantePL programacionReinplantePL = new ProgramacionReimplantePL(); OrdenSacrificioPL ordenSacrificioPL = new OrdenSacrificioPL(); LotePL lotePL = new LotePL(); LoteInfo lote = new LoteInfo(); OrdenSacrificioInfo orden = new OrdenSacrificioInfo(); try { var seguridad = (SeguridadInfo)HttpContext.Current.Session["Seguridad"]; int organizacionId = seguridad.Usuario.Organizacion.OrganizacionID; if (seguridad != null) { lote = lotePL.ObtenerPorId(loteID); if (lote != null) { //Se verifica si el corral va a Zilmax if (lote.FechaDisponibilidad.ToShortDateString() != DateTime.Now.ToShortDateString()) { resultado = 1; } //Se verifica si el corral va a reimplante if (resultado == 1) { List <ProgramacionReinplanteInfo> programacionReinplante = null; programacionReinplante = programacionReinplantePL.ObtenerProgramacionReimplantePorLoteID(lote); if (programacionReinplante.Count > 0) { if (programacionReinplante.First().Fecha.ToShortDateString() == DateTime.Now.ToShortDateString()) { resultado = 0; } } } //Se verifica si el corral va a sacrificio if (resultado == 1) { orden.FechaOrden = DateTime.Now; orden.OrganizacionID = organizacionId; orden.EstatusID = (int)Estatus.OrdenSacrificioPendiente; orden = ordenSacrificioPL.ObtenerOrdenSacrificioDelDia(orden); if (orden != null) { for (var i = 0; i < orden.DetalleOrden.Count; i++) { if (orden.DetalleOrden[i].Lote.LoteID == lote.LoteID) { resultado = 0; } } } } } } } catch (Exception ex) { Logger.Error(ex); } return(resultado); }