public static List <EstadoReclamo> Traer_Proximos(int idEstado) { string sql = "EstadoReclamo_Proximo"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); DbParameterCollection dbParametros = null; db.AddInParameter(dbCommand, "@idEstado", DbType.Int32, idEstado); List <EstadoReclamo> ListEstado = new List <EstadoReclamo>(); EstadoReclamo oEst = null; try { dbParametros = dbCommand.Parameters; using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { oEst = new EstadoReclamo(); oEst.DescEstado = ds["DescEstado"].ToString(); oEst.IdEstado = int.Parse(ds["IdEstado"].ToString()); oEst.Control = ds.GetNullableString("Control"); oEst.ControlTexto = ds.GetNullableString("ControlTexto"); oEst.ControlIdModelo = ds.GetNullableInt32("ControlIdModelo") == null ? 0 : ds.GetInt32("ControlIdModelo"); oEst.EsFinal = ds.GetNullableBoolean("EsFinal") == null ? false : ds.GetBoolean("EsFinal"); oEst.FecManual = ds.GetNullableBoolean("FecManual") == null ? false : ds.GetBoolean("FecManual"); oEst.MensajeInfo = ds.GetNullableString("MensajeInfo"); oEst.EstadoAnme = ds.GetNullableInt32("EstadoAnme") == null ? 0 : ds.GetInt32("EstadoAnme"); oEst.PaseAutomatico = ds.GetNullableBoolean("PaseAutomatico") == null ? false : ds.GetBoolean("PaseAutomatico"); oEst.TieneObservacion = ds.GetNullableBoolean("TieneObservacion") == null ? false : ds.GetBoolean("TieneObservacion"); ListEstado.Add(oEst); } ds.Close(); ds.Dispose(); } return(ListEstado); } catch (Exception ex) { log.Error(string.Format("{0}->{1}->Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw new Exception("Error en EstadoDAO.Trae_Todos", ex); } finally { db = null; dbCommand.Dispose(); } }
public static List <Novedad> TraeCuotas(long idNovedad, long idPrestador) { List <Novedad> listNovedades = new List <Novedad>(); string sql = "Cuotas_Traer"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); try { db.AddInParameter(dbCommand, "@IdNovedad", DbType.Int64, idNovedad); db.AddInParameter(dbCommand, "@IdPrestador", DbType.String, idPrestador); using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { Novedad oNovedad = new Novedad(); oNovedad.IdNovedad = ds.GetInt64("idNovedad"); oNovedad.UnBeneficiario = new Beneficiario(long.Parse(ds.GetInt64("idBeneficiario").ToString()), 0, ds.GetString("apellidoNombre")); oNovedad.UnPrestador = new Prestador(); oNovedad.UnPrestador.ID = ds.GetInt64("idPrestador"); oNovedad.UnTipoConcepto = new TipoConcepto(byte.Parse(ds.GetValue("TipoConcepto").ToString()), ds.GetString("descTipoConcepto")); oNovedad.UnConceptoLiquidacion = new ConceptoLiquidacion(ds.GetInt32("codConceptoLiq"), ds.GetString("descConceptoLiq")); oNovedad.UnConceptoLiquidacion.CodSidif = ds.GetNullableInt32("codSidif"); oNovedad.UnConceptoLiquidacion.Obligatorio = ds.GetBoolean("obligatorio"); oNovedad.FechaNovedad = (ds.GetNullableDateTime("fecNov") == null ? new DateTime() : ds.GetDateTime("fecNov")); oNovedad.ImporteTotal = double.Parse(ds.GetValue("importeTotal").ToString()); oNovedad.CantidadCuotas = byte.Parse(ds.GetValue("cantCuotas").ToString()); //ds.GetInt16("nroCuota"); //ds.GetDouble("importeCuota"); oNovedad.FechaImportacion = ds.GetNullableDateTime("fecImportacionCuota"); //ds.GetInt32("mensualCuota"); //ds.GetInt32("importeLiq"); //ds.GetString("descEstadoNov"); //ds.GetInt32("idEstadoNov"); oNovedad.UnEstadoReg = new Estado(int.Parse(ds.GetValue("idEstadoReg").ToString()), ds.GetString("descripcionEstadoReg")); listNovedades.Add(oNovedad); } } return(listNovedades); } catch (Exception ex) { log.Error(string.Format("{0}->{1}-> Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw ex; } finally { db = null; dbCommand.Dispose(); } }