Esempio n. 1
0
        public RenovacionBE getRenovacion(string idRenovacion)
        {
            RenovacionBE oRenovacionBE = null;
            IDataReader  dr            = null;

            try
            {
                using (DbCommand cmd = dbAdeudosInversiones.GetStoredProcCommand(GetNameStoreProcedure.uspGetRenovacion))
                {
                    //cmd.CommandTimeout = 0;
                    dbAdeudosInversiones.AddInParameter(cmd, "idRenovacion", DbType.String, idRenovacion);

                    dr = dbAdeudosInversiones.ExecuteReader(cmd);

                    while (dr.Read())
                    {
                        oRenovacionBE = RenovacionP.getRenovacion(dr);
                    }
                }
            }
            catch (Exception)
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                throw;
            }

            return(oRenovacionBE);
        }
Esempio n. 2
0
        public List <RenovacionBE> listRenovacion(RenovacionBE pRenovacionBE)
        {
            List <RenovacionBE> lstRenovacionBE = new List <RenovacionBE>();
            IDataReader         dr = null;

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

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

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

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

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

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

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

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

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

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

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

                    if (pRenovacionBE.idTipoRenovacion > 0)
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoRenovacion", DbType.String, pRenovacionBE.idTipoRenovacion);
                    }
                    else
                    {
                        dbAdeudosInversiones.AddInParameter(cmd, "idTipoRenovacion", DbType.String, DBNull.Value);
                    }

                    dr = dbAdeudosInversiones.ExecuteReader(cmd);

                    while (dr.Read())
                    {
                        lstRenovacionBE.Add(RenovacionP.getRenovacion(dr));
                    }
                }
            }
            catch (Exception)
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                throw;
            }

            return(lstRenovacionBE);
        }