コード例 #1
0
        public static ListModel <PatientCommunicationModel> Search(
            IServerAuthentication restClientAuthenticator,
            bool?alreadySent             = null,
            string creationDateOperator  = "",
            DateTime?utcCreationDate1    = null,
            DateTime?utcCreationDate2    = null,
            string patientExternalId     = "",
            string appointmentExternalId = "",
            bool?outgoing    = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("creationDateOperator", creationDateOperator);
            criteria.Add("utcCreationDate1", utcCreationDate1.ToString());
            criteria.Add("utcCreationDate2", utcCreationDate2.ToString());
            criteria.Add("alreadySent", alreadySent.ToString());
            criteria.Add("patientExternalId", patientExternalId);
            criteria.Add("appointmentExternalId", appointmentExternalId);
            criteria.Add("outgoing", outgoing.ToString());
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <PatientCommunicationModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #2
0
        public static LoginForm CreateForm(IServerAuthentication serverAuthentication)
        {
            if (_loginForm is null || _loginForm.IsDisposed)
            {
                _loginForm = new LoginForm(serverAuthentication);
            }

            return(_loginForm);
        }
コード例 #3
0
        public static List <DirectMessageModel> Search(IServerAuthentication restClientAuthenticator, int page = 1, int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <DirectMessageModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #4
0
        /// <summary>
        /// Listen for a socket connection
        /// </summary>
        public CtpServer(IPEndPoint listenEndpoint, IServerAuthentication config)
        {
            m_config         = config;
            m_listenEndpoint = listenEndpoint ?? throw new ArgumentNullException(nameof(listenEndpoint));
            m_onAccept       = OnAccept;

            var logMessages = new LogStackMessages("Listen Port", listenEndpoint.ToString());

            using (Logger.AppendStackMessages(logMessages))
                Log = Logger.CreatePublisher(typeof(CtpServer), MessageClass.Framework);
        }
コード例 #5
0
        public static ListModel <AppointmentCancelRequestModel> Search(
            IServerAuthentication restClientAuthenticator,
            bool?alreadySent = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("alreadySent", alreadySent.ToString());
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <AppointmentCancelRequestModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #6
0
        internal static MarkAsReceivedModel MarkAsReceived(IServerAuthentication restClientAuthenticator, MarkAsReceivedModel model, string controllerName)
        {
            var baseAddress        = restClientAuthenticator.GetBaseAddress();
            var authorizationToken = restClientAuthenticator.GetToken();

            var tries      = 0;
            var keepTrying = true;

            using (var restClient = new HttpClient())
            {
                restClient.BaseAddress = new Uri(baseAddress);
                restClient.DefaultRequestHeaders.Accept.Clear();
                restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                while (keepTrying)
                {
                    restClient.DefaultRequestHeaders.Add("Authorization", authorizationToken);

                    var response = restClient.PostAsJsonAsync <MarkAsReceivedModel>(string.Format(ApiClientGenericObjectResources.PostRequestUri, controllerName), model).Result;

                    if (response.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        authorizationToken = restClientAuthenticator.GetToken(true);

                        tries++;
                        keepTrying = tries < 4;
                    }
                    else
                    {
                        keepTrying = false;

                        if (response.IsSuccessStatusCode)
                        {
                            MarkAsReceivedModel MarkAsReceivedModel = response.Content.ReadAsAsync <MarkAsReceivedModel>().Result;

                            return(MarkAsReceivedModel);
                        }
                        else
                        {
                            var additionalInformation = response.Content.ReadAsStringAsync().Result;

                            throw new ApplicationException(string.Format("{0}{1}", string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.BadRequest.ToString()), additionalInformation));
                        }
                    }
                }
                throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.Unauthorized.ToString()));
            }
        }
コード例 #7
0
        public static ListModel <PortalPatientModel> Search(
            IServerAuthentication restClientAuthenticator,
            string firstName = "",
            string lastName  = "",
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("firstName", firstName);
            criteria.Add("lastName", lastName);
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <PortalPatientModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #8
0
        public static AccountSettingsModel Get(IServerAuthentication restClientAuthenticator)
        {
            var baseAddress        = restClientAuthenticator.GetBaseAddress();
            var authorizationToken = restClientAuthenticator.GetToken();

            var tries      = 0;
            var keepTrying = true;

            using (var restClient = new HttpClient())
            {
                restClient.BaseAddress = new Uri(baseAddress);
                restClient.DefaultRequestHeaders.Accept.Clear();
                restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                while (keepTrying)
                {
                    restClient.DefaultRequestHeaders.Add("Authorization", authorizationToken);

                    HttpResponseMessage response = restClient.GetAsync(string.Format("api/{0}", ControllerName)).Result;

                    if (response.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        authorizationToken = restClientAuthenticator.GetToken(true);

                        tries++;
                        keepTrying = tries < 4;
                    }
                    else
                    {
                        keepTrying = false;

                        if (response.IsSuccessStatusCode)
                        {
                            AccountSettingsModel accountSettingsModel = response.Content.ReadAsAsync <AccountSettingsModel>().Result;

                            return(accountSettingsModel);
                        }
                        else
                        {
                            throw new HttpRequestException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, response.StatusCode.ToString()));
                        }
                    }
                }
                throw new HttpRequestException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.Unauthorized.ToString()));
            }
        }
