示例#1
0
        public DeleteToDoByPatientIdDataResponse DeleteToDoByPatientId(DeleteToDoByPatientIdDataRequest request)
        {
            DeleteToDoByPatientIdDataResponse response = new DeleteToDoByPatientIdDataResponse();

            try
            {
                ISchedulingRepository repo = Factory.GetRepository(request, RepositoryType.ToDo);
                GetToDosDataRequest   getToDosDataRequest = new GetToDosDataRequest
                {
                    PatientId      = request.PatientId,
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    UserId         = request.UserId,
                    Version        = request.Version
                };
                GetToDosDataResponse toDosResponse = repo.FindToDos(getToDosDataRequest);
                List <ToDoData>      patientToDos  = (List <ToDoData>)toDosResponse.ToDos; //repo.FindToDos(getToDosDataRequest);
                List <string>        deletedIds    = null;
                if (patientToDos != null)
                {
                    deletedIds = new List <string>();
                    patientToDos.ForEach(u =>
                    {
                        request.Id = u.Id;
                        repo.Delete(request);
                        deletedIds.Add(request.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
示例#2
0
 public void Execute()
 {
     try
     {
         //[Route("/{Context}/{Version}/{ContractNumber}/Scheduling/ToDo/Patient/{PatientId}/Delete", "DELETE")]
         string pnUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Scheduling/ToDo/Patient/{4}/Delete",
                                                             DDSchedulingUrl,
                                                             "NG",
                                                             request.Version,
                                                             request.ContractNumber,
                                                             request.Id), request.UserId);
         DeleteToDoByPatientIdDataResponse pnDDResponse = client.Delete <DeleteToDoByPatientIdDataResponse>(pnUrl);
         if (pnDDResponse != null && pnDDResponse.Success)
         {
             deletedIds = pnDDResponse.DeletedIds;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD: PatientToDosCommand Execute::" + ex.Message, ex.InnerException);
     }
 }
示例#3
0
        public DeleteToDoByPatientIdDataResponse Delete(DeleteToDoByPatientIdDataRequest request)
        {
            DeleteToDoByPatientIdDataResponse response = new DeleteToDoByPatientIdDataResponse();

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

                response         = Manager.DeleteToDoByPatientId(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);
        }