コード例 #1
0
        private SqlCommand CargarParametrosStore(Cifras pCifras_BE)
        {
            SqlCommand ocomando = new SqlCommand();

            try
            {
                ocomando.Parameters.Add("@IdCifras", SqlDbType.Int).Value          = pCifras_BE.IdTriaje;
                ocomando.Parameters.Add("@PruebasRealizadas", SqlDbType.Int).Value = pCifras_BE.PruebasRealizadas;
                ocomando.Parameters.Add("@CasosConfirmados", SqlDbType.Int).Value  = pCifras_BE.CasosConfirmados;
                ocomando.Parameters.Add("@Hospitalizados", SqlDbType.Int).Value    = pCifras_BE.Hospitalizados;
                ocomando.Parameters.Add("@Recuperados", SqlDbType.Int).Value       = pCifras_BE.Recuperados;
                ocomando.Parameters.Add("@Fallecidos", SqlDbType.Int).Value        = pCifras_BE.Fallecidos;
                //ocomando.Parameters.Add("@FechaPrueba", SqlDbType.VarChar, 250).Value = pCifras_BE.FechaPrueba;
                //ocomando.Parameters.Add("@FechaConfirmado", SqlDbType.VarChar, 250).Value = pCifras_BE.FechaConfirmado;
                //ocomando.Parameters.Add("@FechaHospitalizado", SqlDbType.VarChar, 250).Value = pCifras_BE.FechaHospitalizado;
                //ocomando.Parameters.Add("@FechaFallecido", SqlDbType.VarChar, 250).Value = pCifras_BE.FechaFallecido;
                ocomando.Parameters.Add("@IdTriaje ", SqlDbType.Int).Value = pCifras_BE.IdTriaje;
            }
            catch (Exception e)
            {
                throw new Exception("CargarParametrosStore():" + e.Message);
            }
            finally
            {
            }
            return(ocomando);
        }
コード例 #2
0
        public List <Cifras> ListarReporte()
        {
            SqlConnection oconexion = new SqlConnection(this.CadenaConexion());
            SqlCommand    ocomando  = new SqlCommand("[" + this.EsquemaBaseDatos() + "].[uspCifras_ListaCifras]", oconexion);

            ocomando.CommandType = CommandType.StoredProcedure;
            List <Cifras> oLista = new List <Cifras>();

            try
            {
                oconexion.Open();
                SqlDataReader oDataReader = ocomando.ExecuteReader();
                while (oDataReader.Read())
                {
                    Cifras obeCifras = new Cifras();
                    obeCifras = CargarDatosEntidad(oDataReader);
                    oLista.Add(obeCifras);
                    obeCifras = null;
                }
            }
            catch (Exception e)
            {
                throw new Exception("ListarReporte():" + e.Message);
            }
            finally
            {
                if (oconexion.State == ConnectionState.Open)
                {
                    oconexion.Close();
                }
                ocomando.Dispose();
                oconexion.Dispose();
            }
            return(oLista);
        }
コード例 #3
0
        public int RegistraRecuperadoFallecido(Cifras pCifras_BE)
        {
            SqlConnection oconexion = new SqlConnection(this.CadenaConexion());
            SqlCommand    ocomando  = new SqlCommand("[" + this.EsquemaBaseDatos() + "].[uspCifras_RegistraHospitalizadoFR]", oconexion);

            ocomando.CommandType = CommandType.StoredProcedure;
            ocomando.Parameters.Add("@Recuperados", SqlDbType.Int).Value = pCifras_BE.Recuperados;
            ocomando.Parameters.Add("@Fallecidos", SqlDbType.Int).Value  = pCifras_BE.Fallecidos;
            ocomando.Parameters.Add("@IdTriaje", SqlDbType.Int).Value    = pCifras_BE.IdTriaje;
            //ocomando.Parameters["@IdTriaje"].Direction = ParameterDirection.InputOutput;
            int StrResultado = 0;

            try
            {
                oconexion.Open();
                ocomando.ExecuteNonQuery();
                StrResultado = int.Parse(ocomando.Parameters["@IdTriaje"].Value.ToString());
            }
            catch (Exception e)
            {
                throw new Exception("RegistraRecuperadoFallecido():" + e.Message);
            }
            finally
            {
                if (oconexion.State == ConnectionState.Open)
                {
                    oconexion.Close();
                }
                ocomando.Dispose();
                oconexion.Dispose();
            }
            return(StrResultado);
        }
