Beispiel #1
0
 /// <summary>
 /// To update status of entitycachemessage
 /// </summary>
 /// <param name="entityCacheMessageId"></param>
 /// <param name="status"></param>
 /// <param name="statusReason"></param>
 public void UpdateEntityCacheMessageStatus(Guid entityCacheMessageId, Status status, EntityCacheMessageStatusReason statusReason)
 {
     outboundSynchronisationDataService.UpdateEntityStatus(entityCacheMessageId, EntityName.EntityCacheMessage, (int)status, (int)statusReason);
 }
 /// <summary>
 /// To process entitycachemessage record without notes
 /// </summary>
 /// <param name="entityCacheMessageId"></param>
 /// <param name="outComeId"></param>
 /// <param name="status"></param>
 /// <param name="statusReason"></param>
 /// <returns></returns>
 public Guid ProcessEntityCacheMessage(Guid entityCacheMessageId, string outComeId, Status status, EntityCacheMessageStatusReason statusReason)
 {
     return(ProcessEntityCacheMessage(entityCacheMessageId, outComeId, status, statusReason, null));
 }
        /// <summary>
        /// To process entitycachemessage record with notes
        /// </summary>
        /// <param name="entityCacheMessageId"></param>
        /// <param name="outComeId"></param>
        /// <param name="status"></param>
        /// <param name="statusReason"></param>
        /// <param name="notes"></param>
        /// <returns></returns>
        public Guid ProcessEntityCacheMessage(Guid entityCacheMessageId, string outComeId, Status status, EntityCacheMessageStatusReason statusReason, string notes)
        {
            var entityCacheId       = Guid.Empty;
            var entityCacheMessages = GetEntityCacheMessages(entityCacheMessageId);

            if (entityCacheMessages == null || entityCacheMessages.Entities.Count == 0)
            {
                return(entityCacheId);
            }
            var entityCacheMessage = entityCacheMessages[0];

            if (!string.IsNullOrWhiteSpace(outComeId))
            {
                entityCacheMessage.Attributes[Attributes.EntityCacheMessage.OutcomeId] = outComeId;
            }
            entityCacheMessage.Attributes[Attributes.EntityCacheMessage.State]        = new OptionSetValue((int)status);
            entityCacheMessage.Attributes[Attributes.EntityCacheMessage.StatusReason] = new OptionSetValue((int)statusReason);
            if (!string.IsNullOrWhiteSpace(notes))
            {
                entityCacheMessage.Attributes[Attributes.EntityCacheMessage.Notes] = GetAppendedNotes(entityCacheMessage, notes);
            }
            orgService.Update(entityCacheMessage);
            if (entityCacheMessage.Attributes.Contains(Attributes.EntityCacheMessage.EntityCacheId) && entityCacheMessage.Attributes[Attributes.EntityCacheMessage.EntityCacheId] != null)
            {
                entityCacheId = ((EntityReference)(entityCacheMessage.Attributes[Attributes.EntityCacheMessage.EntityCacheId])).Id;
            }
            return(entityCacheId);
        }
 /// <summary>
 /// To update status of entitycachemessage
 /// </summary>
 /// <param name="entityCacheMessageId"></param>
 /// <param name="status"></param>
 /// <param name="statusReason"></param>
 /// <param name="notes"></param>
 private void UpdateEntityCacheMessageStatus(Guid entityCacheMessageId, Status status, EntityCacheMessageStatusReason statusReason, string notes = null)
 {
     outboundSynchronisationDataService.UpdateEntityCacheMessageStatus(entityCacheMessageId, (int)status, (int)statusReason, notes);
 }