Пример #1
0
        public static void SetCollection()
        {
            string commandText = "select ph.PhysicianId, ph.DisplayName, c.ClientName, c.ClientId " +
                                 "from tblClient c " +
                                 "join tblPhysicianClient pc on c.ClientId = pc.ClientId " +
                                 "join tblPhysician ph on pc.PhysicianId = ph.PhysicianId " +
                                 "where c.ClientId in (141, 34, 104, 179, 660, 1556, 225, 1763, 1764, 1160, 1541, 587) order by c.ClientName, ph.DisplayName";

            /*
             * string commandText = "select ph.PhysicianId, ph.DisplayName, c.ClientName, c.ClientId " +
             *  "from tblClient c " +
             *  "join tblPhysicianClient pc on c.ClientId = pc.ClientId " +
             *  "join tblPhysician ph on pc.PhysicianId = ph.PhysicianId " +
             *  "where c.ClientId in (141, 34, 104, 179, 660, 1556, 225, 1763, 1764) " +
             *  "or (pc.ClientId = 558 and pc.PhysicianId in (select physicianId from tblPhysicianClient where clientId = 54)) " +
             *  "order by c.ClientName, ph.DisplayName;";
             */

            JObject   request   = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(request);

            PhysicianClientCollection result = new PhysicianClientCollection();

            Build(apiResult, result);
            PhysicianClientCollection.Instance = result;
        }
        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;
        }
Пример #3
0
 public static void Build(APIResult apiResult, PhysicianClientCollection physicianClientCollection)
 {
     for (int i = 0; i < apiResult.JSONResult["result"]["results"].Count(); i++)
     {
         PhysicianClient physicianClient = new PhysicianClient();
         physicianClient.FromSql((JObject)apiResult.JSONResult["result"]["results"][i]);
         physicianClientCollection.Add(physicianClient);
     }
 }
Пример #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.");
            }
        }