コード例 #9
0
        public static ListModel <OrderStatusModel> Search(
            IServerAuthentication restClientAuthenticator,
            string ID        = "",
            string name      = "",
            int page         = 1,
            int itemsPerPage = 10
            )
        {
            var criteria = new SearchCriteria();

            criteria.Add("name", name);
            criteria.Add("externalId", ID);
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <OrderStatusModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #10
0
        /// Sets changed to appointment request reasons, whether it has changed or no.
        public static AppointmentRequestReasonReceivedModel MarkAsReceived(IServerAuthentication restClientAuthenticator, AppointmentRequestReasonReceivedModel model)
        {
            var baseAddress        = restClientAuthenticator.GetBaseAddress();
            var authorizationToken = restClientAuthenticator.GetToken();

            var tries      = 0;
            var keepTrying = true;

            using (var restClient = new HttpClient())
            {
                restClient.BaseAddress = new Uri(baseAddress);
                restClient.DefaultRequestHeaders.Accept.Clear();
                restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                while (keepTrying)
                {
                    restClient.DefaultRequestHeaders.Add("Authorization", authorizationToken);
                    try
                    {
                        var response = restClient.PostAsJsonAsync(string.Format(ApiClientGenericObjectResources.PostRequestUri, controllerName), model).Result;

                        if (response.StatusCode == HttpStatusCode.Unauthorized)
                        {
                            authorizationToken = restClientAuthenticator.GetToken(true);

                            tries++;
                            keepTrying = tries < 4;
                        }
                        else
                        {
                            keepTrying = false;

                            var additionalInformation = response.Content.ReadAsStringAsync().Result;
                            model = JsonConvert.DeserializeObject <AppointmentRequestReasonReceivedModel>(additionalInformation);

                            return(model);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new ApplicationException(ex.GetBaseException().Message);
                    }
                }
                throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.Unauthorized.ToString()));
            }
        }
コード例 #11
0
        public static ListModel <AppointmentRequestReasonModel> Search(
            IServerAuthentication restClientAuthenticator,
            bool?changed     = null,
            bool?isDeleted   = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("changed", changed.ToString());
            criteria.Add("isDeleted", isDeleted.ToString());

            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <AppointmentRequestReasonModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #12
0
        /// <summary>
        /// Gets a list of T objects from the server.
        /// </summary>
        /// <param name="restClientAuthenticator"></param>
        /// <param name="controllerName"></param>
        /// <param name="parameterList"></param>
        /// <returns></returns>
        public static ListModel <T> Search(IServerAuthentication restClientAuthenticator, string controllerName, IUrlParameters criteria)
        {
            var baseAddress        = restClientAuthenticator.GetBaseAddress();
            var authorizationToken = restClientAuthenticator.GetToken();

            var tries      = 0;
            var keepTrying = true;

            using (var restClient = new HttpClient())
            {
                restClient.BaseAddress = new Uri(baseAddress);
                restClient.DefaultRequestHeaders.Accept.Clear();
                restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                while (keepTrying)
                {
                    restClient.DefaultRequestHeaders.Add("Authorization", authorizationToken);

                    HttpResponseMessage response = restClient.GetAsync(string.Format(ApiClientGenericObjectResources.SearchRequestUri, controllerName, "/search?", criteria.GetAsUrlParameters())).Result;

                    if (response.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        authorizationToken = restClientAuthenticator.GetToken(true);

                        tries++;
                        keepTrying = tries < 4;
                    }
                    else
                    {
                        keepTrying = false;

                        if (response.IsSuccessStatusCode)
                        {
                            ListModel <T> genericList = response.Content.ReadAsAsync <ListModel <T> >().Result;

                            return(genericList);
                        }
                        else
                        {
                            throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, response.StatusCode.ToString()));
                        }
                    }
                }
                throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.Unauthorized.ToString()));
            }
        }