コード例 #4
0
        public Cifras CargarDatosEntidad(SqlDataReader oDataReader)
        {
            Cifras ObeCifras = new Cifras();

            try
            {
                ObeCifras = new Cifras(
                    //oDataReader.GetInt32((int)Cifras.CAMPOS.IdCifras),
                    oDataReader.GetInt32((int)Cifras.CAMPOS.PruebasRealizadas),
                    oDataReader.GetInt32((int)Cifras.CAMPOS.CasosConfirmados),
                    oDataReader.GetInt32((int)Cifras.CAMPOS.Hospitalizados),
                    oDataReader.GetInt32((int)Cifras.CAMPOS.Recuperados),
                    oDataReader.GetInt32((int)Cifras.CAMPOS.Fallecidos)
                    //oDataReader.GetString((int)Cifras.CAMPOS.FechaPrueba),
                    //oDataReader.GetString((int)Cifras.CAMPOS.FechaConfirmado),
                    //oDataReader.GetString((int)Cifras.CAMPOS.FechaHospitalizado),
                    //oDataReader.GetString((int)Cifras.CAMPOS.FechaFallecido),
                    //oDataReader.GetInt32((int)Cifras.CAMPOS.IdTriaje)

                    //oDataReader.GetString((int)Triaje.CAMPOS.Address)


                    );
            }
            catch (Exception e)
            {
                ObeCifras = null;
                throw new Exception("CargarDatosEntidad():" + e.Message);
            }
            finally
            {
            }
            return(ObeCifras);
        }
コード例 #5
0
        public DataTable Lista(Cifras pCifras_BE)
        {
            SqlConnection oconexion = new SqlConnection(this.CadenaConexion());
            SqlCommand    ocomando  = CargarParametrosStore(pCifras_BE);

            ocomando.CommandText = "[" + this.EsquemaBaseDatos() + "].[uspCifras_Listar]";
            ocomando.Connection  = oconexion;
            ocomando.CommandType = CommandType.StoredProcedure;
            DataTable oDt = new DataTable("Cifras");

            try
            {
                oconexion.Open();
                oDt.Load(ocomando.ExecuteReader());
            }
            catch (Exception e)
            {
                throw new Exception("Lista():" + e.Message);
            }
            finally
            {
                if (oconexion.State == ConnectionState.Open)
                {
                    oconexion.Close();
                }
                ocomando.Dispose();
                oconexion.Dispose();
            }
            return(oDt);
        }
コード例 #6
0
        public Cifras ListarKey(System.Int32 pCodigoCifras)
        {
            SqlConnection oconexion = new SqlConnection(this.CadenaConexion());
            SqlCommand    ocomando  = new SqlCommand("[" + this.EsquemaBaseDatos() + "].[uspCifras_ListarKey]", oconexion);

            ocomando.CommandType = CommandType.StoredProcedure;
            Cifras ObeCifras = new Cifras();

            ocomando.Parameters.Add("@IdCifras", SqlDbType.Int).Value = pCodigoCifras;
            try
            {
                oconexion.Open();
                SqlDataReader oDataReader = ocomando.ExecuteReader();
                while (oDataReader.Read())
                {
                    ObeCifras = CargarDatosEntidad(oDataReader);
                    break;
                }
            }
            catch (Exception e)
            {
                throw new Exception("ListarKey():" + e.Message);
            }
            finally
            {
                if (oconexion.State == ConnectionState.Open)
                {
                    oconexion.Close();
                }
                ocomando.Dispose();
                oconexion.Dispose();
            }
            return(ObeCifras);
        }
コード例 #7
0
        public JsonResult RegistraHospitalizado(Cifras pBECifras_BE)
        {
            try
            {
                Cifras oCifras_BE = new Cifras();
                oCifras_BE.MensajeError = "";
                oCifras_BE.CodigoError  = 0;

                if (!pBECifras_BE.IdTriaje.Equals(""))
                {
                    pBECifras_BE.IdTriaje = (oCifras_SD.RegistraHospitalizado(pBECifras_BE));

                    return(Json(pBECifras_BE, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(null));
                }
            }
            catch (Exception ex)
            {
                Cifras oCifras_BE = new Cifras();
                oCifras_BE.CodigoError  = ex.GetHashCode();
                oCifras_BE.MensajeError = ex.Message;
                return(Json(oCifras_BE, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #8
0
 public JsonResult ListaReporteDepartamento(System.String pDepartamento)
 {
     try
     {
         oREspuesta.ObjListaCifras = oCifras_SD.ListarReporteDepartamento(pDepartamento);
         return(Json(oREspuesta, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         Cifras oCifras_BE = new Cifras();
         oCifras_BE.CodigoError  = ex.GetHashCode();
         oCifras_BE.MensajeError = ex.Message;
         oREspuesta.ObjCifras    = oCifras_BE;
         return(Json(oREspuesta, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #9
0
 public JsonResult Lista(Cifras pCifras_BE)
 {
     try
     {
         oREspuesta.ObjListaCifras = oCifras_SD.Listar(pCifras_BE);
         return(Json(oREspuesta, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         Cifras oCifras_BE = new Cifras();
         oCifras_BE.CodigoError  = ex.GetHashCode();
         oCifras_BE.MensajeError = ex.Message;
         oREspuesta.ObjCifras    = oCifras_BE;
         return(Json(oREspuesta, JsonRequestBehavior.AllowGet));
     }
 }