Exemplo n.º 1
0
        public object Save <T>(T toDo, string contract)
        {
            LoggerDomainEvent.Raise(new LogStatus {
                Message = "1) Sending insert ToDo DD request.", Type = LogType.Debug
            });
            var l = toDo as List <ToDoData>;

            if (l != null)
            {
                LogUtil.LogExternalRecordId("Save", l.Cast <IAppData>().ToList());
            }

            var userid = ProcConstants.UserId; // need to find a valid session id.

            try
            {
                IRestClient client = new JsonServiceClient {
                    Timeout = TimeSpan.FromMinutes(50)
                };                                                                                //new TimeSpan( 28000000000) };
                //"/{Context}/{Version}/{ContractNumber}/Batch/PatientToDos"
                var url = Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Batch/PatientToDos/", DDPatientToDoServiceUrl, "NG", 1, contract), userid);

                InsertBatchPatientToDosDataResponse response = client.Post <InsertBatchPatientToDosDataResponse>(url,
                                                                                                                 new InsertBatchPatientToDosDataRequest
                {
                    Context          = "NG",
                    ContractNumber   = contract,
                    PatientToDosData = toDo as List <ToDoData>,
                    UserId           = userid,
                    Version          = 1
                });

                //Helpers.SerializeObject<List<PatientData>>(patients as List<PatientData>, System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\PatientsExample.txt");
                //var lPsd = Helpers.DeserializeObject<List<PatientSystemData>>(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\PatientsSystemExample.txt");

                LoggerDomainEvent.Raise(new LogStatus {
                    Message = "1) Success", Type = LogType.Debug
                });
                return(response.Responses);
            }
            catch (Exception ex)
            {
                LoggerDomainEvent.Raise(new LogStatus {
                    Message = "ToDoDataDomain:Save(): " + ex.Message, Type = LogType.Error
                });
                throw new ArgumentException("ToDoDataDomain:Save(): " + ex.Message);
            }
        }
Exemplo n.º 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);
        }