private void Fill(out Movimiento_Solicitud oObj, NullableDataReader dr) { Estado iEstado = new Estado(dr.GetInt32("cod_estado"), dr.GetString("descripcionEstado")); Sector iSector = new Sector(dr.GetInt32("cod_sector"), dr.GetString("descripcionSector")); oObj = new Movimiento_Solicitud(dr.GetDateTime("fecha_Movimiento") , iEstado , iSector , dr.GetNullableString("observaciones") == null ? "":dr.GetString("observaciones") ); }
public Movimiento_Solicitud TraeUltimoMovimientoSolicitud(Int64 idBeneficiario, Int16 codPrestacion) { Database db = DatabaseFactory.CreateDatabase("ConveniosInt_V02"); /* Definimos el nombre de la base que definimos en el Machine.config que luego se explicará. */ DbCommand dbCommand = db.GetStoredProcCommand("TraeUltimoMovimientoSolicitud"); Movimiento_Solicitud result = null; try { /* Se cargan los parámetros del store */ db.AddInParameter(dbCommand, "@id_Beneficiario", DbType.Int64, idBeneficiario); db.AddInParameter(dbCommand, "@cod_Prestacion", DbType.Int16, codPrestacion); db.AddOutParameter(dbCommand, "@codSector", DbType.Int32, 0); db.AddOutParameter(dbCommand, "@codEstado", DbType.Int32, 0); db.AddInParameter(dbCommand, "@modo", DbType.Byte, 1); /* Se ejecuta el store */ using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { /* Se llena el objeto con los datos del datareader */ this.Fill(out result, ds); } ds.Close(); //} /* Se recorre el datareader */ } } catch (Exception ex) { throw new Exception("Error en Consultas.Datos " + System.Reflection.MethodBase.GetCurrentMethod(), ex); } //catch(sql) finally { db = null; dbCommand.Dispose(); } /* Se retorna la lista convirtiendola en Array */ return(result); }
public void TraeUltimoEstadoYSectorSolicitud(Int64 idBeneficiario, Int16 codPrestacion, out Int32 codEstado, out Int32 codSector) { Database db = DatabaseFactory.CreateDatabase("ConveniosInt_V02"); /* Definimos el nombre de la base que definimos en el Machine.config que luego se explicará. */ DbCommand dbCommand = db.GetStoredProcCommand("TraeUltimoMovimientoSolicitud"); Movimiento_Solicitud result = null; try { using (TransactionScope oScope = new TransactionScope()) { /* Se cargan los parámetros del store */ db.AddInParameter(dbCommand, "@id_Beneficiario", DbType.Int64, idBeneficiario); db.AddInParameter(dbCommand, "@cod_Prestacion", DbType.Int16, codPrestacion); db.AddOutParameter(dbCommand, "@codSector", DbType.Int32, 0); db.AddOutParameter(dbCommand, "@codEstado", DbType.Int32, 0); db.AddOutParameter(dbCommand, "@modo", DbType.Byte, 2); /* Se ejecuta el store */ db.ExecuteNonQuery(dbCommand); codEstado = (Int32)db.GetParameterValue(dbCommand, "@codEstado"); codSector = (Int32)db.GetParameterValue(dbCommand, "@codSector"); } } catch (Exception ex) { throw new Exception("Error en Consultas.Datos " + System.Reflection.MethodBase.GetCurrentMethod(), ex); } //catch(sql) finally { db = null; dbCommand.Dispose(); } }
public Movimiento_Solicitud TraeUltimoMovimientoSolicitud(Int64 idBeneficiario, Int16 codPrestacion) { Movimiento_Solicitud oResult = null; ConsultasDatos objDao = new ConsultasDatos(); try { // Creo un Objeto Windows Identity para enviarle al thread asyncronico //(lo necesita para poder impersonar el thread nuevo) WindowsIdentity mThreadIdentity = WindowsIdentity.GetCurrent(); oResult = objDao.TraeUltimoMovimientoSolicitud(idBeneficiario, codPrestacion); } catch (Exception ex) { throw ex; } finally { objDao.Dispose(); } return(oResult); }