Ejemplo n.º 1
0
        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
                    frmEditRules formER = new frmEditRules();
                    this.Hide();
                    formER.ShowDialog();
                    GlobalVars.dc.Close();
                    this.Close();
                }
                else
                {
                    GlobalVars.dc.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void 维护安全事件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                frmEditRules fe = new frmEditRules(DBService.Instance, new List <LogColumn>(LogColumnService.Instance.AvaliableColumns.Values));
                CGeneralFuncion.ShowWindow(this, fe, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (this.Cursor != Cursors.Default)
                {
                    this.Cursor = Cursors.Default;
                }
            }
        }
Ejemplo n.º 3
0
        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!");
            }
        }
Ejemplo n.º 4
0
        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 RULES ENGINE"; //could use OR CPRS GUI CHART if you want, but register all rpcs to the option!
                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
                                frmEditRules formMain = new frmEditRules();
                                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 RULES ENGINE!");
            }
        }