/// <summary>
        /// Loads the responses for recipient.
        /// </summary>
        /// <param name="recipientPersonAliasId">The recipient person alias identifier.</param>
        /// <returns></returns>
        private string LoadResponsesForRecipient(int recipientPersonAliasId)
        {
            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return(string.Empty);
            }

            var communicationResponseService = new CommunicationResponseService(new RockContext());
            List <CommunicationRecipientResponse> responses = communicationResponseService.GetCommunicationConversation(recipientPersonAliasId, smsPhoneDefinedValueId.Value);

            BindConversationRepeater(responses);

            if (responses.Any())
            {
                var responseListItem = responses.Last();

                if (responseListItem.SMSMessage.IsNullOrWhiteSpace() && responseListItem.BinaryFileGuids != null && responseListItem.BinaryFileGuids.Any())
                {
                    return("Rock-Image-File");
                }

                return(responses.Last().SMSMessage);
            }

            return(string.Empty);
        }
        /// <summary>
        /// Loads the responses for recipient.
        /// </summary>
        /// <param name="recipientId">The recipient identifier.</param>
        /// <returns></returns>
        private string LoadResponsesForRecipient(int recipientId)
        {
            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return(string.Empty);
            }

            var communicationResponseService = new CommunicationResponseService(new RockContext());
            var responses = communicationResponseService.GetConversation(recipientId, smsPhoneDefinedValueId.Value);

            BindConversationRepeater(responses);

            var list = responses.Tables[0].AsEnumerable();

            if (list != null && list.Count() > 0)
            {
                DataRow row = list.Last();
                return(row["SMSMessage"].ToString());
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates the CommunicationResponse for Rock SMS Conversations
        /// </summary>
        /// <param name="fromPerson">From person.</param>
        /// <param name="messageKey">The message key.</param>
        /// <param name="toPersonAliasId">To person alias identifier.</param>
        /// <param name="message">The message.</param>
        /// <param name="rockSmsFromPhoneDv">From phone.</param>
        /// <param name="responseCode">The response code.</param>
        /// <param name="rockContext">The rock context.</param>
        private void CreateCommunicationResponse(Person fromPerson, string messageKey, int?toPersonAliasId, string message, DefinedValueCache rockSmsFromPhoneDv, string responseCode, Rock.Data.RockContext rockContext)
        {
            var smsMedium       = EntityTypeCache.Get(SystemGuid.EntityType.COMMUNICATION_MEDIUM_SMS);
            var smsTransport    = this.Transport.EntityType.Id;
            int?communicationId = null;

            if (fromPerson != null)
            {
                communicationId = GetCommunicationId(rockSmsFromPhoneDv, fromPerson.PrimaryAliasId.Value, 2);
            }

            var communicationResponse = new CommunicationResponse
            {
                MessageKey                   = messageKey,
                FromPersonAliasId            = fromPerson?.PrimaryAliasId,
                ToPersonAliasId              = toPersonAliasId,
                IsRead                       = false,
                RelatedSmsFromDefinedValueId = rockSmsFromPhoneDv.Id,
                RelatedCommunicationId       = communicationId,
                RelatedTransportEntityTypeId = smsTransport,
                RelatedMediumEntityTypeId    = smsMedium.Id,
                Response                     = message
            };

            var communicationResposeService = new CommunicationResponseService(rockContext);

            communicationResposeService.Add(communicationResponse);
            rockContext.SaveChanges();
        }
        /// <summary>
        /// Loads the response listing.
        /// </summary>
        private void LoadResponseListing()
        {
            // NOTE: The FromPersonAliasId is the person who sent a text from a mobile device to Rock.
            // This person is also referred to as the Recipient because they are responding to a
            // communication from Rock. Restated the response is from the recipient of a communication.

            // This is the person lava field, we want to clear it because reloading this list will deselect the user.
            litSelectedRecipientDescription.Text = string.Empty;
            hfSelectedRecipientId.Value          = string.Empty;
            hfSelectedMessageKey.Value           = string.Empty;
            tbNewMessage.Visible = false;
            btnSend.Visible      = false;

            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return;
            }

            using (var rockContext = new RockContext())
            {
                var communicationResponseService = new CommunicationResponseService(rockContext);

                DataSet responses = null;
                int     months    = GetAttributeValue("ShowConversationsFromMonthsAgo").AsInteger();

                if (tglShowRead.Checked)
                {
                    responses = communicationResponseService.GetCommunicationsAndResponseRecipients(smsPhoneDefinedValueId.Value, months);
                }
                else
                {
                    // Since communications sent from Rock are always considered "Read" we don't need them included in the list if we are not showing "Read" messages.
                    responses = communicationResponseService.GetResponseRecipients(smsPhoneDefinedValueId.Value, false, months);
                }

                var responseListItems = responses.Tables[0].AsEnumerable()
                                        .Select(r => new ResponseListItem
                {
                    RecipientId              = r.Field <int?>("FromPersonAliasId"),
                    MessageKey               = r.Field <string>("MessageKey"),
                    FullName                 = r.Field <string>("FullName"),
                    CreatedDateTime          = r.Field <DateTime>("CreatedDateTime"),
                    HumanizedCreatedDateTime = HumanizeDateTime(r.Field <DateTime>("CreatedDateTime")),
                    SMSMessage               = r.Field <string>("SMSMessage"),
                    IsRead = r.Field <bool>("IsRead")
                })
                                        .ToList();

                // don't display conversations if we're rebinding the recipient list
                rptConversation.Visible = false;
                gRecipients.DataSource  = responseListItems;
                gRecipients.DataBind();
            }
        }
