示例#1
0
        public void buttonSave_Click(object sender, EventArgs e, string thisMIEN)
        {
            if (listBoxShow.Items.Count < 1)
            {
                MessageBox.Show("You must have at least one item chosen to show!");
            }
            else
            {
                //Save to VistA

                string[] SendListToRPC = new string[listBoxShow.Items.Count]; //Send arguments as List Type
                for (int q = 0; q < listBoxShow.Items.Count; q++)
                {
                    LType anItem = new LType
                    {
                        filtertext = ((LType)(listBoxShow.Items)[q]).filtertext,
                        filterien  = ((LType)(listBoxShow.Items)[q]).filterien
                    };
                    SendListToRPC[q] = anItem.filterien + "^" + anItem.filtertext;
                }

                string THIS_ARG = RpcFormatter.FormatArgs(true, thisMIEN, SendListToRPC);  //thisMIEN is ModuleIEN;Instance
                string res9     = GlobalVars.RunRPC("C9C DASHBOARD PUT USER FILTERS", THIS_ARG);

                if (res9 == "1")
                {
                    FiltersJustSaved = true;
                    DialogResult     = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Error Saving Filters!");
                }
            }
        }
示例#2
0
        private void comboPatients_SelectedIndexChanged(object sender, EventArgs e)
        {
            textIEN.Text     = "";
            textMRN.Text     = "";
            textName.Text    = "";
            textDOB.Text     = "";
            textWard.Text    = "";
            textRoomBed.Text = "";
            textIEN.Text     = GlobalVars.arrayPatients[comboPatients.SelectedIndex, 0];
            textName.Text    = GlobalVars.arrayPatients[comboPatients.SelectedIndex, 1];
            textDOB.Text     = GlobalVars.arrayPatients[comboPatients.SelectedIndex, 2];
            textMRN.Text     = GlobalVars.arrayPatients[comboPatients.SelectedIndex, 3];
            string[] args5 = { textIEN.Text };
            //string res5 = GlobalVars.dc.CallRPC("C9C WARD-ROOMBED", RpcFormatter.FormatArgs(true, args5));
            string res5 = GlobalVars.RunRPC("C9C WARD-ROOMBED", RpcFormatter.FormatArgs(true, args5));

            string[] results = Common.Split(res5);

            if (results.GetLength(0) > 0)
            {
                textWard.Text = results[0];
            }
            if (results.GetLength(0) > 1)
            {
                textRoomBed.Text = results[1];
            }
        }
        private void btnSelect_Click(object sender, EventArgs e)
        {
            GlobalVars.SelectedDivision = LstDivisions.SelectedItem.ToString();
            if (GlobalVars.SelectedDivision == "None")
            {
                MessageBox.Show("No Division Selected");
                GlobalVars.dc.Close();
            }
            else
            {
                string   AV_ARG  = RpcFormatter.FormatArgs(true, GlobalVars.SelectedDivision);
                string   res4    = GlobalVars.dc.CallRPC("XUS DIVISION SET", AV_ARG);
                string[] results = Common.Split(res4);

                if (results[0] == "1")
                {
                    //Logged in and Division Set
                    Dashboard formDB = new Dashboard();
                    this.Hide();
                    formDB.ShowDialog();
                    GlobalVars.dc.Close();
                    this.Close();
                }
                else
                {
                    GlobalVars.dc.Close();
                }
            }
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (GlobalVars.chosenTitleIEN != "")
            {
                int k = comboBoxSelectCohort.SelectedIndex;

                string AV_ARG   = "";
                string thisvptr = GlobalVars.chosenTitleIEN + ";TIU(8925.1,";
                string rcIEN    = "";

                if (k > -1)
                {
                    rcIEN = ((GlobalVars.LType)comboBoxSelectCohort.SelectedItem).itemien.ToString();
                }
                string PTOnly = "0";
                if (checkBoxPTOnly.Checked)
                {
                    PTOnly = "1";
                }
                AV_ARG = RpcFormatter.FormatArgs(true, thisvptr, rcIEN, PTOnly);


                string resSet = GlobalVars.dc.CallRPC("C9C SET COHORT FOR TITLE", AV_ARG);
                if (resSet == "1")
                {
                    if (k > -1)
                    {
                        GlobalVars.chosenCohort.itemien  = ((GlobalVars.LType)comboBoxSelectCohort.SelectedItem).itemien;
                        GlobalVars.chosenCohort.itemtext = ((GlobalVars.LType)comboBoxSelectCohort.SelectedItem).itemtext;
                        if (PTOnly == "1")
                        {
                            GlobalVars.PTOnly = 1;
                        }
                        else
                        {
                            GlobalVars.PTOnly = 0;
                        }
                    }
                    else
                    {
                        GlobalVars.chosenCohort.itemien  = "";
                        GlobalVars.chosenCohort.itemtext = "";
                        GlobalVars.PTOnly = 0;
                    }
                }
                else
                {
                    MessageBox.Show("There was an error saving the reminder cohort!");
                }
            }

            this.DialogResult = DialogResult.OK;
        }
