public static bool Insert(YouCom.DTO.Notificaciones.NotificacionPorteriaDTO myNotificacionPorteriaDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheCondominioDTO.IdCondominio); wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdNotificacionAccion", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheNotificacionAccionDTO.IdNotificacionAccion); wobjSQLHelper.SetParametro("@pIdMensajePorteria", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheMensajePorteriaDTO.IdMensajePorteria); wobjSQLHelper.SetParametro("@pIdPadre", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheMensajePorteriaDTO.IdPadre); wobjSQLHelper.SetParametro("@pIdPorteria", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.ThePorteriaDTO.IdPorteria > 0 ? myNotificacionPorteriaDTO.ThePorteriaDTO.IdPorteria : System.Data.SqlTypes.SqlDecimal.Null); wobjSQLHelper.SetParametro("@pIdFamilia", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheFamiliaDestinoDTO.IdFamilia > 0 ? myNotificacionPorteriaDTO.TheFamiliaDestinoDTO.IdFamilia : System.Data.SqlTypes.SqlDecimal.Null); wobjSQLHelper.SetParametro("@pFechaNotificacion", SqlDbType.DateTime, -1, myNotificacionPorteriaDTO.FechaNotificacion); wobjSQLHelper.SetParametro("@pVerNotificacion", SqlDbType.Char, 5, myNotificacionPorteriaDTO.VerNotificacion); wobjSQLHelper.SetParametro("@pUsuarioIngreso", SqlDbType.VarChar, 20, myNotificacionPorteriaDTO.UsuarioIngreso); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("INS_NotificacionPorteria", "YouCom")) { case 0: throw new Exception("No se pudo grabar."); case -1: throw new Exception("Hubo un error."); case -2: throw new Exception("Hubo un error."); } //==================================================================================== retorno = true; } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(retorno); }
public static bool Update(YouCom.DTO.Notificaciones.NotificacionPorteriaDTO myNotificacionPorteriaDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdMensajePorteria", SqlDbType.Decimal, -1, myNotificacionPorteriaDTO.TheMensajePorteriaDTO.IdMensajePorteria); wobjSQLHelper.SetParametro("@pVerNotificacion", SqlDbType.Char, 5, myNotificacionPorteriaDTO.VerNotificacion); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myNotificacionPorteriaDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_NotificacionPorteria", "YouCom")) { case 0: throw new Exception("No se pudo grabar."); case -1: throw new Exception("Hubo un error."); case -2: throw new Exception("Hubo un error."); } //==================================================================================== retorno = true; } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(retorno); }
public static IList<YouCom.DTO.Notificaciones.NotificacionPorteriaDTO> getListadoNotificaciones() { IList<YouCom.DTO.Notificaciones.NotificacionPorteriaDTO> INotificacionPorteria = new List<YouCom.DTO.Notificaciones.NotificacionPorteriaDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.Mensajeria.DAL.Notificaciones.NotificacionPropietarioDAL.getListadoNotificaciones(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.Notificaciones.NotificacionPorteriaDTO notificaciones = new YouCom.DTO.Notificaciones.NotificacionPorteriaDTO(); notificaciones.IdNotificacionPorteria = decimal.Parse(wobjDataRow["IdNotificacionPorteria"].ToString()); YouCom.DTO.Mensajeria.MensajePorteriaDTO myMensajePorteriaDTO = new DTO.Mensajeria.MensajePorteriaDTO(); myMensajePorteriaDTO.IdMensajePorteria = decimal.Parse(wobjDataRow["IdMensajePorteria"].ToString()); myMensajePorteriaDTO.IdPadre = decimal.Parse(wobjDataRow["IdPadre"].ToString()); myMensajePorteriaDTO.MensajeDescripcion = wobjDataRow["mensajeDescripcion"].ToString(); myMensajePorteriaDTO.MensajeTitulo = wobjDataRow["mensajeTitulo"].ToString(); notificaciones.TheMensajePorteriaDTO = myMensajePorteriaDTO; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); myCondominioDTO.NombreCondominio = wobjDataRow["nombreCondominio"].ToString(); notificaciones.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); myComunidadDTO.NombreComunidad = wobjDataRow["nombreComunidad"].ToString(); notificaciones.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Notificaciones.NotificacionAccionDTO myNotificacionAccionDTO = new YouCom.DTO.Notificaciones.NotificacionAccionDTO(); myNotificacionAccionDTO.IdNotificacionAccion = decimal.Parse(wobjDataRow["idNotificacionAccion"].ToString()); myNotificacionAccionDTO.NombreNotificacionAccion = wobjDataRow["nombreNotificacionAccion"].ToString(); notificaciones.TheNotificacionAccionDTO = myNotificacionAccionDTO; YouCom.DTO.PorteriaDTO myPorteriaDTO = new YouCom.DTO.PorteriaDTO(); myPorteriaDTO.IdPorteria = decimal.Parse(wobjDataRow["idPorteria"].ToString()); myPorteriaDTO.NombrePorteria = wobjDataRow["nombrePorteria"].ToString(); myPorteriaDTO.ApellidoPaternoPorteria = wobjDataRow["apellidoPaternoPorteria"].ToString(); myPorteriaDTO.ApellidoMaternoPorteria = wobjDataRow["apellidoMaternoPorteria"].ToString(); notificaciones.ThePorteriaDTO = myPorteriaDTO; if (!string.IsNullOrEmpty(wobjDataRow["idFamiliaDestino"].ToString())) { YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(wobjDataRow["idFamiliaDestino"].ToString()); myFamiliaDTO.NombreFamilia = wobjDataRow["nombreFamiliaDestino"].ToString(); myFamiliaDTO.ApellidoPaternoFamilia = wobjDataRow["apellidoPaternoFamiliaDestino"].ToString(); myFamiliaDTO.ApellidoMaternoFamilia = wobjDataRow["apellidoMaternoFamiliaDestino"].ToString(); notificaciones.TheFamiliaDestinoDTO = myFamiliaDTO; } notificaciones.FechaNotificacion = DateTime.Parse(wobjDataRow["fechaNotificacion"].ToString()); notificaciones.VerNotificacion = wobjDataRow["verNotificacion"].ToString(); notificaciones.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); notificaciones.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); notificaciones.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); notificaciones.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); notificaciones.Estado = wobjDataRow["estado"].ToString(); INotificacionPorteria.Add(notificaciones); } } return INotificacionPorteria; }