예제 #5
0
        /// <summary>
        /// Loads the responses for recipient.
        /// </summary>
        /// <param name="recipientPersonId">The recipient person identifier.</param>
        /// <returns></returns>
        private string LoadResponsesForRecipientPerson(int recipientPersonId)
        {
            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return(string.Empty);
            }

            try
            {
                var rockContext = new RockContext();
                rockContext.Database.CommandTimeout = GetAttributeValue(AttributeKey.DatabaseTimeoutSeconds).AsIntegerOrNull() ?? 180;
                var communicationResponseService = new CommunicationResponseService(rockContext);
                List <CommunicationRecipientResponse> responses = communicationResponseService.GetCommunicationConversationForPerson(recipientPersonId, smsPhoneDefinedValueId.Value);

                BindConversationRepeater(responses);

                if (responses.Any())
                {
                    var responseListItem = responses.Last();

                    if (responseListItem.SMSMessage.IsNullOrWhiteSpace() && responseListItem.HasAttachments(rockContext))
                    {
                        return("Rock-Image-File");
                    }

                    return(responses.Last().SMSMessage);
                }
            }
            catch (Exception ex)
            {
                this.LogException(ex);
                var sqlTimeoutException = ReportingHelper.FindSqlTimeoutException(ex);
                var errorBox            = nbError;

                if (sqlTimeoutException != null)
                {
                    nbError.NotificationBoxType = NotificationBoxType.Warning;
                    nbError.Text = "Unable to load SMS responses for recipient in a timely manner. You can try again or adjust the timeout setting of this block.";
                    return(string.Empty);
                }
                else
                {
                    errorBox.NotificationBoxType = NotificationBoxType.Danger;
                    nbError.Text     = "An error occurred when loading SMS responses for recipient";
                    errorBox.Details = ex.Message;
                    errorBox.Visible = true;
                    return(string.Empty);
                }
            }

            return(string.Empty);
        }
