Exemplo n.º 1
0
        public static bool Insert(YouCom.DTO.Notificaciones.NotificacionDirectivaDTO myNotificacionDirectivaDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheCondominioDTO.IdCondominio);
                wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheComunidadDTO.IdComunidad);
                wobjSQLHelper.SetParametro("@pIdNotificacionAccion", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheNotificacionAccionDTO.IdNotificacionAccion);
                wobjSQLHelper.SetParametro("@pIdMensajeDirectiva", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheMensajeDirectivaDTO.IdMensajeDirectiva);
                wobjSQLHelper.SetParametro("@pIdPadre", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheMensajeDirectivaDTO.IdPadre);
                wobjSQLHelper.SetParametro("@pIdDirectiva", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheDirectivaDTO.IdDirectiva > 0 ? myNotificacionDirectivaDTO.TheDirectivaDTO.IdDirectiva : System.Data.SqlTypes.SqlDecimal.Null);
                wobjSQLHelper.SetParametro("@pIdFamilia", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheFamiliaDestinoDTO.IdFamilia > 0 ? myNotificacionDirectivaDTO.TheFamiliaDestinoDTO.IdFamilia : System.Data.SqlTypes.SqlDecimal.Null);
                wobjSQLHelper.SetParametro("@pFechaNotificacion", SqlDbType.DateTime, -1, myNotificacionDirectivaDTO.FechaNotificacion);
                wobjSQLHelper.SetParametro("@pVerNotificacion", SqlDbType.Char, 5, myNotificacionDirectivaDTO.VerNotificacion);
                wobjSQLHelper.SetParametro("@pUsuarioIngreso", SqlDbType.VarChar, 20, myNotificacionDirectivaDTO.UsuarioIngreso);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("INS_NotificacionDirectiva", "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);
        }
Exemplo n.º 2
0
        public static bool Update(YouCom.DTO.Notificaciones.NotificacionDirectivaDTO myNotificacionDirectivaDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdMensajeDirectiva", SqlDbType.Decimal, -1, myNotificacionDirectivaDTO.TheMensajeDirectivaDTO.IdMensajeDirectiva);
                wobjSQLHelper.SetParametro("@pVerNotificacion", SqlDbType.Char, 5, myNotificacionDirectivaDTO.VerNotificacion);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myNotificacionDirectivaDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_NotificacionDirectiva", "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.NotificacionDirectivaDTO> getListadoNotificaciones()
        {
            IList <YouCom.DTO.Notificaciones.NotificacionDirectivaDTO> INotificacionDirectiva = new List <YouCom.DTO.Notificaciones.NotificacionDirectivaDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.Mensajeria.DAL.Notificaciones.NotificacionPropietarioDAL.getListadoNotificaciones(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Notificaciones.NotificacionDirectivaDTO notificaciones = new YouCom.DTO.Notificaciones.NotificacionDirectivaDTO();

                    notificaciones.IdNotificacionDirectiva = decimal.Parse(wobjDataRow["IdNotificacionDirectiva"].ToString());

                    YouCom.DTO.Mensajeria.MensajeDirectivaDTO myMensajeDirectivaDTO = new DTO.Mensajeria.MensajeDirectivaDTO();
                    myMensajeDirectivaDTO.IdMensajeDirectiva = decimal.Parse(wobjDataRow["IdMensajeDirectiva"].ToString());
                    myMensajeDirectivaDTO.IdPadre            = decimal.Parse(wobjDataRow["IdPadre"].ToString());
                    myMensajeDirectivaDTO.MensajeDescripcion = wobjDataRow["mensajeDescripcion"].ToString();
                    myMensajeDirectivaDTO.MensajeTitulo      = wobjDataRow["mensajeTitulo"].ToString();
                    notificaciones.TheMensajeDirectivaDTO    = myMensajeDirectivaDTO;

                    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.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO();
                    myDirectivaDTO.IdDirectiva              = decimal.Parse(wobjDataRow["idDirectiva"].ToString());
                    myDirectivaDTO.NombreDirectiva          = wobjDataRow["nombreDirectiva"].ToString();
                    myDirectivaDTO.ApellidoPaternoDirectiva = wobjDataRow["apellidoPaternoDirectiva"].ToString();
                    myDirectivaDTO.ApellidoMaternoDirectiva = wobjDataRow["apellidoMaternoDirectiva"].ToString();
                    notificaciones.TheDirectivaDTO          = myDirectivaDTO;

                    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();

                    INotificacionDirectiva.Add(notificaciones);
                }
            }

            return(INotificacionDirectiva);
        }