コード例 #13
0
        public static ListModel <PatientUpdateModel> Search(
            IServerAuthentication restClientAuthenticator,
            string patientExternalID = "",
            string method            = "",
            bool?alreadySent         = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());
            criteria.Add("patientExternalID", patientExternalID);
            criteria.Add("method", method);
            criteria.Add("AlreadySent", alreadySent.ToString());

            return(ApiClientGenericObject <PatientUpdateModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #14
0
 public LoginForm(IServerAuthentication serverAuthentication)
 {
     InitializeComponent();
     string[] dataSourceNames = null;
     try
     {
         dataSourceNames = SqlServerInfo.GetDataSourceName().ToArray();
         serverName_Dropdown.Items.AddRange(dataSourceNames);
         authenticationType_ComboBox.SelectedIndex = 0;
         serverName_Dropdown.SelectedIndex         = 0;
         _serverAuthentication = serverAuthentication;
     }
     catch (Exception)
     {
         if (dataSourceNames is null)
         {
             MessageBoxWrapper.ShowErrorBox("None Sql Server Instances", "No Sql Server Instances were found in your computer");
         }
     }
 }
コード例 #15
0
        public static ListModel <UserModel> Search(
            IServerAuthentication restClientAuthenticator,
            string username  = "",
            bool?active      = null,
            string firstName = "",
            string lastName  = "",
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("username", username);
            criteria.Add("active", active.ToString());
            criteria.Add("firstName", firstName);
            criteria.Add("lastname", lastName);
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <UserModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #16
0
        public static ListModel <PatientModel> Search(
            IServerAuthentication restClientAuthenticator,

            string fullName   = "",
            DateTime?birthday = null,

            bool?active      = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("FullName", fullName);
            criteria.Add("Birthday", birthday.ToString());
            criteria.Add("Active", active.ToString());
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <PatientModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #17
0
        public static ListModel <AppointmentModel> Search(IServerAuthentication restClientAuthenticator, string appointmentExternalId = "",
                                                          DateTime?patientBirthday = null, string status                = "", string startDateOperator = "", DateTime?start1 = null,
                                                          DateTime?start2          = null, string portalCreatedOperator = "", DateTime?portalCreated1  = null, DateTime?portalCreated2 = null,
                                                          int page = 1, int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("appointmentExternalId", appointmentExternalId);
            criteria.Add("patientBirthday", patientBirthday.ToString());
            criteria.Add("status", status);
            criteria.Add("startDateOperator", startDateOperator);
            criteria.Add("start1", start1.ToString());
            criteria.Add("start2", start2.ToString());
            criteria.Add("portalCreatedOperator", portalCreatedOperator);
            criteria.Add("portalCreated1", portalCreated1.ToString());
            criteria.Add("portalCreated2", portalCreated2.ToString());

            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <AppointmentModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #18
0
        public static ListModel <LocationModel> Search(
            IServerAuthentication restClientAuthenticator,
            string name      = "",
            string ID        = "",
            bool?active      = null,
            string city      = "",
            string state     = "",
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("name", name);
            criteria.Add("externalId", ID);
            criteria.Add("active", active.ToString());
            criteria.Add("city", city);
            criteria.Add("state", state);
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <LocationModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #19
0
        public static ListModel <OrderModel> Search(
            IServerAuthentication restClientAuthenticator,
            string patientID         = null,
            string locationID        = null,
            string ID                = "",
            DateTime?utcCreationDate = null,
            DateTime?utcPickupDate   = null,
            decimal?patientBalance   = null,
            int page         = 1,
            int itemsPerPage = 10)
        {
            var criteria = new SearchCriteria();

            criteria.Add("patientExternalId", patientID);
            criteria.Add("locationExternalId", locationID);
            criteria.Add("externalId", ID);
            criteria.Add("creationDate", utcCreationDate.ToString());
            criteria.Add("pickupDate", utcPickupDate.ToString());
            criteria.Add("patientBalance", patientBalance.ToString());
            criteria.Add("page", page.ToString());
            criteria.Add("itemsPerPage", itemsPerPage.ToString());

            return(ApiClientGenericObject <OrderModel> .Search(restClientAuthenticator, ControllerName, criteria));
        }
コード例 #20
0
 public SqlManagerForm(ISqlServerClient sqlServerClient, IServerAuthentication serverAuthentication)
 {
     InitializeComponent();
     _sqlServerClient      = sqlServerClient;
     _serverAuthentication = serverAuthentication;
 }
コード例 #21
0
 /// Sets the status for the patient update to approved or denied. (To do) Triggers an email to inform patient of the results.
 public static MarkAsReceivedModel MarkAsReceived(IServerAuthentication restClientAuthenticator, MarkAsReceivedModel model)
 {
     return(MarkAsReceivedProvider.MarkAsReceived(restClientAuthenticator, model, MarkAsSentControllerName));
 }
コード例 #22
0
 public static bool Delete(IServerAuthentication restClientAuthenticator, string ID)
 {
     return(ApiClientGenericObject <SocialHistoryAlcoholModel> .Delete(restClientAuthenticator, ControllerName, ID));
 }
コード例 #23
0
 public static bool Save(IServerAuthentication restClientAuthenticator, SocialHistoryAlcoholModel model)
 {
     return(ApiClientGenericObject <SocialHistoryAlcoholModel> .Save(restClientAuthenticator, ControllerName, model));
 }
コード例 #24
0
 public static bool Save(IServerAuthentication restClientAuthenticator, MedicationModel model)
 {
     return(ApiClientGenericObject <MedicationModel> .Save(restClientAuthenticator, ControllerName, model));
 }
コード例 #25
0
 /// Sets the status for the appointment cancellation request to approved or denied. (To do) Triggers an email to inform patient of the results of the cancellation request.
 public static bool ApplyResult(IServerAuthentication restClientAuthenticator, AppointmentRequestResultModel model)
 {
     return(ApiClientGenericObject <AppointmentRequestResultModel> .Save(restClientAuthenticator, ControllerName, model));
 }
コード例 #26
0
 public static bool Save(IServerAuthentication restClientAuthenticator, ExamFieldMappingDetailModel model)
 {
     return(ApiClientGenericObject <ExamFieldMappingDetailModel> .Save(restClientAuthenticator, ControllerName, model));
 }
コード例 #27
0
 public static OpenFormModel Get(IServerAuthentication restClientAuthenticator, string ID)
 {
     return(ApiClientGenericObject <OpenFormModel> .Get(restClientAuthenticator, ControllerName, ID, "internalId"));
 }
コード例 #28
0
 public static bool Delete(IServerAuthentication restClientAuthenticator, string ID)
 {
     return(ApiClientGenericObject <OrderStatusModel> .Delete(restClientAuthenticator, ControllerName, ID));
 }
コード例 #29
0
 public static bool Delete(IServerAuthentication restClientAuthenticator, string ID)
 {
     return(ApiClientGenericObject <ExamFieldMappingDetailModel> .Delete(restClientAuthenticator, ControllerName, ID));
 }
コード例 #30
0
        /// <summary>
        /// Gets a T object from the server.
        /// </summary>
        /// <param name="restClientAuthenticator"></param>
        /// <param name="controllerName"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public static T Get(IServerAuthentication restClientAuthenticator, string controllerName, string ID, string externalIdParameterName = "externalId")
        {
            if (string.IsNullOrWhiteSpace(ID))
            {
                var additionalInformation = string.Format(ApiClientGenericObjectResources.AdditionalInformation, ApiClientGenericObjectResources.IdNotNullable);
                throw new ApplicationException(string.Format("{0}{1}", string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.BadRequest.ToString()), additionalInformation));
            }

            var baseAddress        = restClientAuthenticator.GetBaseAddress();
            var authorizationToken = restClientAuthenticator.GetToken();

            var tries      = 0;
            var keepTrying = true;

            using (var restClient = new HttpClient())
            {
                restClient.BaseAddress = new Uri(baseAddress);
                restClient.DefaultRequestHeaders.Accept.Clear();
                restClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                while (keepTrying)
                {
                    restClient.DefaultRequestHeaders.Add("Authorization", authorizationToken);

                    HttpResponseMessage response = restClient.GetAsync
                                                       (string.Format(
                                                           ApiClientGenericObjectResources.GetRequestUri,
                                                           controllerName,
                                                           "?",
                                                           externalIdParameterName,
                                                           "=",
                                                           ID
                                                           )
                                                       ).Result;

                    if (response.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        authorizationToken = restClientAuthenticator.GetToken(true);

                        tries++;
                        keepTrying = tries < 4;
                    }
                    else
                    {
                        keepTrying = false;

                        if (response.IsSuccessStatusCode)
                        {
                            T genericObject = response.Content.ReadAsAsync <T>().Result;

                            return(genericObject);
                        }
                        else
                        {
                            throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, response.StatusCode.ToString()));
                        }
                    }
                }
                throw new ApplicationException(string.Format(ApiClientGenericObjectResources.UnsuccessfulResponseMessage, HttpStatusCode.Unauthorized.ToString()));
            }
        }