예제 #6
0
파일: Sms.cs 프로젝트: SparkDevNetwork/Rock
        /// <summary>
        /// Creates the CommunicationResponse for Rock SMS Conversations
        /// </summary>
        /// <param name="fromPerson">From person.</param>
        /// <param name="messageKey">The message key.</param>
        /// <param name="toPersonAliasId">To person alias identifier.</param>
        /// <param name="message">The message.</param>
        /// <param name="rockSmsFromPhoneDv">From phone.</param>
        /// <param name="responseCode">The response code.</param>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="attachments">The attachments.</param>
        /// <exception cref="System.Exception">Configuration Error. No SMS Transport Component is currently active.</exception>
        private void CreateCommunicationResponse(Person fromPerson, string messageKey, int?toPersonAliasId, string message, DefinedValueCache rockSmsFromPhoneDv, string responseCode, Rock.Data.RockContext rockContext, List <BinaryFile> attachments = null)
        {
            var smsMedium = EntityTypeCache.Get(SystemGuid.EntityType.COMMUNICATION_MEDIUM_SMS);

            if (this.Transport == null)
            {
                throw new Exception("Configuration Error. No SMS Transport Component is currently active.");
            }

            var smsTransport    = this.Transport.EntityType.Id;
            int?communicationId = null;

            if (fromPerson != null)
            {
                communicationId = GetCommunicationId(rockSmsFromPhoneDv, fromPerson.PrimaryAliasId.Value, 2);
            }

            var communicationResponse = new CommunicationResponse
            {
                MessageKey                   = messageKey,
                FromPersonAliasId            = fromPerson?.PrimaryAliasId,
                ToPersonAliasId              = toPersonAliasId,
                IsRead                       = false,
                RelatedSmsFromDefinedValueId = rockSmsFromPhoneDv.Id,
                RelatedCommunicationId       = communicationId,
                RelatedTransportEntityTypeId = smsTransport,
                RelatedMediumEntityTypeId    = smsMedium.Id,
                Response                     = message
            };

            var communicationResposeService = new CommunicationResponseService(rockContext);

            communicationResposeService.Add(communicationResponse);
            rockContext.SaveChanges();

            // Now that we have a communication response ID we can add the attachments
            if (attachments != null && attachments.Any())
            {
                foreach (var attachment in attachments)
                {
                    communicationResponse.Attachments.Add(
                        new CommunicationResponseAttachment
                    {
                        BinaryFileId            = attachment.Id,
                        CommunicationResponseId = communicationResponse.Id,
                        CommunicationType       = CommunicationType.SMS
                    }
                        );
                }

                rockContext.SaveChanges();
            }
        }
예제 #7
0
        public void RemoveCommunicationModuleTestData()
        {
            // Remove all Communications
            var dataContext = new RockContext();

            var communicationService = new CommunicationService(dataContext);

            var communicationsQuery = communicationService.Queryable();

            communicationsQuery = communicationsQuery.Where(x => x.ForeignKey == _TestDataSourceOfChange);

            communicationService.DeleteRange(communicationsQuery);

            var communicationResponseService = new CommunicationResponseService(dataContext);
            var communicationResponseQuery   = communicationResponseService.Queryable();

            communicationResponseQuery = communicationResponseQuery.Where(x => x.ForeignKey == _TestDataSourceOfChange);

            communicationResponseService.DeleteRange(communicationResponseQuery);

            var recordsAffected = dataContext.SaveChanges();

            Debug.Print($"Deleted Communications and Responses. (Count={ recordsAffected })");

            // Remove SMS Sender
            var definedValueService = new DefinedValueService(dataContext);

            var smsSender = definedValueService.Get(Constants.TestSmsSenderGuid.AsGuid());

            if (smsSender != null)
            {
                var communicationQuery = communicationService.Queryable()
                                         .Where(x => x.SMSFromDefinedValueId == smsSender.Id);

                communicationService.DeleteRange(communicationQuery);

                definedValueService.Delete(smsSender);
            }

            dataContext.SaveChanges();

            // Remove Nameless Person records.
            this.DeleteNamelessPersonRecord(dataContext, Constants.NamelessPerson1MobileNumber);
            this.DeleteNamelessPersonRecord(dataContext, Constants.NamelessPerson2MobileNumber);

            dataContext.SaveChanges();
        }
예제 #8
0
        /// <summary>
        /// Loads the responses for recipient.
        /// </summary>
        /// <param name="messageKey">The message key.</param>
        /// <returns></returns>
        private string LoadResponsesForRecipient(string messageKey)
        {
            int?smsPhoneDefinedValueId = ddlSmsNumbers.SelectedValue.AsIntegerOrNull();

            if (smsPhoneDefinedValueId == null)
            {
                return(string.Empty);
            }

            var communicationResponseService = new CommunicationResponseService(new RockContext());
            var responses = communicationResponseService.GetConversation(messageKey, smsPhoneDefinedValueId.Value);

            BindConversationRepeater(responses);

            DataRow row = responses.Tables[0].AsEnumerable().Last();

            return(row["SMSMessage"].ToString());
        }
        /// <summary>
        /// Loads the response listing.
        /// </summary>
        private void LoadResponseListing(int?personId)
        {
            // NOTE: The FromPersonAliasId is the person who sent a text from a mobile device to Rock.
            // This person is also referred to as the Recipient because they are responding to a
            // communication from Rock. Restated the response is from the recipient of a communication.

            // This is the person lava field, we want to clear it because reloading this list will deselect the user.
            litSelectedRecipientDescription.Text   = string.Empty;
            hfSelectedRecipientPersonAliasId.Value = string.Empty;
            hfSelectedMessageKey.Value             = string.Empty;
            tbNewMessage.Visible      = false;
            btnSend.Visible           = false;
            btnEditNote.Visible       = false;
            lbShowImagePicker.Visible = false;
            noteEditor.Visible        = false;

            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return;
            }

            using (var rockContext = new RockContext())
            {
                var communicationResponseService = new CommunicationResponseService(rockContext);

                int months = GetAttributeValue(AttributeKey.ShowConversationsFromMonthsAgo).AsInteger();

                var  startDateTime = RockDateTime.Now.AddMonths(-months);
                bool showRead      = tglShowRead.Checked;

                var maxConversations = this.GetAttributeValue(AttributeKey.MaxConversations).AsIntegerOrNull() ?? 1000;

                var responseListItems = communicationResponseService.GetCommunicationResponseRecipients(smsPhoneDefinedValueId.Value, startDateTime, showRead, maxConversations, personId);

                // don't display conversations if we're rebinding the recipient list
                rptConversation.Visible = false;
                gRecipients.DataSource  = responseListItems;
                gRecipients.DataBind();
            }
        }
예제 #10
0
        /// <summary>
        /// Loads the responses for recipient.
        /// </summary>
        /// <param name="recipientPersonAliasId">The recipient person alias identifier.</param>
        /// <returns></returns>
        private string LoadResponsesForRecipient(int recipientPersonAliasId)
        {
            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return(string.Empty);
            }

            var communicationResponseService = new CommunicationResponseService(new RockContext());
            List <CommunicationRecipientResponse> responses = communicationResponseService.GetCommunicationConversation(recipientPersonAliasId, smsPhoneDefinedValueId.Value);

            BindConversationRepeater(responses);

            if (responses.Any())
            {
                return(responses.Last().SMSMessage);
            }

            return(string.Empty);
        }
예제 #11
0
        /// <summary>
        /// Loads the response listing.
        /// </summary>
        private void LoadResponseListing(int?personId)
        {
            // NOTE: The FromPersonAliasId is the person who sent a text from a mobile device to Rock.
            // This person is also referred to as the Recipient because they are responding to a
            // communication from Rock. Restated the response is from the recipient of a communication.

            // This is the person lava field, we want to clear it because reloading this list will deselect the user.
            litSelectedRecipientDescription.Text   = string.Empty;
            hfSelectedRecipientPersonAliasId.Value = string.Empty;
            hfSelectedMessageKey.Value             = string.Empty;
            tbNewMessage.Visible      = false;
            btnSend.Visible           = false;
            btnEditNote.Visible       = false;
            lbShowImagePicker.Visible = false;
            noteEditor.Visible        = false;

            int?smsPhoneDefinedValueId = hfSmsNumber.ValueAsInt();

            if (smsPhoneDefinedValueId == default(int))
            {
                return;
            }

            try
            {
                using (var rockContext = new RockContext())
                {
                    rockContext.Database.CommandTimeout = GetAttributeValue(AttributeKey.DatabaseTimeoutSeconds).AsIntegerOrNull() ?? 180;

                    var communicationResponseService = new CommunicationResponseService(rockContext);

                    int months = GetAttributeValue(AttributeKey.ShowConversationsFromMonthsAgo).AsInteger();

                    var  startDateTime = RockDateTime.Now.AddMonths(-months);
                    bool showRead      = tglShowRead.Checked;

                    var maxConversations = this.GetAttributeValue(AttributeKey.MaxConversations).AsIntegerOrNull() ?? 1000;

                    var responseListItems = communicationResponseService.GetCommunicationResponseRecipients(smsPhoneDefinedValueId.Value, startDateTime, showRead, maxConversations, personId);

                    // don't display conversations if we're rebinding the recipient list
                    rptConversation.Visible = false;
                    gRecipients.DataSource  = responseListItems;
                    gRecipients.DataBind();
                }
            }
            catch (Exception ex)
            {
                this.LogException(ex);
                var sqlTimeoutException = ReportingHelper.FindSqlTimeoutException(ex);
                if (sqlTimeoutException != null)
                {
                    nbError.NotificationBoxType = NotificationBoxType.Warning;
                    nbError.Text    = "Unable to load SMS responses in a timely manner. You can try again or adjust the timeout setting of this block.";
                    nbError.Visible = true;
                    return;
                }
                else
                {
                    nbError.NotificationBoxType = NotificationBoxType.Danger;
                    nbError.Text    = "An error occurred when loading SMS responses";
                    nbError.Details = ex.Message;
                    nbError.Visible = true;
                    return;
                }
            }
        }
