コード例 #1
0
        public static ClientCollection Build(JArray jsonArray)
        {
            ClientCollection result = new ClientCollection();

            for (int i = 0; i < jsonArray.Count(); i++)
            {
                Client client = new Client();
                client.FromSql((JObject)jsonArray[i]);
                result.Add(client);
            }
            return(result);
        }
コード例 #2
0
        private void DoAuthenticateUser()
        {
            if (string.IsNullOrEmpty(this.PasswordBoxPassword.Password) == false &&
                string.IsNullOrEmpty(this.m_AuthenticatedUser.Password) == false &&
                string.IsNullOrEmpty(this.m_AuthenticatedUser.AuthenticatorToken) == false)
            {
                JObject   apiRequest  = APIRequestHelper.GetTokenMessage(this.m_AuthenticatedUser.UserName, this.PasswordBoxPassword.Password, this.m_AuthenticatedUser.AuthenticatorToken);
                APIResult apiResponse = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);
                if (Convert.ToBoolean(apiResponse.JSONResult["result"]["isAuthenticated"].ToString()) == true)
                {
                    string tkn = apiResponse.JSONResult["result"]["token"].ToString();

                    this.m_AuthenticatedUser.WebServiceAccount       = (JObject)apiResponse.JSONResult["result"]["webServiceAccount"];
                    this.m_AuthenticatedUser.WebServiceAccountClient = (JArray)apiResponse.JSONResult["result"]["webServiceAccountClient"];
                    this.m_AuthenticatedUser.ClientCollection        = ClientCollection.Build((JArray)apiResponse.JSONResult["result"]["clientsAllowed"]);

                    JwtSecurityToken token = new JwtSecurityToken(tkn);
                    this.m_AuthenticatedUser.IsAuthenticated = true;
                    this.m_AuthenticatedUser.Token           = token;

                    if (apiResponse.JSONResult["result"]["clientGroupClient"] != null)
                    {
                        JArray clientGroups = (JArray)apiResponse.JSONResult["result"]["clientGroupClient"];
                        if (clientGroups.Count > 0)
                        {
                            this.m_AuthenticatedUser.ClientGroupId = apiResponse.JSONResult["result"]["clientGroupClient"][0]["ClientGroupId"].ToString();
                        }
                        else
                        {
                            this.m_AuthenticatedUser.ClientGroupId = "0";
                        }
                    }

                    LocalSettings.Instance.UpdateUserNamePassword(m_AuthenticatedUser);
                    LocalSettings.Instance.Serialize();

                    PhysicianCollection.SetCollection(this.m_AuthenticatedUser.GetSQLClientIdInList());
                    PhysicianClientCollection.SetCollection();
                    this.Close();
                }
                else
                {
                    this.m_AuthenticatedUser.IsAuthenticated = true;
                    MessageBox.Show("The Authenticator Token provided is not valid.");
                }
            }
            else
            {
                MessageBox.Show("The username, password and authenticator code cannot be blank.");
            }
        }
コード例 #3
0
        public static ClientOrder GetNew()
        {
            ClientOrder result = new ClientOrder();

            result.RowOperationType      = RowOperationTypeEnum.Insert;
            result.ClientOrderId         = ObjectId.GenerateNewId().ToString();
            result.OrderedBy             = AuthenticatedUser.Instance.DisplayName;
            result.OrderDate             = DateTime.Today;
            result.OrderTime             = DateTime.Now;
            result.OrderStatus           = "NEW";
            result.OrderType             = "SARS-CoV-2";
            result.PanelSetId            = 400;
            result.CollectionDate        = DateTime.Now;
            result.SystemInitiatingOrder = "YPIILIS";
            result.PCounty  = "Yellowstone";
            result.ClientId = AuthenticatedUser.Instance.PrimaryClientId;
            Client client = ClientCollection.GetByClientId(result.ClientId);

            result.ClientName = client.ClientName;
            result.PState     = "MT";

            if (PhysicianCollection.Instance.Count == 1)
            {
                Physician physician = PhysicianCollection.Instance[0];
                result.ProviderId   = physician.Npi;
                result.ProviderName = physician.DisplayName;
            }

            ClientOrderDetail clientOrderDetail = result.ClientOrderDetailCollection.GetNextItem(result.ClientOrderId, AuthenticatedUser.Instance.DisplayName);

            result.ClientOrderDetailCollection.Add(clientOrderDetail);

            List <string> ypiCovidCollectionSiteHosts = new List <string>();

            ypiCovidCollectionSiteHosts.Add("COVA");
            ypiCovidCollectionSiteHosts.Add("COVB");

            if (ypiCovidCollectionSiteHosts.Exists(e => e == Environment.MachineName) == true)
            {
                result.CollectionFacilityId          = "YPICOVID";
                clientOrderDetail.CollectionLocation = "YPICOVID";
            }
            else
            {
                result.CollectionFacilityId          = "CLIENT";
                clientOrderDetail.CollectionLocation = "CLIENT";
            }

            return(result);
        }