示例#5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string NO_ARG = RpcFormatter.FormatArgs(true, new string[0]);
            string res3   = GlobalVars.dc.CallRPC("XUS INTRO MSG", NO_ARG);

            string[] results = Common.Split(res3);
            if (results.Length > 0)
            {
                this.Text = results[0].Trim();
            }


            string RPC_ARG = RpcFormatter.FormatArgs(true, "PROVIDER");
            string reskey  = GlobalVars.RunRPC("ORWU HASKEY", RPC_ARG);

            results = Common.Split(reskey);
            GlobalVars.hasSEEkey = 0;
            Int32.TryParse(results[0], out GlobalVars.hasSEEkey);
            if (GlobalVars.hasSEEkey <= 0)
            {
                RPC_ARG = RpcFormatter.FormatArgs(true, "C9C 42CFR OVERRIDE");
                reskey  = GlobalVars.RunRPC("ORWU HASKEY", RPC_ARG);
                results = Common.Split(reskey);
                GlobalVars.hasSEEkey = 0;
                Int32.TryParse(results[0], out GlobalVars.hasSEEkey);
            }
            textAuthor.Text    = GlobalVars.strAuthor;
            textAuthorIEN.Text = GlobalVars.strDUZ;
            res3    = GlobalVars.dc.CallRPC("C9C GET TITLES", NO_ARG);
            results = Common.Split(res3);
            if (results.Length > 0)
            {
                char[]   charSeparators = new char[] { '^' };
                string[] splitresults;
                GlobalVars.arrayTitles = new string[results.GetLength(0), 2];
                for (int i = 0; i < results.GetLength(0); i++)
                {
                    splitresults = results[i].Split(charSeparators, 2, StringSplitOptions.None);
                    if (splitresults.Length > 1)
                    {
                        comboSelect.Items.Add(results[i].Split('^')[1]);
                        GlobalVars.arrayTitles[i, 0] = results[i].Split('^')[0];
                        GlobalVars.arrayTitles[i, 1] = results[i].Split('^')[1];
                    }
                }
                comboSelect.SelectedIndex = 0;
            }
        }
        private void FormSelectCohort_Load(object sender, EventArgs e)
        {
            //Populate the Reminders Combobox
            comboBoxSelectCohort.DisplayMember = "itemtext";
            comboBoxSelectCohort.ValueMember   = "itemien";
            comboBoxSelectCohort.Items.Clear();
            string NO_ARG = RpcFormatter.FormatArgs(true, new string[0]);
            string res3   = GlobalVars.dc.CallRPC("C9C GET DASHBOARD REMINDERS", NO_ARG);

            string[] results = Common.Split(res3);
            if (results.Length > 0)
            {
                char[]   charSeparators = new char[] { '^' };
                string[] splitresults;
                for (int i = 0; i < results.GetLength(0); i++)
                {
                    splitresults = results[i].Split(charSeparators, 2, StringSplitOptions.None);
                    if (splitresults.Length > 1)
                    {
                        var thisitem = new GlobalVars.LType {
                            itemtext = splitresults[0], itemien = splitresults[1]
                        };
                        comboBoxSelectCohort.Items.Add(thisitem);
                    }
                }
                comboBoxSelectCohort.SelectedIndex = -1;
                if ((GlobalVars.chosenCohort != null) && (GlobalVars.chosenCohort.itemien != null) &&
                    (GlobalVars.chosenCohort.itemtext != null))
                {
                    comboBoxSelectCohort.SelectedValue = GlobalVars.chosenCohort.itemien;
                    comboBoxSelectCohort.Text          = GlobalVars.chosenCohort.itemtext;
                    if ((GlobalVars.PTOnly == 1))
                    {
                        checkBoxPTOnly.Checked = true;
                    }
                    else
                    {
                        checkBoxPTOnly.Checked = false;
                    }
                }
                else
                {
                    comboBoxSelectCohort.SelectedIndex = -1;
                    checkBoxPTOnly.Checked             = false;
                }
            }
        }
