예제 #1
0
        public List <HttpObjectResponse <ToDoData> > InsertBatchPatientToDos(InsertBatchPatientToDosDataRequest request)
        {
            List <HttpObjectResponse <ToDoData> > list = null;

            try
            {
                if (request.PatientToDosData != null && request.PatientToDosData.Count > 0)
                {
                    list = new List <HttpObjectResponse <ToDoData> >();
                    ISchedulingRepository repo   = Factory.GetRepository(request, RepositoryType.ToDo);
                    BulkInsertResult      result = (BulkInsertResult)repo.InsertAll(request.PatientToDosData.Cast <object>().ToList());
                    if (result != null)
                    {
                        if (result.ProcessedIds != null && result.ProcessedIds.Count > 0)
                        {
                            // Get the ToDos that were newly inserted.
                            List <ToDoData> insertedToDos = repo.Select(result.ProcessedIds) as List <ToDoData>;
                            if (insertedToDos != null && insertedToDos.Count > 0)
                            {
                                #region DataAudit
                                List <string> insertedPatientToDoIds = insertedToDos.Select(p => p.Id).ToList();
                                AuditHelper.LogDataAudit(request.UserId, MongoCollectionName.ToDo.ToString(), insertedPatientToDoIds, Common.DataAuditType.Insert, request.ContractNumber);
                                #endregion

                                insertedToDos.ForEach(r =>
                                {
                                    list.Add(new HttpObjectResponse <ToDoData> {
                                        Code = HttpStatusCode.Created, Body = (ToDoData) new ToDoData {
                                            Id = r.Id, ExternalRecordId = r.ExternalRecordId, PatientId = r.PatientId
                                        }
                                    });
                                });
                            }
                        }
                        result.ErrorMessages.ForEach(e =>
                        {
                            list.Add(new HttpObjectResponse <ToDoData> {
                                Code = HttpStatusCode.InternalServerError, Message = e
                            });
                        });
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            return(list);
        }
예제 #2
0
        public InsertBatchPatientToDosDataResponse Post(InsertBatchPatientToDosDataRequest request)
        {
            InsertBatchPatientToDosDataResponse response = new InsertBatchPatientToDosDataResponse();

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

                response.Responses = Manager.InsertBatchPatientToDos(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);
        }
예제 #3
0
 public List <Phytel.API.Common.HttpObjectResponse <ToDoData> > InsertBatchPatientToDos(InsertBatchPatientToDosDataRequest request)
 {
     throw new NotImplementedException();
 }