/// <summary>
        ///
        /// Obtiene los datos del desglose de horas de un calendario determinado,
        /// para un rango de fechas concreto,
        /// correspondientes a la tabla t067_DESGLOSECAL.
        /// </summary>
        public void ObtenerHorasRango(DateTime dDesde, DateTime dHasta)
        {
            DiaCal objDiaCal;

            SqlParameter[] aParam = new SqlParameter[4];
            aParam[0] = new SqlParameter("@nIdCal", SqlDbType.Int, 4);
            aParam[1] = new SqlParameter("@nAnno", SqlDbType.Int, 4);
            aParam[2] = new SqlParameter("@dDesde", SqlDbType.DateTime, 8);
            aParam[3] = new SqlParameter("@dHasta", SqlDbType.DateTime, 8);

            aParam[0].Value = this.nIdCal;
            aParam[1].Value = null;
            aParam[2].Value = dDesde;
            aParam[3].Value = dHasta;

            SqlDataReader dr = SqlHelper.ExecuteSqlDataReader("SUP_DESGLOSECALS", aParam);

            while (dr.Read())
            {
                objDiaCal = new DiaCal(int.Parse(dr["t066_idcal"].ToString()), (DateTime)dr["t067_dia"], double.Parse(dr["t067_horas"].ToString()), int.Parse(dr["t067_festivo"].ToString()));
                this.aHorasDia.Add(objDiaCal);
            }
            dr.Close();
            dr.Dispose();
        }
        /// <summary>
        ///
        /// Obtiene los datos del desglose de horas de un calendario determinado,
        /// correspondientes a la tabla t067_DESGLOSECAL.
        /// </summary>
        public void ObtenerHoras(int nAnno)
        {
            DiaCal objDiaCal;

            SqlParameter[] aParam = new SqlParameter[2];
            aParam[0] = new SqlParameter("@nIdCal", SqlDbType.Int, 4);
            aParam[1] = new SqlParameter("@nAnno", SqlDbType.Int, 4);

            aParam[0].Value = nIdCal;
            aParam[1].Value = nAnno;

            SqlDataReader dr = SqlHelper.ExecuteSqlDataReader("SUP_DESGLOSECALS", aParam);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    objDiaCal = new DiaCal(int.Parse(dr["t066_idcal"].ToString()), (DateTime)dr["t067_dia"], double.Parse(dr["t067_horas"].ToString()), int.Parse(dr["t067_festivo"].ToString()));
                    this.aHorasDia.Add(objDiaCal);
                }
            }
            else
            {
                DateTime objDate = new DateTime(nAnno, 1, 1);
                while (objDate.Year == nAnno)
                {
                    objDiaCal = new DiaCal(this.nIdCal, objDate, 0, 0);
                    this.aHorasDia.Add(objDiaCal);
                    objDate = objDate.AddDays(1);
                }
            }
            dr.Close();
            dr.Dispose();
        }
        /// <summary>
        ///
        /// Obtiene los datos del desglose de horas de un calendario determinado,
        /// correspondientes a la tabla t067_DESGLOSECAL.
        /// </summary>
        //public void ObtenerDias(int nAnno, int nCodProvincia)
        //{
        //    DiaCal objDiaCal;

        //    SqlParameter[] aParam = new SqlParameter[1];
        //    aParam[0] = new SqlParameter("@nCodProvincia", SqlDbType.Int, 4);

        //    aParam[0].Value = nCodProvincia;

        //    SqlDataReader dr = SqlHelper.ExecuteSqlDataReader("SUP_DESGLOSECALFESTIVOPROVS", aParam);

        //    if (dr.HasRows)
        //    {
        //        while (dr.Read())
        //        {
        //            objDiaCal = new DiaCal(0, (DateTime)dr["t061_dia"], 0, 1);
        //            this.aHorasDia.Add(objDiaCal);
        //        }
        //    }
        //    else
        //    {
        //        DateTime objDate = new DateTime(nAnno, 1, 1);
        //        while (objDate.Year == nAnno)
        //        {
        //            objDiaCal = new DiaCal(this.nIdCal, objDate, 0, 0);
        //            this.aHorasDia.Add(objDiaCal);
        //            objDate = objDate.AddDays(1);
        //        }
        //    }
        //    dr.Close();
        //    dr.Dispose();
        //}

        /// <summary>
        ///
        /// Obtiene los días de un año determinado
        /// </summary>
        public void PintarDias(int nAnno)
        {
            DiaCal objDiaCal;

            DateTime objDate = new DateTime(nAnno, 1, 1);

            while (objDate.Year == nAnno)
            {
                objDiaCal = new DiaCal(this.nIdCal, objDate, 0, 0);
                this.aHorasDia.Add(objDiaCal);
                objDate = objDate.AddDays(1);
            }
        }
        /// <summary>
        ///
        /// Graba los datos correspondientes al desglose de un Calendario,
        /// en la tabla t067_DESGLOSECAL,
        /// dentro de la transacción que se pasa como parámetro.
        /// </summary>
        public void InsertarHoras(SqlTransaction tr, int nAnno)
        {
            if (aHorasDia.Count > 0)
            {
                DiaCal.Eliminar(tr, ((DiaCal)aHorasDia[0]).nIdCal, nAnno);
            }
            //((DiaCal)aHorasDia[0]).Eliminar(tr, nAnno);


            foreach (DiaCal oDia in aHorasDia)
            {
                //oDia.nIdCal = this.nIdCal;
                //oDia.Insertar(tr);
                DiaCal.Insertar(tr, oDia.nIdCal, oDia.dFecha, oDia.nHoras, oDia.nFestivo);
            }
        }