Esempio n. 1
0
        public LotesPie ObtenerLoteEnPieMod(string AFechaIni, string AFechaFin, int AGranja, int ALote)
        {
            string       pSentencia = "SELECT * FROM DRASLPIE WHERE GRANJA = @GRANJA AND @LOTE=LOTE AND FECHA >= @FECHAINI AND FECHA <= @FECHAFIN";
            FbConnection con        = _Conexion.ObtenerConexion();
            FbCommand    com        = new FbCommand(pSentencia, con);

            com.Parameters.Add("@GRANJA", FbDbType.Integer).Value     = AGranja;
            com.Parameters.Add("@FECHAINI", FbDbType.TimeStamp).Value = AFechaIni;
            com.Parameters.Add("@FECHAFIN", FbDbType.TimeStamp).Value = AFechaFin;
            com.Parameters.Add("@LOTE", FbDbType.Integer).Value       = ALote;
            LotesPie pResult = new LotesPie();

            try
            {
                con.Open();
                FbDataReader reader = com.ExecuteReader();
                if (reader.Read())
                {
                    LotesPie pLotesPie = new LotesPie();
                    pLotesPie.Fecha                   = reader["FECHA"] != DBNull.Value ? Utilerias.dateTimeToString((DateTime)reader["FECHA"]) : "";
                    pLotesPie.Lote                    = (reader["LOTE"] != DBNull.Value) ? (int)reader["LOTE"] : -1;
                    pLotesPie.Cantidad                = (reader["CANTIDAD"] != DBNull.Value) ? (int)reader["CANTIDAD"] : -1;
                    pLotesPie.Peso                    = (reader["PESO"] != DBNull.Value) ? (decimal)reader["PESO"] : -1;
                    pLotesPie.Tipo                    = (reader["TIPO"] != DBNull.Value) ? (string)reader["TIPO"] : "";
                    pLotesPie.Estatus                 = (reader["ESTATUS"] != DBNull.Value) ? (string)reader["ESTATUS"] : "";
                    pLotesPie.Jaula                   = (reader["JAULA"] != DBNull.Value) ? (string)reader["JAULA"] : "";
                    pLotesPie.CerdosObservaciones     = (reader["CERDOS_OBSERVACION"] != DBNull.Value) ? (int)reader["CERDOS_OBSERVACION"] : -1;
                    pLotesPie.CerdosFaltantes         = (reader["CERDOS_FALTANTES"] != DBNull.Value) ? (int)reader["CERDOS_FALTANTES"] : -1;
                    pLotesPie.Vehiculo                = (reader["VEHICULO"] != DBNull.Value) ? (string)reader["VEHICULO"] : "";
                    pLotesPie.MuertosEnCorral         = (reader["MUERTOS_EN_CORRAL"] != DBNull.Value) ? (int)reader["MUERTOS_EN_CORRAL"] : -1;
                    pLotesPie.MuertosEnTrayecto       = (reader["MUERTOS_EN_TRAYECTO"] != DBNull.Value) ? (int)reader["MUERTOS_EN_TRAYECTO"] : -1;
                    pLotesPie.CostoBajas              = reader["COSTO_BAJAS"] != DBNull.Value ? (decimal)reader["COSTO_BAJAS"] : -1;
                    pLotesPie.Observaciones           = (reader["OBSERVACIONES"] != DBNull.Value) ? (string)reader["OBSERVACIONES"] : "";
                    pLotesPie.HoraRecepcion           = (reader["HORA_RECEPCION"] != DBNull.Value) ? (string)reader["HORA_RECEPCION"] : "";
                    pLotesPie.HoraLlegada             = (reader["HORA_LLEGADA"] != DBNull.Value) ? (string)reader["HORA_LLEGADA"] : "";
                    pLotesPie.InicioDescarga          = (reader["INICIO_DESCARGA"] != DBNull.Value) ? (string)reader["INICIO_DESCARGA"] : "";
                    pLotesPie.FinDescarga             = (reader["FIN_DESCARGA"] != DBNull.Value) ? (string)reader["FIN_DESCARGA"] : "";
                    pLotesPie.TiempoEstancia          = (reader["TIEMPO_ESTANCIA"] != DBNull.Value) ? (int)reader["TIEMPO_ESTANCIA"] : -1;
                    pLotesPie.HoraSalida              = (reader["HORA_SALIDA"] != DBNull.Value) ? (string)reader["HORA_SALIDA"] : "";
                    pLotesPie.TiempoRealDescarga      = (reader["TIEMPO_REAL_DESCARGA"] != DBNull.Value) ? (int)reader["TIEMPO_REAL_DESCARGA"] : -1;
                    pLotesPie.CanalesRetenidos        = (reader["CANALES_RETENIDOS"] != DBNull.Value) ? (int)reader["CANALES_RETENIDOS"] : -1;
                    pLotesPie.NumeroCorrales          = (reader["NUMERO_CORRALES"] != DBNull.Value) ? (string)reader["NUMERO_CORRALES"] : "";
                    pLotesPie.PesoPromedio            = reader["PESO_PROMEDIO"] != DBNull.Value ? (decimal)reader["PESO_PROMEDIO"] : -1;
                    pLotesPie.ObservacionesSacrificio = (reader["OBSERVACIONES_SACRIFICIO"] != DBNull.Value) ? (string)reader["OBSERVACIONES_SACRIFICIO"] : "";
                    pResult = pLotesPie;
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return(pResult);
        }
Esempio n. 2
0
        public ActionResult EditarLotePie(string Dia, string Mes, string Año, int AGranja, int ALote)
        {
            string AFecha = Dia + "/" + Mes + "/" + Año;

            Console.WriteLine(AFecha);
            Granja pGranja = _GranjasLogica.ObtenerGranja(AGranja);

            ViewBag.Granja = AGranja; ViewBag.Nombre = pGranja.Nombre; ViewBag.Fecha = AFecha;
            LotesPie pLotePie = _CanalesLogica.ObtenerLoteEnPieMod(AFecha, AFecha, AGranja, ALote);

            return(View(pLotePie));
        }
Esempio n. 3
0
        public LotesPie ObtenerLoteEnPie(string AFechaIni, string AFechaFin, int AGranja, int ALote)
        {
            string       pSentencia = "SELECT * FROM DRASLPIE WHERE GRANJA = @GRANJA AND @LOTE=LOTE AND FECHA >= @FECHAINI AND FECHA <= @FECHAFIN";
            FbConnection con        = _Conexion.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);

            com.Parameters.Add("@GRANJA", FbDbType.Integer).Value     = AGranja;
            com.Parameters.Add("@FECHAINI", FbDbType.TimeStamp).Value = AFechaIni;
            com.Parameters.Add("@FECHAFIN", FbDbType.TimeStamp).Value = AFechaFin;
            com.Parameters.Add("@LOTE", FbDbType.Integer).Value       = ALote;
            LotesPie pResult = new LotesPie();

            try
            {
                con.Open();
                FbDataReader reader = com.ExecuteReader();
                if (reader.Read())
                {
                    LotesPie pLotesPie = new LotesPie();
                    pLotesPie.Fecha      = reader["FECHA"] != DBNull.Value ? Utilerias.dateTimeToString((DateTime)reader["FECHA"]) : "";
                    pLotesPie.Lote       = (reader["LOTE"] != DBNull.Value) ? (int)reader["LOTE"] : -1;
                    pLotesPie.Cantidad   = (reader["CANTIDAD"] != DBNull.Value) ? (int)reader["CANTIDAD"] : -1;
                    pLotesPie.Peso       = (reader["PESO"] != DBNull.Value) ? (decimal)reader["PESO"] : -1;
                    pLotesPie.Estatus    = (reader["ESTATUS"] != DBNull.Value) ? (string)reader["ESTATUS"] : "";
                    pLotesPie.Bajas      = (reader["BAJAS"] != DBNull.Value) ? (short)reader["BAJAS"] : -1;
                    pLotesPie.Peso       = (reader["PESO"] != DBNull.Value) ? (decimal)reader["PESO"] : -1;
                    pLotesPie.PesoBajas  = (reader["PESOBAJA"] != DBNull.Value) ? (float)reader["PESOBAJA"] : -1;
                    pLotesPie.Indice     = (reader["INDICE"] != DBNull.Value) ? (int)reader["INDICE"] : -1;
                    pLotesPie.Id         = (reader["ID"] != DBNull.Value) ? (int)reader["ID"] : -1;
                    pLotesPie.MotivoBaja = (reader["MOTIVOBAJA"] != DBNull.Value) ? (string)reader["MOTIVOBAJA"] : "";
                    pResult = pLotesPie;
                    Console.WriteLine("PesoBaja" + pLotesPie.PesoBajas);
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return(pResult);
        }
Esempio n. 4
0
        public ActionResult AgregarBajasLotePie(string AFecha, int AGranja, int ALote)
        {
            Granja pGranja = _GranjasLogica.ObtenerGranja(AGranja);

            ViewBag.Granja = AGranja; ViewBag.Nombre = pGranja.Nombre;

            LotesPie pLotesPie = _CanalesLogica.ObtenerLoteEnPie(AFecha, AFecha, AGranja, ALote);

            if (pLotesPie.Bajas == -1)
            {
                ViewBag.Bajas = "";
            }
            else
            {
                ViewBag.Bajas = pLotesPie.Bajas;
            }
            ViewBag.Fecha = AFecha; ViewBag.Lote = ALote; ViewBag.PesoBajas = pLotesPie.PesoBajas; ViewBag.MotivoBaja = pLotesPie.MotivoBaja;
            return(View());
        }