예제 #1
0
        public JsonResult ResSobrantaesID(int id)
        {
            SobrantesM SobComb = _SobrantesMLogica.obtener(id);

            SobComb.detalle = _SobrantesMLogica.obtener_listaD(id);
            return(Json(SobComb));
        }
예제 #2
0
        public List <SobrantesM> obtener_por_producto(int producto)
        {
            List <SobrantesM> pResult    = null;
            string            pSentencia = "SELECT T0.*, T1.DESCRIPCION FROM DRASSOBRANTESM T0 JOIN DRASPROD T1 ON T1.CLAVE = T0.PRODUCTO WHERE T0.PRODUCTO = @PRODUCTO";

            FbConnection con = _Conexiones.ObtenerConexion();

            FbCommand com = new FbCommand(pSentencia, con);

            com.Parameters.Add("@PRODUCTO", FbDbType.Integer).Value = producto;

            try
            {
                con.Open();

                FbDataReader reader = com.ExecuteReader();

                if (reader.Read())
                {
                    SobrantesM pSobrantesM = new SobrantesM();
                    pSobrantesM.id       = (reader["ID"] != DBNull.Value) ? (int)reader["ID"] : -1;
                    pSobrantesM.producto = (reader["PRODUCTO"] != DBNull.Value) ? (string)reader["PRODUCTO"] : "";
                    pSobrantesM.activo   = (reader["ACTIVO"] != DBNull.Value) ? (string)reader["ACTIVO"] : "";
                    DateTime pFechaHoraSistema = (DateTime)reader["FECHAHORASISTEMA"];
                    pSobrantesM.fechahorasistema = pFechaHoraSistema.ToString("yyyy-MM-dd HH:mm:ss") + " -0700";
                    pSobrantesM.descripcion      = (reader["DESCRIPCION"] != DBNull.Value) ? (string)reader["DESCRIPCION"] : "";
                    pResult = new List <SobrantesM>();
                    pResult.Add(pSobrantesM);
                }
            }
            finally
            {
                if (con.State == System.Data.ConnectionState.Open)
                {
                    con.Close();
                }
            }

            return(pResult);
        }