Example #1
0
        public AdeudoBE getAdeudo(string idAdeudo, DateTime fechaGlobal)
        {
            AdeudoBE    oAdeudoBE = null;
            IDataReader dr        = null;

            try
            {
                using (DbCommand cmd = dbAdeudosInversiones.GetStoredProcCommand(GetNameStoreProcedure.uspGetAdeudo))
                {
                    //cmd.CommandTimeout = 0;
                    dbAdeudosInversiones.AddInParameter(cmd, "idAdeudo", DbType.String, idAdeudo);
                    dbAdeudosInversiones.AddInParameter(cmd, "fechaGlobal", DbType.DateTime, fechaGlobal);

                    dr = dbAdeudosInversiones.ExecuteReader(cmd);

                    while (dr.Read())
                    {
                        oAdeudoBE = AdeudoP.getAdeudo(dr);
                    }
                }
            }
            catch (Exception)
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                throw;
            }

            return(oAdeudoBE);
        }
Example #2
0
        public List <CarteraExportBE> exportCartera(int pAnio, int pMes)
        {
            List <CarteraExportBE> lstAdeudoBE = new List <CarteraExportBE>();
            IDataReader            dr          = null;

            try
            {
                using (DbCommand cmd = dbAdeudosInversiones.GetStoredProcCommand(GetNameStoreProcedure.uspGetCartera))
                {
                    //cmd.CommandTimeout = 0;
                    dbAdeudosInversiones.AddInParameter(cmd, "anio", DbType.String, pAnio);
                    dbAdeudosInversiones.AddInParameter(cmd, "mes", DbType.String, pMes);

                    dr = dbAdeudosInversiones.ExecuteReader(cmd);

                    while (dr.Read())
                    {
                        lstAdeudoBE.Add(AdeudoP.getCarteraExport(dr));
                    }
                }
            }
            catch (Exception)
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                throw;
            }

            return(lstAdeudoBE);
        }
Example #3
0
        public List <AdeudoBE> listAdeudo(AdeudoBE pAdeudoBE)
        {
            List <AdeudoBE> lstAdeudoBE = new List <AdeudoBE>();
            IDataReader     dr          = null;

            try
            {
                using (DbCommand cmd = dbAdeudosInversiones.GetStoredProcCommand(GetNameStoreProcedure.uspListAdeudo))
                {
                    //cmd.CommandTimeout = 0;

                    if (!string.IsNullOrEmpty(pAdeudoBE.idAdeudo))
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idAdeudo", DbType.String, pAdeudoBE.idAdeudo);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idAdeudo", DbType.String, DBNull.Value);
                    }

                    if (!string.IsNullOrEmpty(pAdeudoBE.idTipoAdeudo))
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoAdeudo", DbType.String, pAdeudoBE.idTipoAdeudo);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoAdeudo", DbType.String, DBNull.Value);
                    }

                    if (pAdeudoBE.idTipoEntidadFinanciera != 0)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoEntidadFinanciera", DbType.Int32, pAdeudoBE.idTipoEntidadFinanciera);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoEntidadFinanciera", DbType.Int32, DBNull.Value);
                    }

                    if (!string.IsNullOrEmpty(pAdeudoBE.idEntidadFinanciera))
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idEntidadFinanciera", DbType.String, pAdeudoBE.idEntidadFinanciera);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idEntidadFinanciera", DbType.String, DBNull.Value);
                    }

                    if (pAdeudoBE.idMoneda != 0)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idMoneda", DbType.Int32, pAdeudoBE.idMoneda);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idMoneda", DbType.Int32, DBNull.Value);
                    }

                    if (pAdeudoBE.iniciofechaInicio != DateTime.MinValue)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "iniciofechaInicio", DbType.DateTime, pAdeudoBE.iniciofechaInicio);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "iniciofechaInicio", DbType.DateTime, DBNull.Value);
                    }

                    if (pAdeudoBE.finfechaInicio != DateTime.MinValue)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "finfechaInicio", DbType.DateTime, pAdeudoBE.finfechaInicio);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "finfechaInicio", DbType.DateTime, DBNull.Value);
                    }

                    if (pAdeudoBE.iniciofechaVencimiento != DateTime.MinValue)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "iniciofechaVencimiento", DbType.DateTime, pAdeudoBE.iniciofechaVencimiento);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "iniciofechaVencimiento", DbType.DateTime, DBNull.Value);
                    }

                    if (pAdeudoBE.finfechaVencimiento != DateTime.MinValue)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "finfechaVencimiento", DbType.DateTime, pAdeudoBE.finfechaVencimiento);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "finfechaVencimiento", DbType.DateTime, DBNull.Value);
                    }

                    if (!string.IsNullOrEmpty(pAdeudoBE.idEstado))
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idEstado", DbType.String, pAdeudoBE.idEstado);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idEstado", DbType.String, DBNull.Value);
                    }

                    if (pAdeudoBE.fechaGlobal != DateTime.MinValue)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "fechaGlobal", DbType.DateTime, pAdeudoBE.fechaGlobal);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "fechaGlobal", DbType.DateTime, DBNull.Value);
                    }

                    dr = dbAdeudosInversiones.ExecuteReader(cmd);

                    while (dr.Read())
                    {
                        lstAdeudoBE.Add(AdeudoP.getAdeudo(dr));
                    }
                }
            }
            catch (Exception)
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                throw;
            }

            return(lstAdeudoBE);
        }