예제 #12
0
        public void AddNamelessSmsConversation()
        {
            var smsMediumEntityTypeId    = EntityTypeCache.GetId(SystemGuid.EntityType.COMMUNICATION_MEDIUM_SMS.AsGuid()).Value;
            var smsTransportEntityTypeId = EntityTypeCache.GetId(Constants.TestTwilioTransportEntityTypeGuid.AsGuid()).Value;

            var dataContext = new RockContext();

            var responseCode = Rock.Communication.Medium.Sms.GenerateResponseCode(dataContext);

            // Create a new Communication
            var adminPerson = this.GetAdminPersonOrThrow(dataContext);

            var personService = new PersonService(dataContext);

            var namelessPerson1 = personService.GetPersonFromMobilePhoneNumber(Constants.NamelessPerson1MobileNumber, createNamelessPersonIfNotFound: true);

            dataContext.SaveChanges();

            var smsSender = DefinedValueCache.Get(Constants.TestSmsSenderGuid.AsGuid());

            var communicationService         = new CommunicationService(dataContext);
            var communicationResponseService = new CommunicationResponseService(dataContext);

            // From Admin: Initial Message
            Rock.Model.Communication communication;

            var conversationStartDateTime = RockDateTime.Now;

            var message = "If you'd like to attend our Family Movie Night Tea this coming Saturday, please reply to let us know how many people will be attending with you.";

            communication = communicationService.CreateSMSCommunication(adminPerson, namelessPerson1.PrimaryAliasId, message, smsSender, responseCode, "From: " + adminPerson.FullName);

            communication.Recipients.ToList().ForEach(r =>
            {
                r.Status          = CommunicationRecipientStatus.Delivered;
                r.CreatedDateTime = conversationStartDateTime;
                r.ForeignKey      = _TestDataSourceOfChange;
            });

            communication.ForeignKey      = _TestDataSourceOfChange;
            communication.CreatedDateTime = conversationStartDateTime;

            // From Nameless: Reply #1
            message = "We will be there! 2 adults, 2 kids. Do we need to bring chairs?";
            communicationResponseService.Add(new CommunicationResponse
            {
                ForeignKey      = _TestDataSourceOfChange,
                CreatedDateTime = conversationStartDateTime.AddMinutes(2),
                RelatedTransportEntityTypeId = smsTransportEntityTypeId,
                RelatedMediumEntityTypeId    = smsMediumEntityTypeId,
                RelatedSmsFromDefinedValueId = smsSender.Id,
                ToPersonAliasId   = adminPerson.PrimaryAliasId,
                Response          = message,
                IsRead            = false,
                FromPersonAliasId = namelessPerson1.PrimaryAliasId,
                MessageKey        = Constants.NamelessPerson1MobileNumber
            });

            // From Admin: Response #1
            message       = "No need to bring anything extra - just yourselves!";
            communication = communicationService.CreateSMSCommunication(adminPerson, namelessPerson1.PrimaryAliasId, message, smsSender, responseCode, "From: " + adminPerson.FullName);
            communication.Recipients.ToList().ForEach(r =>
            {
                r.Status          = CommunicationRecipientStatus.Delivered;
                r.CreatedDateTime = conversationStartDateTime.AddMinutes(3);
                r.ForeignKey      = _TestDataSourceOfChange;
            });

            communication.ForeignKey      = _TestDataSourceOfChange;
            communication.CreatedDateTime = conversationStartDateTime.AddMinutes(3);

            // From Nameless: Reply #2
            message = "Ok, thanks. What movie is showing?";
            communicationResponseService.Add(new CommunicationResponse
            {
                ForeignKey      = _TestDataSourceOfChange,
                CreatedDateTime = conversationStartDateTime.AddMinutes(4),
                RelatedTransportEntityTypeId = smsTransportEntityTypeId,
                RelatedMediumEntityTypeId    = smsMediumEntityTypeId,
                RelatedSmsFromDefinedValueId = smsSender.Id,
                ToPersonAliasId   = adminPerson.PrimaryAliasId,
                Response          = message,
                IsRead            = false,
                FromPersonAliasId = namelessPerson1.PrimaryAliasId,
                MessageKey        = Constants.NamelessPerson1MobileNumber
            });

            // From Admin: Response #2
            message       = "We'll be screening Star Wars: Episode 1.";
            communication = communicationService.CreateSMSCommunication(adminPerson, namelessPerson1.PrimaryAliasId, message, smsSender, responseCode, "From: " + adminPerson.FullName);
            communication.Recipients.ToList().ForEach(r =>
            {
                r.Status          = CommunicationRecipientStatus.Delivered;
                r.CreatedDateTime = conversationStartDateTime.AddMinutes(5);
                r.ForeignKey      = _TestDataSourceOfChange;
            });

            communication.ForeignKey      = _TestDataSourceOfChange;
            communication.CreatedDateTime = conversationStartDateTime.AddMinutes(5);

            // From Nameless: Reply #3
            message = "Is that the one with Jar Jar Binks?";
            communicationResponseService.Add(new CommunicationResponse
            {
                ForeignKey      = _TestDataSourceOfChange,
                CreatedDateTime = conversationStartDateTime.AddMinutes(9),
                RelatedTransportEntityTypeId = smsTransportEntityTypeId,
                RelatedMediumEntityTypeId    = smsMediumEntityTypeId,
                RelatedSmsFromDefinedValueId = smsSender.Id,
                ToPersonAliasId   = adminPerson.PrimaryAliasId,
                Response          = message,
                IsRead            = false,
                FromPersonAliasId = namelessPerson1.PrimaryAliasId,
                MessageKey        = Constants.NamelessPerson1MobileNumber
            });

            // From Admin: Response #2
            message       = "Yep, that's the one!";
            communication = communicationService.CreateSMSCommunication(adminPerson, namelessPerson1.PrimaryAliasId, message, smsSender, responseCode, "From: " + adminPerson.FullName);
            communication.Recipients.ToList().ForEach(r =>
            {
                r.Status          = CommunicationRecipientStatus.Delivered;
                r.CreatedDateTime = conversationStartDateTime.AddMinutes(10);
                r.ForeignKey      = _TestDataSourceOfChange;
            });

            communication.ForeignKey      = _TestDataSourceOfChange;
            communication.CreatedDateTime = conversationStartDateTime.AddMinutes(10);
            // From Nameless: Reply #3
            message = "Right, I just remembered we may have some other plans, sorry...";
            communicationResponseService.Add(new CommunicationResponse
            {
                ForeignKey      = _TestDataSourceOfChange,
                CreatedDateTime = conversationStartDateTime.AddMinutes(12),
                RelatedTransportEntityTypeId = smsTransportEntityTypeId,
                RelatedMediumEntityTypeId    = smsMediumEntityTypeId,
                RelatedSmsFromDefinedValueId = smsSender.Id,
                ToPersonAliasId   = adminPerson.PrimaryAliasId,
                Response          = message,
                IsRead            = false,
                FromPersonAliasId = namelessPerson1.PrimaryAliasId,
                MessageKey        = Constants.NamelessPerson1MobileNumber
            });

            dataContext.SaveChanges();
        }