コード例 #1
0
        private void buttonsubmitUser_Click(object sender, EventArgs e)
        {
            UserLoad user = new UserLoad();

            // validate values
            int valcheck = ValidateUserValues();


            if (valcheck > 0)
            {
                string errtxt = "";
                if (valcheck == 1)
                {
                    errtxt = "Bad (start) DOB format.";
                }
                if (valcheck == 2)
                {
                    errtxt = "Bad (end) DOB format.";
                }
                if (valcheck == 3)
                {
                    errtxt = "Bad 'numeric' Mask value.";
                }
                if (valcheck == 4)
                {
                    errtxt = "Create # must be greater than zero.";
                }
                MessageBox.Show("Validation Error: " + errtxt + "\n", "Can't create Users.");
                return;
            }

            //update patient array
            UpdateUserValues();

            // Create array to pass to rpc
            List <string> userrpclist = CreateUserArray();

            // call rpc
            Response response = client.CurrentConnection.Execute(new Request {
                MethodName = "ISI IMPORT USER"
            }.AddParameter(userrpclist));

            results = ResponseParser.ParseCreateUserResponse(response.RawData, user);
            if (results[0] == "success")
            {
                foreach (string result in results)
                {
                    if (result == "success")
                    {
                        continue;
                    }
                    textBatchLogDisp.Text = textBatchLogDisp.Text + result + "\r\n";
                }
            }
            if (results[0] == "error")
            {
                string errtxt = DateTime.Now.ToString() + "| Error when attempting to create VistA User record.  |" + results[1];
                textBatchLogDisp.Text = textBatchLogDisp.Text + errtxt + "\r\n";
            }
        }
コード例 #2
0
        public async void Load()
        {
            if (!(await UserLoad.LoadUser(user) && await DataLoad.LoadMatch(user)))
            {
                await DisplayAlert("ERRORE", "Connessione debole o assente", "CHIUDI APP");

                Navigation.PopAsync();
            }

            else
            {
                Application.Current.MainPage = new NavigationPage(new MainPage());
                Navigation.RemovePage(this);
            }
        }
コード例 #3
0
        internal static List <string> ParseCreateUserResponse(string rawData, UserLoad user)
        {
            List <string> rlist = new List <string>();

            if (rawData == null)
            {
                rlist.Add("error");
                rlist.Add("No reply from VistA.");
                return(rlist);
            }
            string results = rawData.ToString();

            string[] lines;
            try
            {
                lines = Regex.Split(results, "\r\n");
            }
            catch
            {
                rlist.Add("error");
                rlist.Add("No expected reply from VistA.");
                return(rlist);
            }
            user.Clear();
            if ((lines != null) && (lines.Length > 0))
            {
                if (lines[0] == "1")
                {
                    string[] fields = lines[1].Split('^');
                    if ((fields != null) && (fields.Length > 0))
                    {
                        rlist.Add("success");
                        try
                        {
                            rlist.Add("User Name:" + fields[2] + " SSN:" + fields[1] + " DFN:" + fields[0]);
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    string[] fields = lines[0].Split('^');
                    if ((fields != null) && (fields.Length > 0))
                    {
                        if (fields[0] == "-1")
                        {
                            // error
                            rlist.Add("error");
                            if (fields[1] != null)
                            {
                                rlist.Add(fields[1].ToString());
                            }
                        }
                        else
                        {
                            rlist.Add("success");
                            foreach (string line in lines)
                            {
                                fields = line.Split('^');
                                try
                                {
                                    string check = fields[1];
                                }
                                catch
                                {
                                    //filter past header count record
                                    continue;
                                }
                                rlist.Add("User Name:" + fields[2] + " SSN:" + fields[1] + " DFN:" + fields[0]);
                            }
                        }
                    }
                }
            }
            return(rlist);
        }