/// <summary> Ingresa el nùmero de rifa de un socio. </summary>
        /// <param name="tintCodigoSoc"> Còdigo del socio para el nùemro de la rifa. </param>
        /// <param name="tintAño"> Año para el nùmero de la rifa. </param>
        /// <param name="tintMes"> Mes para el nùmero de la rifa. </param>
        public void gmtdIngresarNumeroRifa(int tintCodigoSoc, int tintAño, int tintMes)
        {
            string strResultado = new daoRecibosIngresos().gmtdConsultarNumeroRifa(tintCodigoSoc, tintAño, tintMes);

            if (strResultado == "-1")
            {
                new daoRecibosIngresos().gmtdIngresarNumeroRifa(tintCodigoSoc, tintAño, tintMes);
            }
        }
        /// <summary> Consulta los ingresos activos de ahorros en un rango de fechas. </summary>
        /// <param name="tdtmFecha"> La fecha hasta la cual se quieren conocer los datos. </param>
        /// <param name="tintMeses"> Meses de los que se quieren conocer los datos.  </summary>
        /// <returns> Diccionario con los datos consultados. </returns>
        public Dictionary <string, string> gmtdConsultarIngresosdeAhorrosAgrupadosenunRangodeFechas(DateTime tdtmFecha, int tintMeses)
        {
            Dictionary <string, string> lstMeses = new Dictionary <string, string>();

            int intAño = tdtmFecha.Year;
            int intMes = tdtmFecha.Month;

            DateTime[] fechasInciales = new DateTime[tintMeses];
            DateTime[] fechasFinales  = new DateTime[tintMeses];

            for (int a = 0; a < tintMeses; a++)
            {
                if (intMes < 1)
                {
                    intMes  = 12;
                    intAño -= 1;
                }

                DateTime dtmFechaIni = Convert.ToDateTime(intAño.ToString() + "-" + intMes.ToString() + "-" + pmtdMostrardiaInicial(intMes, true, intAño).ToString());
                DateTime dtmFechaFin = Convert.ToDateTime(intAño.ToString() + "-" + intMes.ToString() + "-" + pmtdMostrardiaInicial(intMes, false, intAño).ToString());

                fechasInciales[a] = dtmFechaIni;
                fechasFinales[a]  = dtmFechaFin;

                intMes--;
            }

            for (int a = tintMeses - 1; a >= 0; a--)
            {
                decimal decValor = new daoRecibosIngresos().gmtdConsultarIngresosdeAhorrosAgrupadosenunRangodeFechas(fechasInciales[a], fechasFinales[a]);

                lstMeses.Add(this.pmtdNombreMes(fechasInciales[a].Month), decValor.ToString());
            }

            return(lstMeses);
        }
        /// <summary> Elimina un recibo de ingreso. </summary>
        /// <param name="tobjIngreso"> Un objeto del tipo ingreso. </param>
        /// <returns> Un string que indica si se ejecuto o no la operación. </returns>
        public string gmtdEliminar(int intCodigoIng)
        {
            String Respuesta = new daoRecibosIngresos().gmtdEliminar(intCodigoIng);

            switch (Respuesta)
            {
            case "-1":
                return("- No se puede eliminar un recibo de un año diferente al actual del socio.");

                break;

            case "0":
                return("- No se puede realizar la operación.");

                break;

            case "1":
                return("Registro anulado.");

                break;
            }

            return(Respuesta);
        }
        /// <summary> Inserta una cuenta de ahorro a futuro. </summary>
        /// <param name="tobjIngreso"> Un objeto del tipo ingreso. </param>
        /// <returns> Un string que indica si se ejecuto o no la operación. </returns>
        public string gmtdInsertar(tblIngreso tobjIngreso)
        {
            if (tobjIngreso.ingresoAbonoaDeuda != null)
            {
                for (int a = 0; a < tobjIngreso.ingresoAbonoaDeuda.Count; a++)
                {
                    tobjIngreso.ingresoAbonoaDeuda[a].strCodigoPar = new blDeudas().gmtdConsultar(tobjIngreso.ingresoAbonoaDeuda[a].intCodDeu).strCodigoPar;
                }
            }

            if (tobjIngreso.ingresoAbonoaPrestamo != null)
            {
                tobjIngreso.ingresoAbonoaPrestamo.strCodigoPar = new blCreditos().gmtdConsultar(tobjIngreso.ingresoAbonoaPrestamo.intCodigoCre).strCodigoPar;
            }

            if (tobjIngreso.ingresoAbonoaVenta != null)
            {
                tobjIngreso.ingresoAbonoaVenta.strCodigoPar = new blVentas().gmtdConsultar(tobjIngreso.ingresoAbonoaVenta.intCodVenta).strNombreCliente;
            }

            if (tobjIngreso.ingresoAhorro != null)
            {
                tobjIngreso.ingresoAhorro.strCodigoPar = "0001";
            }

            if (tobjIngreso.ingresoAhorroaFuturo != null)
            {
                for (int a = 0; a < tobjIngreso.ingresoAhorroaFuturo.Count; a++)
                {
                    tobjIngreso.ingresoAhorroaFuturo[a].strCodigoPar = "0001";
                }
            }

            if (tobjIngreso.ingresoAhorroCdt != null)
            {
                tobjIngreso.ingresoAhorro.strCodigoPar = "0001";
            }

            if (tobjIngreso.ingresoAhorroEstudiantil != null)
            {
                tobjIngreso.ingresoAhorroEstudiantil.strCodigoPar = "0001";
            }

            if (tobjIngreso.ingresoAhorroFijo != null)
            {
                tobjIngreso.ingresoAhorroFijo.strCodigoPar = "0001";
            }

            if (tobjIngreso.ingresoAhorroNavideño != null)
            {
                for (int a = 0; a < tobjIngreso.ingresoAhorroNavideño.Count; a++)
                {
                    tobjIngreso.ingresoAhorroNavideño[a].strCodigoPar = "0001";
                }
            }

            if (tobjIngreso.ingresoCuota != null)
            {
                tobjIngreso.ingresoCuota.strCodigoPar = new blPrimarios().gmtdConsultar(tobjIngreso.ingresoCuota.strCodServiciop).strCodigoPar;

                tobjIngreso.ingresoCuota.fechasCuotas = new List <tblSociosPagosCuota>();

                char[] delimitador = { ',' };

                string[] vector = tobjIngreso.ingresoCuota.strMeses.Split(delimitador);

                for (int b = 0; b < vector.Length; b++)
                {
                    int intMes = this.calcularNumeroMes(vector[b].ToString());

                    tblSociosPagosCuota objSocioPagoCuota = new tblSociosPagosCuota();
                    objSocioPagoCuota.dtmFechaPag  = tobjIngreso.dtmFechaRec;
                    objSocioPagoCuota.intAño       = tobjIngreso.ingresoCuota.intAño;
                    objSocioPagoCuota.intCodigoIng = 0;
                    objSocioPagoCuota.intMes       = intMes;
                    objSocioPagoCuota.intSocio     = tobjIngreso.ingresoCuota.intCodigoSoc;

                    tobjIngreso.ingresoCuota.fechasCuotas.Add(objSocioPagoCuota);
                }
            }

            if (tobjIngreso.ingresoOtrosIngresos != null)
            {
                for (int a = 0; a < tobjIngreso.ingresoOtrosIngresos.Count; a++)
                {
                    tobjIngreso.ingresoOtrosIngresos[a].strCodigoPar = new blOtroIngreso().gmtdConsultar(tobjIngreso.ingresoOtrosIngresos[a].strCodOtrosIngresos).strCodigoPar;
                }
            }

            if (tobjIngreso.ingresoPrestamo != null)
            {
                for (int a = 0; a < tobjIngreso.ingresoPrestamo.Count; a++)
                {
                    tobjIngreso.ingresoPrestamo[a].strParCapital = new blCreditosLinea().gmtdConsultar(new blCreditos().gmtdConsultar(tobjIngreso.ingresoPrestamo[a].intCodigoPre).strCodLineadeCredito).strParCapital;
                    tobjIngreso.ingresoPrestamo[a].strParInteres = new blCreditosLinea().gmtdConsultar(new blCreditos().gmtdConsultar(tobjIngreso.ingresoPrestamo[a].intCodigoPre).strCodLineadeCredito).strParInteres;
                    tobjIngreso.ingresoPrestamo[a].strParMora    = new blCreditosLinea().gmtdConsultar(new blCreditos().gmtdConsultar(tobjIngreso.ingresoPrestamo[a].intCodigoPre).strCodLineadeCredito).strParMora;
                }
            }

            if (tobjIngreso.ingresoAbonoaPrestamo != null)
            {
                tobjIngreso.ingresoAbonoaPrestamo.bitDeducirAbonodelMonto = (bool)new blConfiguracion().gmtdConsultaConfiguracion().bitDeducirAbonosdelMontodelPrestamo;
            }

            XmlDocument xml = blRecibosIngresos.SerializeServicio(tobjIngreso);

            string strRetorno = new daoRecibosIngresos().gmtdInsertar(xml);

            if (strRetorno == "0")
            {
                return("- Ha ocurrido un error al registrar el ingreso.");
            }
            else
            {
                return(strRetorno + "+Ingreso ingresado.");
            }

            if (tobjIngreso.ingresoCuota != null)
            {
                int tintAño = new blConfiguracion().gmtdConsultaConfiguracion().intAnoEvaluado;
                int tintMes = new blConfiguracion().gmtdConsultaConfiguracion().intMesEvaluado;

                this.gmtdIngresarNumeroRifa(tobjIngreso.ingresoCuota.intCodigoSoc, tintAño, tintMes);
            }

            return(strRetorno);
        }