예제 #1
0
        public MessageAttachment attachToMessage(MessageAttachment attachment, Message message)
        {
            try
            {
                _cxn.beginTransaction();

                if (attachment.Id > 0)
                {
                    attachment = updateAttachment(attachment); // could simply rely on updateAttachment function but thought this might add a level of convenience
                }
                else if (attachment.Id <= 0)
                {
                    // create attachment
                    attachment = createAttachment(attachment.AttachmentName, attachment.SmFile, attachment.MimeType);
                    // update message - set attachment ID properties
                    message = updateMessageAttachmentFields(message, attachment.Id);
                }

                _cxn.commitTransaction();
                return(attachment);
            }
            catch (Exception)
            {
                _cxn.rollbackTransaction();
                throw;
            }
        }
예제 #2
0
        /// <remarks>
        /// This function retrieves the message ID from the row that is updated. It does this so as not to put the burden
        /// on the consuming client application to pass the message ID value. This should make it less confusing which identifier
        /// is which and therefore the service easier to consume
        /// </remarks>
        /// <summary>
        /// Mark a message as read in the Addressee table. Set the ReadDate property to current timestamp toggle the date on. Or,
        /// set the ReadDate property to a new DateTime() - year of 1 - to toggle the read date off
        /// </summary>
        /// <param name="addressee"></param>
        /// <returns></returns>
        public Addressee readMessage(Addressee addressee)
        {
            _cxn.beginTransaction();

            try
            {
                OracleQuery query       = buildReadMessageRequest(addressee);
                nonQuery    insertQuery = delegate() { return(query.Command.ExecuteNonQuery()); };
                if ((Int32)_cxn.query(query, insertQuery) != 1)
                {
                    throw new mdo.exceptions.MdoException("Unable to mark message as read");
                }

                Int32 msgId = ((Oracle.DataAccess.Types.OracleDecimal)query.Command.Parameters["outId"].Value).ToInt32();
                addressee.Oplock++;

                SecureMessageDao msgDao = new SecureMessageDao(_cxn);
                addressee.Message = msgDao.getSecureMessageBody(msgId);

                _cxn.commitTransaction();

                // TBD - any business rules around SECURE_MESSAGE.READ_RECEIPT and marking a message as read?
                return(addressee);
            }
            catch (Exception)
            {
                _cxn.rollbackTransaction();
                throw;
            }
        }
예제 #3
0
        /// <remarks>
        /// This function retrieves the message ID from the row that is updated. It does this so as not to put the burden
        /// on the consuming client application to pass the message ID value. This should make it less confusing which identifier
        /// is which and therefore the service easier to consume
        /// </remarks>
        /// <summary>
        /// Mark a message as read in the Addressee table. Set the ReadDate property to current timestamp toggle the date on. Or,
        /// set the ReadDate property to a new DateTime() - year of 1 - to toggle the read date off
        /// </summary>
        /// <param name="addressee"></param>
        /// <returns></returns>
        public Addressee readMessage(Addressee addressee)
        {
            _cxn.beginTransaction();

            try
            {
                Addressee original = getAddressee(addressee.Id);

                OracleQuery query       = buildReadMessageRequest(addressee);
                nonQuery    insertQuery = delegate() { return(query.Command.ExecuteNonQuery()); };
                if ((Int32)_cxn.query(query, insertQuery) != 1)
                {
                    throw new mdo.exceptions.MdoException("Unable to mark message as read");
                }

                Int32 msgId = ((Oracle.DataAccess.Types.OracleDecimal)query.Command.Parameters["outId"].Value).ToInt32();
                addressee.Oplock++;

                new MessageActivityDao(_cxn).createMessageActivity(
                    new MessageActivity()
                {
                    Action        = domain.sm.enums.ActivityEnum.MDWS_MESSAGE_READ,
                    Detail        = "MOBILE_APPS_ENTRY^MessageRead",
                    MessageId     = msgId,
                    PerformerType = domain.sm.enums.UserTypeEnum.PATIENT,
                    UserId        = original.Owner.Id
                });

                SecureMessageDao msgDao = new SecureMessageDao(_cxn);
                addressee.Message = msgDao.getSecureMessageBody(msgId);

                _cxn.commitTransaction();

                // TBD - any business rules around SECURE_MESSAGE.READ_RECEIPT and marking a message as read?
                return(addressee);
            }
            catch (Exception)
            {
                _cxn.rollbackTransaction();
                throw;
            }
        }