示例#7
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            comboPatients.Items.Clear();
            comboPatients.Text = "";
            textIEN.Text       = "";
            textDOB.Text       = "";
            textName.Text      = "";
            textMRN.Text       = "";
            textWard.Text      = "";
            textRoomBed.Text   = "";

            if (txtSearch.Text.Length > 1)
            {
                string[] args3          = { txtSearch.Text };
                string   res3           = GlobalVars.RunRPC("ORWPT ENHANCED PATLOOKUP", RpcFormatter.FormatArgs(true, args3));
                string[] results        = Common.Split(res3);
                char[]   charSeparators = new char[] { '^' };
                string[] splitresults;


                if (results.GetLength(0) > 0)
                {
                    GlobalVars.arrayPatients = new string[results.GetLength(0), 4];

                    for (int i = 0; i < results.GetLength(0); i++)
                    {
                        splitresults = results[i].Split(charSeparators, 5, StringSplitOptions.None);
                        if (splitresults.Length > 4)
                        {
                            comboPatients.Items.Add(results[i].Split('^')[1]);
                            GlobalVars.arrayPatients[i, 0] = results[i].Split('^')[0];
                            GlobalVars.arrayPatients[i, 1] = results[i].Split('^')[1];
                            GlobalVars.arrayPatients[i, 2] = (results[i].Split('^')[2]).Split('\t')[0];
                            GlobalVars.arrayPatients[i, 3] = results[i].Split('^')[3];
                        }
                    }
                    comboPatients.SelectedIndex = 0;
                    comboPatients.Focus();
                }
            }
            else
            {
                MessageBox.Show("Enter at least two characters!");
            }
        }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textTitleIEN.Text == "")
            {
                MessageBox.Show("You must select a valid Note Title!");
                return;
            }
            if (textIEN.Text == "")
            {
                MessageBox.Show("You must select a patient!");
                return;
            }
            if (openFileDialog1.FileName == "")
            {
                MessageBox.Show("You must select a PDF file!");
                return;
            }
            string subject   = "PDF IMPORTED DOCUMENT";
            string TextLine1 = "This note references an imported PDF document.";
            string TextLine2 = "Please see attached PDF!";

            string[] args1 = { textIEN.Text, textTitleIEN.Text, subject, TextLine1, TextLine2 };


            string res1 = GlobalVars.RunRPC("C9C TIU CREATE RECORD", RpcFormatter.FormatArgs(true, args1));

            string[] results = Common.Split(res1);
            if (results.Length > 0)
            {
                //MessageBox.Show(results[0]);
                if (Convert.ToInt32(results[0]) > 0)
                {
                    string strNoteIEN = results[0];

                    res1    = GlobalVars.RunRPC("C9C MAG4 ADD IMAGE", RpcFormatter.FormatArgs(true, textIEN.Text));
                    results = Common.Split(res1);
                    //MessageBox.Show(results[0]);
                    if (results.Length > 0)
                    {
                        string ienfname   = results[0];
                        string imageIEN   = ienfname.Split('^')[0];
                        string imagePath  = ienfname.Split('^')[1];
                        string imageFName = ienfname.Split('^')[2];
                        //Now let's copy the PDF file to the repository

                        // To copy a file to another location and
                        // overwrite the destination file if it already exists.
                        System.IO.File.Copy(openFileDialog1.FileName, imagePath + imageFName, true);
                        if (System.IO.File.Exists(imagePath + imageFName))
                        {
                            //Now add the proper indexes
                            string[] args7 = { imageIEN, strNoteIEN };
                            res1    = GlobalVars.RunRPC("MAG3 TIU IMAGE", RpcFormatter.FormatArgs(true, args7));
                            results = Common.Split(res1);
                            if (results.Length > 0)
                            {
                                if (results[0].Split('^')[0] == "0")
                                {
                                    MessageBox.Show("Error Creating Indexes!");
                                }
                                else
                                {
                                    MessageBox.Show("PDF File Successfully Attached to Note!");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Error Creating Indexes!");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Error Copying PDF File to Repository!");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Note Creation Unsuccessful!");
                    return;
                }
            }


            openFileDialog1.FileName = "";

            webBrowser1.Hide();
            webBrowser1.Navigate("about:blank");

            do
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(100);
            } while (webBrowser1.ReadyState != WebBrowserReadyState.Complete);
            webBrowser1.Show();
        }
        private void btnConnect_Click(object sender, System.EventArgs e)
        {
            LstDivisions.Items.Clear();
            if (String.IsNullOrEmpty(txtpword.Text))
            {
                MessageBox.Show("Invalid Username/Password");
                return;
            }

            if (String.IsNullOrEmpty(txtuname.Text))
            {
                MessageBox.Show("Invalid Username/Password");
                return;
            }

            string pw    = txtpword.Text;
            string uname = txtuname.Text;

            String[] arguments = Environment.GetCommandLineArgs();
            if (arguments.GetLength(0) < 2)
            {
                MessageBox.Show("Need Command Line Aruguments for Server and Port!");
                this.Close();
            }
            int    port    = 0;
            string server  = "None";
            string thisarg = "";

            for (int iii = 0; iii < arguments.GetLength(0); iii++)
            {
                thisarg = arguments[iii].ToUpper();
                if (thisarg.StartsWith("S="))
                {
                    if (thisarg.Length > 8)
                    {
                        server = thisarg.Substring(2);
                    }
                }
                if (thisarg.StartsWith("P="))
                {
                    if (thisarg.Length > 2)
                    {
                        port = Convert.ToInt32(thisarg.Substring(2));
                    }
                }
            }
            if (port == 0)
            {
                MessageBox.Show("Invalid Port");
                this.Close();
            }
            if (server == "None")
            {
                MessageBox.Show("Invalid Server");
                this.Close();
            }
            GlobalVars.dc = new DataConnection("AD_CONNECT", server, port, true);

            string AV_ARG = "";

            string[] results;
            AV_ARG = RpcFormatter.FormatArgs(true, uname);
            string res = GlobalVars.dc.CallRPC("XUS SIGNON SETUP", AV_ARG);

            results = Common.Split(res);
            AV_ARG  = RpcFormatter.FormatArgs(true, Hash.Encrypt(uname + ';' + pw));
            string resac = GlobalVars.dc.CallRPC("XUS AV CODE", AV_ARG);

            results = Common.Split(resac);
            if (results[0].ToString() == "0")
            {
                MessageBox.Show("Invalid Access/Verify Code");
                this.Close();
            }

            try
            {
                LstDivisions.Items.Clear();
                string context = "C9C DASHBOARD"; //or if you want everyone to have access, you could use "OR CPRS GUI CHART";
                string res2    = GlobalVars.dc.CallRPC("XWB CREATE CONTEXT", RpcFormatter.FormatArgs(true, Hash.Encrypt(context)));
                results = Common.Split(res2);

                string NO_ARG = RpcFormatter.FormatArgs(true, new string[0]);
                string res3   = GlobalVars.dc.CallRPC("XUS GET USER INFO", NO_ARG);
                results = Common.Split(res3);
                int DUZ = 0;
                GlobalVars.SelectedDivision = "None";
                Int32.TryParse(results[0], out DUZ);
                if (DUZ > 0)
                {
                    AV_ARG = RpcFormatter.FormatArgs(true, DUZ.ToString());
                    string res4 = GlobalVars.dc.CallRPC("C9C GET DIVISIONS", AV_ARG);
                    results = Common.Split(res4);
                    if (results.GetLength(0) > 0)
                    {
                        int NumDivs = 0;
                        Int32.TryParse(results[0], out NumDivs);
                        if (NumDivs > 1)
                        {
                            txtuname.Visible     = false;
                            txtpword.Visible     = false;
                            btnConnect.Visible   = false;
                            labeluname.Visible   = false;
                            labelpword.Visible   = false;
                            LstDivisions.Visible = true;
                            btnSelect.Visible    = true;
                            SetDefault(btnSelect);
                            LstDivisions.Focus();
                            LstDivisions.Items.Clear();
                            char[]   charSeparators = new char[] { '^' };
                            string[] splitresults;
                            int      defaultDiv = 0;

                            for (int i = 1; i < results.GetLength(0); i++)
                            {
                                LstDivisions.Items.Add(results[i].Split('^')[1]);
                                splitresults = results[i].Split(charSeparators, 4, StringSplitOptions.None);
                                if (splitresults.Length > 3)
                                {
                                    if (String.IsNullOrEmpty(splitresults[3]))
                                    {
                                    }
                                    else if (splitresults[3] == "1")
                                    {
                                        defaultDiv = i - 1;
                                    }
                                }
                            }
                            LstDivisions.SelectedIndex = defaultDiv;
                        }
                        else if (NumDivs == 1)
                        {
                            GlobalVars.SelectedDivision = results[1].Split('^')[1].ToString();
                            AV_ARG = RpcFormatter.FormatArgs(true, GlobalVars.SelectedDivision);
                            string res5 = GlobalVars.dc.CallRPC("XUS DIVISION SET", AV_ARG);
                            results = Common.Split(res5);

                            if (results[0] == "1")
                            {
                                //Logged in and Division Set
                                Dashboard formMain = new Dashboard();
                                this.Hide();
                                formMain.ShowDialog();
                                GlobalVars.dc.Close();
                                this.Close();
                            }
                            else
                            {
                                GlobalVars.dc.Close();
                            }
                        }
                        else if (NumDivs == 0)
                        {
                            MessageBox.Show("No Divisions");
                        }
                    }
                    else
                    {
                        MessageBox.Show("No Divisions!");
                    }
                }
                else
                {
                    MessageBox.Show("Invalid DUZ");
                }
            }
            catch
            {
                MessageBox.Show("No Divisions or you don't have the secondary menu option C9C DASHBOARD!");
            }
        }
        private void comboBoxRules_SelectedIndexChanged(object sender, EventArgs e)
        {
            labelCalendarDate.Visible           = false;
            labelDateofYear.Visible             = false;
            labelDayofMonth.Visible             = false;
            labelDayofWeek.Visible              = false;
            labelDays.Visible                   = false;
            labelHours.Visible                  = false;
            dateTimePickerCalendarDate.Visible  = false;
            dateTimePickerCalendarDate.Text     = "";
            comboBoxDayofWeek.Visible           = false;
            comboBoxDayofWeek.SelectedIndex     = -1;
            comboBoxDayofMonth.Visible          = false;
            comboBoxDayofMonth.SelectedIndex    = -1;
            comboBoxOrderableItem.Visible       = false;
            comboBoxOrderableItem.SelectedIndex = -1;
            labelOrderableItem.Visible          = false;
            textBoxHours.Visible                = false;
            textBoxHours.Text                   = "";
            textBoxDays.Visible                 = false;
            textBoxDays.Text              = "";
            textBoxDateofYear.Visible     = false;
            textBoxDateofYear.Text        = "";
            labelOrderableItem.Visible    = false;
            comboBoxOrderableItem.Visible = false;

            if (comboBoxRules.Text.Contains("X DAYS"))
            {
                labelDays.Visible   = true;
                textBoxDays.Visible = true;
                labelDays.Left      = 40;
                labelDays.Top       = 90;
                textBoxDays.Left    = 43;
                textBoxDays.Top     = 107;
            }
            if (comboBoxRules.Text.Contains("X HOURS"))
            {
                labelHours.Visible   = true;
                textBoxHours.Visible = true;
                labelHours.Left      = 40;
                labelHours.Top       = 90;
                textBoxHours.Left    = 43;
                textBoxHours.Top     = 107;
            }
            if (comboBoxRules.Text.Contains("CALENDAR DATE"))
            {
                labelCalendarDate.Visible          = true;
                dateTimePickerCalendarDate.Visible = true;
                labelCalendarDate.Left             = 40;
                labelCalendarDate.Top                   = 90;
                dateTimePickerCalendarDate.Left         = 43;
                dateTimePickerCalendarDate.Top          = 107;
                dateTimePickerCalendarDate.Format       = DateTimePickerFormat.Custom;
                dateTimePickerCalendarDate.CustomFormat = " ";
            }
            if (comboBoxRules.Text.Contains("DATE OF YEAR"))
            {
                labelDateofYear.Visible   = true;
                textBoxDateofYear.Visible = true;
                labelDateofYear.Left      = 40;
                labelDateofYear.Top       = 90;
                textBoxDateofYear.Left    = 43;
                textBoxDateofYear.Top     = 107;
            }
            if (comboBoxRules.Text.Contains("DATE OF MONTH"))
            {
                labelDayofMonth.Visible    = true;
                comboBoxDayofMonth.Visible = true;
                labelDayofMonth.Left       = 40;
                labelDayofMonth.Top        = 90;
                comboBoxDayofMonth.Left    = 43;
                comboBoxDayofMonth.Top     = 107;
            }
            if (comboBoxRules.Text.Contains("DAY OF WEEK"))
            {
                labelDayofWeek.Visible    = true;
                comboBoxDayofWeek.Visible = true;
                labelDayofWeek.Left       = 40;
                labelDayofWeek.Top        = 90;
                comboBoxDayofWeek.Left    = 43;
                comboBoxDayofWeek.Top     = 107;
            }
            if (comboBoxRules.Text.Contains("EVENT DATE"))
            {
                labelOrderableItem.Visible    = true;
                comboBoxOrderableItem.Visible = true;
            }
            else
            {
                labelOrderableItem.Visible    = false;
                comboBoxOrderableItem.Visible = false;
            }
            if (comboBoxRules.Text.Contains("PASS-THROUGH REMINDER"))
            {
                //need to populate the combobox here
                comboBoxSelectReminder.DisplayMember = "itemtext";
                comboBoxSelectReminder.ValueMember   = "itemien";
                comboBoxSelectReminder.Items.Clear();
                string   NO_ARG  = RpcFormatter.FormatArgs(true, new string[0]);
                string   res3    = GlobalVars.dc.CallRPC("C9C GET PASS-THROUGH REMINDERS", NO_ARG);
                string[] results = Common.Split(res3);
                if (results.Length > 0)
                {
                    char[]   charSeparators = new char[] { '^' };
                    string[] splitresults;
                    for (int i = 0; i < results.GetLength(0); i++)
                    {
                        splitresults = results[i].Split(charSeparators, 2, StringSplitOptions.None);
                        if (splitresults.Length > 1)
                        {
                            var thisitem = new GlobalVars.LType {
                                itemtext = splitresults[0], itemien = splitresults[1]
                            };
                            comboBoxSelectReminder.Items.Add(thisitem);
                        }
                    }
                    comboBoxSelectReminder.SelectedIndex = -1;
                }
                labelSelectReminder.Visible    = true;
                comboBoxSelectReminder.Visible = true;
            }
            else
            {
                labelSelectReminder.Visible    = false;
                comboBoxSelectReminder.Visible = false;
            }
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (comboBoxRules.SelectedIndex < 0)
            {
                MessageBox.Show("You must select a Rule!");
                return;
            }

            frmEditRules owningForm = (frmEditRules)this.Owner;

            int numrules = owningForm.listBoxWardRulesSelectedItems.Count;

            string res5               = "0";
            string ptrRuleIEN         = GlobalVars.arrayRules[comboBoxRules.SelectedIndex, 0];
            string argXDAYSfromAdmit  = "";
            string argXHOURSfromAdmit = "";
            string argXDAYSfromEvent  = "";
            string argXHOURSfromEvent = "";
            string argCALENDARDATE    = "";
            string argDATEOFYEAR      = "";
            string argDATEOFMONTH     = "";
            string argDAYOFWEEK       = "";
            string argOrderableItem   = "";
            string argPassThroughIEN  = "";

            if (ptrRuleIEN == "")
            {
                MessageBox.Show("Invalid Rule Pointer");
                return;
            }

            if ((comboBoxRules.Text.Contains("X DAYS")) && ((comboBoxRules.Text.Contains("ADMIT DATE")) ||
                                                            (comboBoxRules.Text.Contains("ADMISSION DAY"))))
            {
                int j;
                if (Int32.TryParse(textBoxDays.Text, out j))
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, j, "", "", "", "", 0, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argXDAYSfromAdmit    = textBoxDays.Text;
                }
            }
            else if ((comboBoxRules.Text.Contains("X DAYS")) && (comboBoxRules.Text.Contains("EVENT DATE")))
            {
                if (comboBoxOrderableItem.Text == "")
                {
                    MessageBox.Show("You must select an orderable item as an Event for this rule!");
                    return;
                }
                int j;
                if (Int32.TryParse(textBoxDays.Text, out j))
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", "", "", "", 0, j, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argXDAYSfromEvent    = textBoxDays.Text;
                }
            }
            else if ((comboBoxRules.Text.Contains("X HOURS")) && ((comboBoxRules.Text.Contains("ADMIT DATE")) ||
                                                                  (comboBoxRules.Text.Contains("ADMISSION DAY"))))
            {
                int j;
                if (Int32.TryParse(textBoxHours.Text, out j))
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", "", "", "", j, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argXHOURSfromAdmit   = textBoxHours.Text;
                }
            }
            else if ((comboBoxRules.Text.Contains("X HOURS")) && (comboBoxRules.Text.Contains("EVENT DATE")))
            {
                if (comboBoxOrderableItem.Text == "")
                {
                    MessageBox.Show("You must select an orderable item as an Event for this rule!");
                    return;
                }
                int j;
                if (Int32.TryParse(textBoxHours.Text, out j))
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", "", "", "", 0, 0, j, "");
                    textBoxRuleText.Text = convertedrule;
                    argXHOURSfromEvent   = textBoxHours.Text;
                }
            }
            else if (comboBoxRules.Text.Contains("CALENDAR DATE"))
            {
                string caldate = dateTimePickerCalendarDate.Text;
                if (caldate != "")
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, caldate, "", "", "", 0, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argCALENDARDATE      = caldate;
                }
            }
            else if (comboBoxRules.Text.Contains("DATE OF YEAR"))
            {
                string dateofyear = textBoxDateofYear.Text;
                if (dateofyear != "")
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", dateofyear, "", "", 0, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argDATEOFYEAR        = dateofyear;
                }
            }
            else if (comboBoxRules.Text.Contains("DATE OF MONTH"))
            {
                string dateofmonth = comboBoxDayofMonth.Text;
                if (dateofmonth != "")
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", "", dateofmonth, "", 0, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argDATEOFMONTH       = dateofmonth;
                }
            }
            else if (comboBoxRules.Text.Contains("DAY OF WEEK"))
            {
                string dayofweek = comboBoxDayofWeek.Text;
                if (dayofweek != "")
                {
                    string convertedrule = frmEditRules.convertRuleText(comboBoxRules.Text, 0, "", "", "", dayofweek, 0, 0, 0, "");
                    textBoxRuleText.Text = convertedrule;
                    argDAYOFWEEK         = dayofweek;
                }
            }
            else if (comboBoxRules.Text.Contains("PASS-THROUGH REMINDER"))
            {
                if (comboBoxSelectReminder.Text == "")
                {
                    MessageBox.Show("You must select a pass-through reminder for this rule!");
                    return;
                }
                if (comboBoxSelectReminder.SelectedIndex > -1)
                {
                    string reminderien = ((GlobalVars.LType)comboBoxSelectReminder.SelectedItem).itemien.ToString();
                    textBoxRuleText.Text = "PASS-THROUGH REMINDER IEN=" + reminderien;
                    argPassThroughIEN    = reminderien;
                }
            }
            else
            {
                textBoxRuleText.Text = comboBoxRules.Text;
            }
            if (comboBoxOrderableItem.Text != "")
            {
                int oindex = comboBoxOrderableItem.SelectedIndex;
                if ((oindex > -1) && (oindex < GlobalVars.arrayOrderables.GetLength(0)))
                {
                    argOrderableItem     = GlobalVars.arrayOrderables[oindex, 0];
                    textBoxRuleText.Text = textBoxRuleText.Text + " WITH ACTIVE ORDERABLE ITEM " +
                                           comboBoxOrderableItem.Text;
                }
            }

            String Cohort           = "";
            String FormulaIENstring = "";

            if (this.Text == "Add New Ward Rule")
            {
                Cohort           = "WARD";
                FormulaIENstring = GlobalVars.wardcurrentFormulaIENstring;
            }
            else if (this.Text == "Add New Unit Rule")
            {
                Cohort           = "UNIT";
                FormulaIENstring = GlobalVars.unitcurrentFormulaIENstring;
            }
            else if (this.Text == "Add New Hospital Rule")
            {
                Cohort           = "HOSPITAL";
                FormulaIENstring = GlobalVars.hospitalcurrentFormulaIENstring;
            }


            if ((FormulaIENstring != "") && (ptrRuleIEN != ""))
            {
                string[] args = { Cohort,             ptrRuleIEN,        FormulaIENstring,   argXDAYSfromAdmit,
                                  argXHOURSfromAdmit, argCALENDARDATE,   argDATEOFYEAR,      argDATEOFMONTH,
                                  argDAYOFWEEK,       argXDAYSfromEvent, argXHOURSfromEvent, argOrderableItem, argPassThroughIEN };
                res5 = GlobalVars.dc.CallRPC("C9C ADD RULE TO FORMULA", RpcFormatter.FormatArgs(true, args));
            }
            if (res5 == "1")
            {
                MessageBox.Show("Successfully Added Rule!");
                this.DialogResult = DialogResult.OK;
                //then the rules will be refreshed on the main form
            }
            else
            {
                MessageBox.Show("Error Updating Rules For This Formula!");
            }
        }
