private void Guardar() { var loteProyeccionPL = new LoteProyeccionPL(); AsignarDatosControl(); loteProyeccionPL.GuardarConfiguracionReimplante(Contexto); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.GuardadoConExito, MessageBoxButton.OK, MessageImage.Correct); Limpiar(); }
private void GuardarProyeccion(CheckListCorralInfo checkListCorral, CheckListCorralDAL checkListCorralDAL) { var loteProyeccion = checkListCorralDAL.GenerarProyeccion(checkListCorral); var loteProyeccionBL = new LoteProyeccionPL(); var listaReimplantesGuardar = new List <LoteReimplanteInfo>(); if (loteProyeccion == null) { return; } loteProyeccion.UsuarioCreacionID = checkListCorral.UsuarioCreacionID; loteProyeccion.RequiereRevision = checkListCorral.RequiereRevision; var loteProyeccionID = loteProyeccionBL.Guardar(loteProyeccion); var primerReimplante = new LoteReimplanteInfo { LoteProyeccionID = loteProyeccionID, NumeroReimplante = loteProyeccion.Proyeccion.PrimerReimplante, FechaProyectada = loteProyeccion.Proyeccion.FechaProyectada1, PesoProyectado = loteProyeccion.Proyeccion.PesoProyectado1, UsuarioCreacionID = checkListCorral.UsuarioCreacionID }; if (primerReimplante.NumeroReimplante != 0 && primerReimplante.FechaProyectada != DateTime.MinValue && primerReimplante.PesoProyectado != 0) { listaReimplantesGuardar.Add(primerReimplante); } var segundoReimplante = new LoteReimplanteInfo { LoteProyeccionID = loteProyeccionID, NumeroReimplante = loteProyeccion.Proyeccion.SegundoReimplante, FechaProyectada = loteProyeccion.Proyeccion.FechaProyectada2, PesoProyectado = loteProyeccion.Proyeccion.PesoProyectado2, UsuarioCreacionID = checkListCorral.UsuarioCreacionID }; if (segundoReimplante.NumeroReimplante != 0 && segundoReimplante.FechaProyectada != DateTime.MinValue && segundoReimplante.PesoProyectado != 0) { listaReimplantesGuardar.Add(segundoReimplante); } var loteReimplanteBL = new LoteReimplanteBL(); if (listaReimplantesGuardar.Count > 0) { loteReimplanteBL.GuardarListaReimplantes(listaReimplantesGuardar); } checkListCorral.FechaSacrificio = loteProyeccion.FechaSacrificio; checkListCorral.Fecha1Reimplante = loteProyeccion.Proyeccion.FechaProyectada1; checkListCorral.Fecha2Reimplante = loteProyeccion.Proyeccion.FechaProyectada2; checkListCorral.DiasEngorda = loteProyeccion.DiasEngorda; }
private void ObtenerDatosProyeccion() { try { var lotePL = new LotePL(); var loteProyeccionPL = new LoteProyeccionPL(); Contexto.Lote = lotePL.ObtenerPorCorralID(Contexto.Lote); if (Contexto.Lote == null) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ConfiguracionReimplante_LoteInvalido, MessageBoxButton.OK, MessageImage.Warning); Limpiar(); return; } if (Contexto.Lote.FechaCierre.Year < 2000) { Contexto.Lote.AplicaCierreLote = true; //SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], // Properties.Resources.ConfiguracionReimplante_LoteAbierto, MessageBoxButton.OK, MessageImage.Warning); //Limpiar(); //return; } Contexto.LoteProyeccion = loteProyeccionPL.ObtenerPorLoteCompleto(Contexto.Lote); if (Contexto.LoteProyeccion != null && Contexto.LoteProyeccion.ListaReimplantes != null && Contexto.LoteProyeccion.ListaReimplantes.Any()) { Contexto.LoteProyeccion.ListaReimplantes.ToList().ForEach(reimp => { reimp.PermiteEditar = reimp.FechaReal == DateTime.MinValue; }); ActualizarGrid(); } if (Contexto.LoteProyeccion == null) { Contexto.LoteProyeccion = new LoteProyeccionInfo(); Contexto.LoteProyeccion.FechaEntradaZilmax = DateTime.Now; } ObtenerDatosCalculados(); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ConfiguracionReimplante_ErrorConsultarProyeccion, MessageBoxButton.OK, MessageImage.Error); } }
private void AsignarDatosControl() { int usuarioID = AuxConfiguracion.ObtenerUsuarioLogueado(); Contexto.UsuarioCreacionID = usuarioID; var loteProyeccionPL = new LoteProyeccionPL(); LoteProyeccionInfo loteProyeccionOriginal = loteProyeccionPL.ObtenerPorLoteCompleto(Contexto.Lote); if (loteProyeccionOriginal != null) { bool proyeccionIgual = Extensor.CompararObjetos(Contexto.LoteProyeccion, loteProyeccionOriginal, false); if (!proyeccionIgual) { Contexto.LoteProyeccion.AplicaBitacora = true; } LoteProyeccionInfo proyeccionBitacora = loteProyeccionPL.ObtenerBitacoraPorLoteProyeccionID(Contexto.LoteProyeccion.LoteProyeccionID); if (proyeccionBitacora == null) { Contexto.LoteProyeccion.AplicaBitacora = true; } } DateTime fecha = dtpFechaDisponible.SelectedDate.HasValue ? dtpFechaDisponible.SelectedDate.Value : DateTime.MinValue; Contexto.LoteProyeccion.FechaSacrificio = fecha; Contexto.FechaDisponible = fecha; if (Contexto.LoteProyeccion.LoteProyeccionID == 0) { Contexto.LoteProyeccion.DiasEngorda = Contexto.TotalDias; Contexto.LoteProyeccion.UsuarioCreacionID = usuarioID; } else { Contexto.LoteProyeccion.UsuarioModificacionID = usuarioID; } if (Contexto.LoteProyeccion.ListaReimplantes != null && Contexto.LoteProyeccion.ListaReimplantes.Any()) { Contexto.LoteProyeccion.ListaReimplantes.ToList().ForEach(reimp => reimp.UsuarioCreacionID = usuarioID); } }
private void ObtenerPesos() { var loteProyeccionPL = new LoteProyeccionPL(); Contexto.LoteProyecion = loteProyeccionPL.ObtenerPorLote(Contexto.LoteInfo); }