예제 #1
0
        public List <ReporteChildBE> ReporteUsoUsuGetDia(DBHelper pDBHelper, ReporteChildBE pReporteChild)
        {
            List <ReporteChildBE> oLista = new List <ReporteChildBE>();
            ReporteChildBE        obj    = null;

            DBHelper.Parameters[] colParameters = null;
            try
            {
                // Parámetros
                colParameters = new DBHelper.Parameters[] {
                    new DBHelper.Parameters("@IdEmpresa", pReporteChild.idEmpresa == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.idEmpresa),
                    new DBHelper.Parameters("@IdUsuario", pReporteChild.idUsuario == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.idUsuario),
                    new DBHelper.Parameters("@Anho", pReporteChild.anho == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.anho),
                    new DBHelper.Parameters("@Semestre", pReporteChild.semestre == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.semestre),
                    new DBHelper.Parameters("@Trimestre", pReporteChild.trimestre == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.trimestre),
                    new DBHelper.Parameters("@Mes", pReporteChild.mes == Constantes.INT_NULO ? (object)DBNull.Value : pReporteChild.mes)
                };

                pDBHelper.ClearParameter();
                pDBHelper.CreateDBParameters(colParameters);

                using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ReporteUsoUsuGetDia"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit))
                {
                    // Leyendo reader
                    while (dr.Read())
                    {
                        obj = new ReporteChildBE();

                        StringBuilder sb = new StringBuilder();
                        sb.Append(dr["horas"].ToString().PadLeft(2, '0'));
                        sb.Append(":");
                        sb.Append(dr["minutos"].ToString().PadLeft(2, '0'));

                        obj.duration      = sb.ToString();
                        obj.idEmpresa     = int.Parse(dr["idEmpresa"].ToString());
                        obj.idUsuario     = int.Parse(dr["idUsuario"].ToString());
                        obj.NombreUsuario = dr["NombreCompleto"].ToString();
                        obj.anho          = int.Parse(dr["anho"].ToString());
                        obj.semestre      = int.Parse(dr["Semestre"].ToString());
                        obj.trimestre     = int.Parse(dr["Trimestre"].ToString());
                        obj.mes           = int.Parse(dr["Mes"].ToString());
                        obj.dia           = int.Parse(dr["Dia"].ToString());
                        oLista.Add(obj);
                    }
                }
                return(oLista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                colParameters = null;
                if (pDBHelper != null && pDBHelper.Command.Transaction == null)
                {
                    pDBHelper.Dispose();
                }
            }
        }
예제 #2
0
        public List <ReporteChildBE> ReporteUsoGetEmpresa(DBHelper pDBHelper)
        {
            List <ReporteChildBE> lst = null;
            ReporteChildBE        obj = null;

            DBHelper.Parameters[] colParameters = null;
            lst = new List <ReporteChildBE>();

            try
            {
                colParameters = new DBHelper.Parameters[] {
                };
                pDBHelper.ClearParameter();
                pDBHelper.CreateDBParameters(colParameters);

                using (IDataReader dr = pDBHelper.ExecuteReader(pDBHelper.concatOwner("ReporteUsoGetEmpresa"), CommandType.StoredProcedure, Utility.ConnectionState.CloseOnExit))
                {
                    // Leyendo reader
                    while (dr.Read())
                    {
                        obj = new ReporteChildBE();

                        obj.task = dr["Descripcion"].ToString();

                        StringBuilder sb = new StringBuilder();
                        sb.Append(dr["horas"].ToString().PadLeft(2, '0'));
                        sb.Append(":");
                        sb.Append(dr["minutos"].ToString().PadLeft(2, '0'));

                        obj.duration  = sb.ToString();
                        obj.idEmpresa = int.Parse(dr["idEmpresa"].ToString());

                        lst.Add(obj);
                    }
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //colParameters = null;
                if (pDBHelper != null && pDBHelper.Command.Transaction == null)
                {
                    pDBHelper.Dispose();
                }
            }
        }