示例#12
0
        private void FilterOnService_Shown(object sender, EventArgs e)
        {
            listBoxDoNotShow.DisplayMember = "filtertext";
            listBoxDoNotShow.ValueMember   = "filterien";
            listBoxShow.DisplayMember      = "filtertext";
            listBoxShow.ValueMember        = "filterien";


            thisModuleShow.Clear(); //may have changed


            //RPC has to return array of IEN^Name
            string[] args4    = { };
            string[] args1    = { ModuleThatClickedIEN }; //this is ModuleIEN;Instance
            string   THIS_ARG = RpcFormatter.FormatArgs(true, args1);
            string   res9     = GlobalVars.RunRPC("C9C DASHBOARD GET USER FILTERS", THIS_ARG);

            string[] results = Common.Split(res9);
            if (results.Length > 0)
            {
                for (int m = 0; m < results.Length; m++)
                {
                    thisModuleShow.Add(results[m].Trim());
                }
            }

            int numshowitems = thisModuleShow.Count();

            if (numshowitems == 0)
            {
                numshowitems = thisModuleAllFilterables.Count();
                for (int i = 0; i < numshowitems; i++)
                {
                    string[] filterSplit = thisModuleAllFilterables[i].Split('^');
                    if (filterSplit.Length == 2)
                    {
                        //add [0] to listbox item without showing it here...
                        var thisitem = new LType {
                            filtertext = filterSplit[1], filterien = filterSplit[0]
                        };
                        LFilterablesShow.Add(thisitem);
                        thisModuleShow.Add(thisModuleAllFilterables[i]);
                    }
                }
                listBoxShow.DataSource = LFilterablesShow;
            }
            else //user filter has items
            {
                int numAllitems = thisModuleAllFilterables.Count();
                for (int i = 0; i < numAllitems; i++)
                {
                    if (thisModuleShow.Contains(thisModuleAllFilterables[i]))
                    {
                        string[] filterSplit = thisModuleAllFilterables[i].Split('^');
                        if (filterSplit.Length == 2)
                        {
                            //add [0] to listbox item without showing it here...
                            var thisitem = new LType {
                                filtertext = filterSplit[1], filterien = filterSplit[0]
                            };
                            LFilterablesShow.Add(thisitem);
                        }
                    }
                    else
                    {
                        string[] filterSplit = thisModuleAllFilterables[i].Split('^');
                        if (filterSplit.Length == 2)
                        {
                            //add [0] to listbox item without showing it here...
                            var thisitem = new LType {
                                filtertext = filterSplit[1], filterien = filterSplit[0]
                            };
                            LFilterablesDoNotShow.Add(thisitem);
                        }
                    }
                }
                listBoxShow.DataSource      = LFilterablesShow;
                listBoxDoNotShow.DataSource = LFilterablesDoNotShow;
            }
        }