コード例 #1
0
        public void UndoDeleteContactByPatientId_Test()
        {
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      userId         = "000000000000000000000000";
            string      ddUrl          = "http://localhost:8888/Contact";
            IRestClient client         = new JsonServiceClient();

            //[Route("/{Context}/{Version}/{ContractNumber}/Contact/UndoDelete", "PUT")]
            string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contact/UndoDelete",
                                                              ddUrl,
                                                              context,
                                                              version,
                                                              contractNumber), userId);
            List <ContactWithUpdatedRecentList> list = new List <ContactWithUpdatedRecentList>();

            list.Add(new ContactWithUpdatedRecentList {
                ContactId = "5325c81f072ef705080d347e", PatientIndex = 1
            });
            list.Add(new ContactWithUpdatedRecentList {
                ContactId = "5325c821072ef705080d3488", PatientIndex = 3
            });
            UndoDeleteContactDataResponse response = client.Put <UndoDeleteContactDataResponse>(url, new UndoDeleteContactDataRequest {
                Id = "5325da9fd6a4850adc046d1a",
                ContactWithUpdatedRecentLists = null,
                Context        = context,
                ContractNumber = contractNumber,
                Version        = version,
                UserId         = userId
            });

            Assert.IsNotNull(response);
        }
コード例 #2
0
 public void Undo()
 {
     try
     {
         //[Route("/{Context}/{Version}/{ContractNumber}/Contact/UndoDelete", "PUT")]
         string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Contact/UndoDelete",
                                                           DDContactServiceUrl,
                                                           "NG",
                                                           request.Version,
                                                           request.ContractNumber), request.UserId);
         UndoDeleteContactDataResponse response = client.Put <UndoDeleteContactDataResponse>(url, new UndoDeleteContactDataRequest
         {
             Id = deletedId,
             ContactWithUpdatedRecentLists = contactWithUpdatedRecentLists,
             Context        = "NG",
             ContractNumber = request.ContractNumber,
             Version        = request.Version,
             UserId         = request.UserId
         } as object);
     }
     catch (Exception ex)
     {
         throw new Exception("AD: ContactCommand Undo::" + ex.Message, ex.InnerException);
     }
 }
コード例 #3
0
ファイル: DataContactManager.cs プロジェクト: rotovibe/engage
        public UndoDeleteContactDataResponse UndoDeleteContact(UndoDeleteContactDataRequest request)
        {
            UndoDeleteContactDataResponse response = null;

            try
            {
                response = new UndoDeleteContactDataResponse();
                IContactRepository repo = Factory.GetRepository(request, RepositoryType.Contact);
                if (request.Id != null)
                {
                    repo.UndoDelete(request);
                    // Add the deleted contact back into the RecentList of  other contacts(users logged in) who had him/her before the delete action.
                    var undeletedContact = repo.FindByID(request.Id) as ContactData;
                    if (undeletedContact != null)
                    {
                        if (request.ContactWithUpdatedRecentLists != null && request.ContactWithUpdatedRecentLists.Count > 0)
                        {
                            request.ContactWithUpdatedRecentLists.ForEach(c =>
                            {
                                var contactData = repo.FindByID(c.ContactId) as ContactData;
                                if (contactData != null)
                                {
                                    contactData.RecentsList.Insert(c.PatientIndex, undeletedContact.PatientId);
                                    PutRecentPatientRequest recentPatientRequest = new PutRecentPatientRequest
                                    {
                                        ContactId      = c.ContactId,
                                        Context        = request.Context,
                                        ContractNumber = request.ContractNumber,
                                        UserId         = request.UserId,
                                        Version        = request.Version
                                    };
                                    repo.UpdateRecentList(recentPatientRequest, contactData.RecentsList);
                                }
                            });
                        }
                    }
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
コード例 #4
0
        public UndoDeleteContactDataResponse Put(UndoDeleteContactDataRequest request)
        {
            UndoDeleteContactDataResponse response = new UndoDeleteContactDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("ContactDD:ContactUndoDelete()::Unauthorized Access");
                }

                response         = Manager.UndoDeleteContact(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }