public ClientOrderEditDialog(ClientOrder clientOrder)
        {
            this.m_NextButtonVisibility = Visibility.Visible;
            this.m_BackButtonVisibility = Visibility.Collapsed;
            this.m_DoneButtonVisibility = Visibility.Collapsed;

            this.m_ClientOrder      = clientOrder;
            this.m_ClientOrderClone = clientOrder.Clone();

            if (this.m_ClientOrder.ClientOrderDetailCollection.Count == 1)
            {
                this.m_ClientOrderDetail = this.m_ClientOrder.ClientOrderDetailCollection[0];
            }

            this.m_EthnicityDictionary       = new EthnicityDictionary();
            this.m_RaceDictionary            = new RaceDictionary();
            this.m_StateCollection           = StateCollection.Instance;
            this.m_PhysicianCollection       = PhysicianCollection.Instance;
            this.m_PhysicianClientCollection = PhysicianClientCollection.Instance;
            this.m_AthenticatedUser          = AuthenticatedUser.Instance;

            InitializeComponent();

            this.DataContext = this;
            this.Closing    += ClientOrderEditDialog_Closing;
            this.Loaded     += ClientOrderEditDialog_Loaded;
        }
 public static void Build(APIResult apiResult, PhysicianCollection physicianCollection)
 {
     for (int i = 0; i < apiResult.JSONResult["result"]["results"].Count(); i++)
     {
         Physician physician = new Physician();
         physician.FromSql((JObject)apiResult.JSONResult["result"]["results"][i]);
         physicianCollection.Add(physician);
     }
 }
        public static void SetCollection(string clientIdList)
        {
            string    commandText = $"Select * from tblPhysician p where active = 1 and exists(select null from tblPhysicianClient where physicianId = p.PhysicianId and clientId in ({clientIdList})) order by LastName, FirstName;";
            JObject   request     = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(request);

            PhysicianCollection result = new PhysicianCollection();

            Build(apiResult, result);
            PhysicianCollection.Instance = result;
        }
Beispiel #4
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.");
            }
        }