///<summary>Returns true if the From provider is associated to the user currently logged in.
        ///If the user has chosen a different provider as the From provider this will prompt them to enter a password for any user associated to them.
        ///Loops through all users associated to the From provider until the credentials typed in match.</summary>
        private bool VerifyFromProvider()
        {
            if (_provCur == null)
            {
                MsgBox.Show(this, "Invalid From provider.");
                return(false);
            }
            //Don't require validating credentials if the user currently logged in is associated to the selected provider.
            if (_provUserCur != null && _provUserCur.ProvNum == _provCur.ProvNum)
            {
                return(true);
            }
            List <Userod> listUsers = Userods.GetUsersByProvNum(_provCur.ProvNum);         //Get all potential users for this provider.
            InputBox      FormIB    = new InputBox(Lan.g(this, "Input a password for a User that is associated to provider:") + "\r\n" + _provCur.GetFormalName());

            FormIB.textResult.PasswordChar = '*';
            while (true)
            {
                //Get the password for a user that is associated to the provider chosen.
                FormIB.textResult.Text = "";
                FormIB.ShowDialog();
                if (FormIB.DialogResult == DialogResult.OK)
                {
                    //Validate the password typed in against all the users associated to the selected provider.
                    foreach (Userod user in listUsers)
                    {
                        if (Authentication.CheckPassword(user, FormIB.textResult.Text))
                        {
                            return(true);
                        }
                    }
                    MsgBox.Show(this, "Invalid password.  Please try again or Cancel.");
                }
                else                  //User canceled
                {
                    return(false);
                }
            }
        }
Esempio n. 2
0
        ///<summary>Will ask for password if the current user logged in isn't the user status being manipulated.</summary>
        private static bool CheckSelectedUserPassword(long employeeNum)
        {
            if (Security.CurUser.EmployeeNum == employeeNum)
            {
                return(true);
            }
            Userod   selectedUser = Userods.GetUserByEmployeeNum(employeeNum);
            InputBox inputPass    = new InputBox("Please enter password:"******"PhoneUI", "Wrong password.");
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        ///<summary>When a row is double clicked, bring up an input box that allows the user to change the variable's value.</summary>
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            QuerySetStmtObject qObjCur  = (QuerySetStmtObject)gridMain.SelectedGridRows[0].Tag;
            InputBox           inputBox = new InputBox(new List <InputBoxParam> {
                new InputBoxParam(InputBoxType.TextBox, Lan.g(this, "Set value for") + " " + qObjCur.Variable, text: qObjCur.Value)
            });

            inputBox.ShowDialog();
            if (inputBox.DialogResult == DialogResult.OK)
            {
                string stmtOld = qObjCur.Stmt;
                //Regular expression for the expression @Variable = Value.
                Regex  r       = new Regex(Regex.Escape(qObjCur.Variable) + @"\s*=\s*" + Regex.Escape(qObjCur.Value));
                string stmtNew = r.Replace(stmtOld, qObjCur.Variable + "=" + inputBox.textResult.Text);
                _queryCur.QueryText = _queryCur.QueryText.Replace(stmtOld, stmtNew);
                if (stmtOld == stmtNew)
                {
                    return;                     //don't bother refilling the grid if the value didn't change.
                }
                textQuery.Text = _queryCur.QueryText;
                FillGrid();
            }
        }
Esempio n. 4
0
        private void butAddDay_Click(object sender, EventArgs e)
        {
            List <string> listDaysOfMonth = new List <string>();

            for (int i = 1; i <= 31; i++)
            {
                listDaysOfMonth.Add(i.ToString());
            }
            InputBox input = new InputBox(new List <InputBoxParam> {
                new InputBoxParam {
                    ParamType       = InputBoxType.ComboSelect,
                    LabelText       = Lans.g(this, "Day of month"),
                    ListSelections  = listDaysOfMonth,
                    ParamSize       = new Size(75, 21),
                    HorizontalAlign = HorizontalAlignment.Center,
                }
            });

            input.Text = Lans.g(this, "Select Day");
            input.ShowDialog();
            if (input.DialogResult != DialogResult.OK)
            {
                return;
            }
            int        selectedDay = input.SelectedIndex + 1;
            List <int> currentDays = textDayOfMonth.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                     .Select(x => PIn.Int(x.Trim())).ToList();

            if (currentDays.Contains(selectedDay))
            {
                MsgBox.Show(this, "The selected date has already been added.");
                return;
            }
            currentDays.Add(selectedDay);
            currentDays.Sort();
            textDayOfMonth.Text = string.Join(", ", currentDays);
        }
Esempio n. 5
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            InputBox   editWord = new InputBox("Edit word");
            DictCustom origWord = DictCustoms.Listt[e.Row];

            editWord.textResult.Text = origWord.WordText;
            if (editWord.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (editWord.textResult.Text == origWord.WordText)
            {
                return;
            }
            if (editWord.textResult.Text == "")
            {
                DictCustoms.Delete(origWord.DictCustomNum);
                DataValid.SetInvalid(InvalidType.DictCustoms);
                FillGrid();
                return;
            }
            string newWord = Regex.Replace(editWord.textResult.Text, "[\\s]|[\\p{P}\\p{S}-['-]]", ""); //don't allow words with spaces or punctuation except ' and - in them

            for (int i = 0; i < DictCustoms.Listt.Count; i++)                                          //Make sure it's not already in the custom list
            {
                if (DictCustoms.Listt[i].WordText == newWord)
                {
                    MsgBox.Show(this, "The word " + newWord + " is already in the custom word list.");
                    editWord.textResult.Text = origWord.WordText;
                    return;
                }
            }
            origWord.WordText = newWord;
            DictCustoms.Update(origWord);
            DataValid.SetInvalid(InvalidType.DictCustoms);
            FillGrid();
        }
Esempio n. 6
0
        private void butAddComment_Click(object sender, EventArgs e)
        {
            InputBox ipb = new InputBox("Add comment to note.");

            ipb.ShowDialog();
            if (ipb.DialogResult != DialogResult.OK)
            {
                return;
            }
            string result = ipb.textResult.Text;

            result = result.Replace("|", "");         //reserved character
            result = result.Replace("^", "");         //reserved character
            result = result.Replace("~", "");         //reserved character
            result = result.Replace("&", "");         //reserved character
            result = result.Replace("#", "");         //reserved character
            result = result.Replace("\\", "");        //reserved character
            if (result != ipb.textResult.Text)
            {
                MsgBox.Show(this, "Special characters were removed from comment. The characters |,^,~,\\,&, and # cannot be used in a comment.");
            }
            LabNoteCur.Comments += (LabNoteCur.Comments == ""?"":"^") + result;
            FillGrid();
        }
Esempio n. 7
0
        ///<summary>When clicked, allows user to past stacktrace and enter version to attempt to find hash and matched info.</summary>
        private void butCheckHash_Click(object sender, EventArgs e)
        {
            InputBox input = new InputBox("Please paste a stack trace", true);

            if (input.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            BugSubmission sub = new BugSubmission()
            {
                ExceptionStackTrace = input.textResult.Text.Replace("\r\n", "\n"),
            };

            input = new InputBox("Please enter a version like: 19.2.1.0");
            if (input.ShowDialog() != DialogResult.OK || !Version.TryParse(input.textResult.Text, out Version version))
            {
                return;
            }
            BugSubmissionHashes.ProcessSubmission(sub
                                                  , out long matchedBugId, out string matchedFixedVersions, out long matchedBugSubmissionHashNum
                                                  , version, false
                                                  );
            MsgBox.Show($"MatchedBugId: {matchedBugId}\r\nMatchedFixedVersions: {matchedFixedVersions}\r\nMatchedBugSubmissionHashNum: {matchedBugSubmissionHashNum}");
        }
Esempio n. 8
0
        private void FormTerminal_Load(object sender, EventArgs e)
        {
            Size     = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size;
            Location = new Point(0, 0);
            labelConnection.Visible = false;
            _listSheets             = new List <Sheet>();
            if (IsSimpleMode)
            {
                //PatNum set externally (in FormPatientForms)
                return;
            }
            //NOT SimpleMode from here down
            Process processCur = Process.GetCurrentProcess();

            //Delete all terminalactives for this computer, except new one, based on CompName and SessionID
            TerminalActives.DeleteForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, excludeId: processCur.Id);
            string clientName = null;
            string userName   = null;

            try {
                clientName = Environment.GetEnvironmentVariable("ClientName");
                userName   = Environment.GetEnvironmentVariable("UserName");
            }
            catch (Exception) {
                //user may not have permission to access environment variables or another error could happen
            }
            if (string.IsNullOrWhiteSpace(clientName))
            {
                //ClientName only set for remote sessions, try to find suitable replacement.
                clientName = userName;
                if (processCur.SessionId < 2 || string.IsNullOrWhiteSpace(userName))
                {
                    //if sessionId is 0 or 1, this is not a remote session, use MachineName
                    clientName = Environment.MachineName;
                }
            }
            if (string.IsNullOrWhiteSpace(clientName) || TerminalActives.IsCompClientNameInUse(Environment.MachineName, clientName))
            {
                InputBox iBox = new InputBox("Please enter a unique name to identify this kiosk.");
                iBox.setTitle(Lan.g(this, "Kiosk Session Name"));
                iBox.ShowDialog();
                while (iBox.DialogResult == DialogResult.OK && TerminalActives.IsCompClientNameInUse(Environment.MachineName, iBox.textResult.Text))
                {
                    MsgBox.Show(this, "The name entered is invalid or already in use.");
                    iBox.ShowDialog();
                }
                if (iBox.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;                    //not allowed to enter kiosk mode unless a unique human-readable name is entered for this computer session
                }
                clientName = iBox.textResult.Text;
            }
            //if we get here, we have a SessionId (which could be 0 if not in a remote session) and a unique client name for this kiosk
            TerminalActive terminal = new TerminalActive();

            terminal.ComputerName = Environment.MachineName;
            terminal.SessionId    = processCur.SessionId;
            terminal.SessionName  = clientName;
            terminal.ProcessId    = processCur.Id;
            TerminalActives.Insert(terminal);                                          //tell the database that a terminal is newly active on this computer
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id); //signal FormTerminalManager to re-fill grids
            timer1.Enabled = true;
        }
Esempio n. 9
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (gridMain.ListGridRows.Count == 0)
            {
                MsgBox.Show(this, "No rows to fix.");
                return;
            }
            //if(comboFeeSchedNew.SelectedIndex==0) {
            //	MsgBox.Show(this,"No rows to fix.");
            //	return;
            //}
            if (gridMain.SelectedIndices.Length == 0)
            {
                gridMain.SetSelected(true);
            }
            if (!MsgBox.Show(this, true, "Change the fee schedule for all selected plans to the new fee schedule?"))
            {
                return;
            }
            InputBox passBox = new InputBox("To prevent accidental changes, please enter password.  It can be found in our manual.");

            passBox.ShowDialog();            //
            if (passBox.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (passBox.textResult.Text != "fee")
            {
                MsgBox.Show(this, "Incorrect password.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            long   employerNum;
            string carrierName;
            string groupNum;
            string groupName;
            long   newFeeSchedNum = 0;

            if (comboFeeSchedNew.SelectedIndex != 0)
            {
                newFeeSchedNum = FeeSchedsForType[comboFeeSchedNew.SelectedIndex - 1].FeeSchedNum;
            }
            long oldFeeSchedNum;
            long rowsChanged = 0;

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                oldFeeSchedNum = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["feeSched"].ToString());
                if (oldFeeSchedNum == newFeeSchedNum)
                {
                    continue;
                }
                employerNum  = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["EmployerNum"].ToString());
                carrierName  = table.Rows[gridMain.SelectedIndices[i]]["CarrierName"].ToString();
                groupNum     = table.Rows[gridMain.SelectedIndices[i]]["GroupNum"].ToString();
                groupName    = table.Rows[gridMain.SelectedIndices[i]]["GroupName"].ToString();
                rowsChanged += InsPlans.SetFeeSched(employerNum, carrierName, groupNum, groupName, newFeeSchedNum,
                                                    (FeeScheduleType)(listType.SelectedIndex));
            }
            FillGrid();
            Cursor = Cursors.Default;
            MessageBox.Show(Lan.g(this, "Plans changed: ") + rowsChanged.ToString());
        }
Esempio n. 10
0
        private void butImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFD = new OpenFileDialog();

            openFD.Multiselect = true;
            if (openFD.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Invalidate();
            foreach (string fileName in openFD.FileNames)
            {
                //check file types?
                string destinationPath = FileAtoZ.CombinePaths(_imageFolder, Path.GetFileName(fileName));
                if (FileAtoZ.Exists(destinationPath))
                {
                    switch (MessageBox.Show(Lan.g(this, "Overwrite Existing File") + ": " + destinationPath, "", MessageBoxButtons.YesNoCancel))
                    {
                    case DialogResult.No:                            //rename, do not overwrite
                        InputBox ip = new InputBox(Lan.g(this, "New file name."));
                        ip.textResult.Text = Path.GetFileName(fileName);
                        ip.ShowDialog();
                        if (ip.DialogResult != DialogResult.OK)
                        {
                            continue;                                    //cancel, next file.
                        }
                        bool cancel = false;
                        while (!cancel && FileAtoZ.Exists(FileAtoZ.CombinePaths(_imageFolder, ip.textResult.Text)))
                        {
                            MsgBox.Show(this, "File name already exists.");
                            if (ip.ShowDialog() != DialogResult.OK)
                            {
                                cancel = true;
                            }
                        }
                        if (cancel)
                        {
                            continue;                                    //cancel rename, and go to next file.
                        }
                        destinationPath = FileAtoZ.CombinePaths(_imageFolder, ip.textResult.Text);
                        break;                                //proceed to save file.

                    case DialogResult.Yes:                    //overwrite
                        try {
                            FileAtoZ.Delete(destinationPath);
                        }
                        catch (Exception ex) {
                            MessageBox.Show(Lan.g(this, "Cannot copy file") + ":" + fileName + "\r\n" + ex.Message);
                            continue;
                        }
                        break;                          //file deleted, proceed to save.

                    default:                            //cancel
                        continue;                       //skip this file.
                    }
                }
                FileAtoZ.Copy(fileName, destinationPath, FileAtoZSourceDestination.LocalToAtoZ);
            }
            FillGrid();
            if (openFD.FileNames.Length == 1)           //if importing exactly one image, select it upon returning.
            {
                textSearch.Text = Path.GetFileName(openFD.FileNames[0]);
            }
        }
Esempio n. 11
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            if (!PrefC.GetBool(PrefName.StoreCCnumbers))
            {
                bool hasXCharge    = false;
                bool hasPayConnect = false;
                bool hasPaySimple  = false;
                Dictionary <string, int> dictEnabledProcessors = new Dictionary <string, int>();
                int  idx = 0;
                bool hasXChargePreventCcAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.Xcharge).ProgramNum,
                                                                                    ProgramProperties.PropertyDescs.XCharge.XChargePreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.Xcharge) && !hasXChargePreventCcAdd)
                {
                    dictEnabledProcessors["X-Charge"] = idx++;
                }
                bool hasPayConnectPreventCcAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.PayConnect).ProgramNum,
                                                                                       PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.PayConnect) && !hasPayConnectPreventCcAdd)
                {
                    dictEnabledProcessors["PayConnect"] = idx++;
                }
                bool hasPaySimplePreventCCAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.PaySimple).ProgramNum,
                                                                                      PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.PaySimple) && !hasPaySimplePreventCCAdd)
                {
                    dictEnabledProcessors["PaySimple"] = idx++;
                }
                if (dictEnabledProcessors.Count > 1)
                {
                    List <string> listCCProcessors = dictEnabledProcessors.Select(x => x.Key).ToList();
                    InputBox      chooseProcessor  =
                        new InputBox(Lan.g(this, "For which credit card processing company would you like to add this card?"), listCCProcessors, true);
                    if (chooseProcessor.ShowDialog() == DialogResult.Cancel)
                    {
                        return;
                    }
                    hasXCharge    = dictEnabledProcessors.ContainsKey("X-Charge") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["X-Charge"]);
                    hasPayConnect = dictEnabledProcessors.ContainsKey("PayConnect") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["PayConnect"]);
                    hasPaySimple  = dictEnabledProcessors.ContainsKey("PaySimple") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["PaySimple"]);
                }
                else if (Programs.IsEnabled(ProgramName.Xcharge) && !hasXChargePreventCcAdd)
                {
                    hasXCharge = true;
                }
                else if (Programs.IsEnabled(ProgramName.PayConnect) && !hasPayConnectPreventCcAdd)
                {
                    hasPayConnect = true;
                }
                else if (Programs.IsEnabled(ProgramName.PaySimple) && !hasPaySimplePreventCCAdd)
                {
                    hasPaySimple = true;
                }
                else                  //not storing CC numbers and both PayConnect and X-Charge are disabled
                {
                    MsgBox.Show(this, "Not allowed to store credit cards.");
                    return;
                }
                CreditCard creditCardCur = null;
                if (hasXCharge)
                {
                    if (ODBuild.IsWeb())
                    {
                        MsgBox.Show(this, "XCharge is not available while viewing through the web.");
                        return;
                    }
                    Program prog      = Programs.GetCur(ProgramName.Xcharge);
                    string  path      = Programs.GetProgramPath(prog);
                    string  xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum).Trim();
                    string  xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum).Trim();
                    //Force user to retry entering information until it's correct or they press cancel
                    while (!File.Exists(path) || string.IsNullOrEmpty(xPassword) || string.IsNullOrEmpty(xUsername))
                    {
                        MsgBox.Show(this, "The Path, Username, and/or Password for X-Charge have not been set or are invalid.");
                        if (!Security.IsAuthorized(Permissions.Setup))
                        {
                            return;
                        }
                        FormXchargeSetup FormX = new FormXchargeSetup();                 //refreshes program and program property caches on OK click
                        FormX.ShowDialog();
                        if (FormX.DialogResult != DialogResult.OK)                       //if user presses cancel, return
                        {
                            return;
                        }
                        prog      = Programs.GetCur(ProgramName.Xcharge);                 //refresh local variable prog to reflect any changes made in setup window
                        path      = Programs.GetProgramPath(prog);
                        xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum).Trim();
                        xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum).Trim();
                    }
                    xPassword = CodeBase.MiscUtils.Decrypt(xPassword);
                    ProcessStartInfo info       = new ProcessStartInfo(path);
                    string           resultfile = PrefC.GetRandomTempFile("txt");
                    try {
                        File.Delete(resultfile);                        //delete the old result file.
                    }
                    catch {
                        MsgBox.Show(this, "Could not delete XResult.txt file.  It may be in use by another program, flagged as read-only, or you might not have sufficient permissions.");
                        return;
                    }
                    info.Arguments  = "";
                    info.Arguments += "/TRANSACTIONTYPE:ArchiveVaultAdd /LOCKTRANTYPE ";
                    info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                    info.Arguments += "/USERID:" + xUsername + " ";
                    info.Arguments += "/PASSWORD:"******" ";
                    info.Arguments += "/VALIDATEARCHIVEVAULTACCOUNT ";
                    info.Arguments += "/STAYONTOP ";
                    info.Arguments += "/SMARTAUTOPROCESS ";
                    info.Arguments += "/AUTOCLOSE ";
                    info.Arguments += "/HIDEMAINWINDOW ";
                    info.Arguments += "/SMALLWINDOW ";
                    info.Arguments += "/NORESULTDIALOG ";
                    info.Arguments += "/TOOLBAREXITBUTTON ";
                    Cursor          = Cursors.WaitCursor;
                    Process process = new Process();
                    process.StartInfo           = info;
                    process.EnableRaisingEvents = true;
                    process.Start();
                    while (!process.HasExited)
                    {
                        Application.DoEvents();
                    }
                    Thread.Sleep(200);                    //Wait 2/10 second to give time for file to be created.
                    Cursor = Cursors.Default;
                    string resulttext    = "";
                    string line          = "";
                    string xChargeToken  = "";
                    string accountMasked = "";
                    string exp           = "";;
                    bool   insertCard    = false;
                    try {
                        using (TextReader reader = new StreamReader(resultfile)) {
                            line = reader.ReadLine();
                            while (line != null)
                            {
                                if (resulttext != "")
                                {
                                    resulttext += "\r\n";
                                }
                                resulttext += line;
                                if (line.StartsWith("RESULT="))
                                {
                                    if (line != "RESULT=SUCCESS")
                                    {
                                        throw new Exception();
                                    }
                                    insertCard = true;
                                }
                                if (line.StartsWith("XCACCOUNTID="))
                                {
                                    xChargeToken = PIn.String(line.Substring(12));
                                }
                                if (line.StartsWith("ACCOUNT="))
                                {
                                    accountMasked = PIn.String(line.Substring(8));
                                }
                                if (line.StartsWith("EXPIRATION="))
                                {
                                    exp = PIn.String(line.Substring(11));
                                }
                                line = reader.ReadLine();
                            }
                            if (insertCard && xChargeToken != "")                           //Might not be necessary but we've had successful charges with no tokens returned before.
                            {
                                creditCardCur = new CreditCard();
                                List <CreditCard> itemOrderCount = CreditCards.Refresh(PatCur.PatNum);
                                creditCardCur.PatNum         = PatCur.PatNum;
                                creditCardCur.ItemOrder      = itemOrderCount.Count;
                                creditCardCur.CCNumberMasked = accountMasked;
                                creditCardCur.XChargeToken   = xChargeToken;
                                creditCardCur.CCExpiration   = new DateTime(Convert.ToInt32("20" + PIn.String(exp.Substring(2, 2))), Convert.ToInt32(PIn.String(exp.Substring(0, 2))), 1);
                                creditCardCur.Procedures     = PrefC.GetString(PrefName.DefaultCCProcs);
                                creditCardCur.CCSource       = CreditCardSource.XServer;
                                creditCardCur.ClinicNum      = Clinics.ClinicNum;
                                CreditCards.Insert(creditCardCur);
                            }
                        }
                    }
                    catch (Exception) {
                        MsgBox.Show(this, "There was a problem adding the credit card.  Please try again.");
                    }
                }
                if (hasPayConnect)
                {
                    FormPayConnect FormPC = new FormPayConnect(Clinics.ClinicNum, PatCur, (decimal)0.01, creditCardCur, true);
                    FormPC.ShowDialog();
                }
                if (hasPaySimple)
                {
                    FormPaySimple formPS = new FormPaySimple(Clinics.ClinicNum, PatCur, (decimal)0.01, creditCardCur, true);
                    formPS.ShowDialog();
                }
                FillGrid();
                if (gridMain.ListGridRows.Count > 0 && creditCardCur != null)
                {
                    gridMain.SetSelected(gridMain.ListGridRows.Count - 1, true);
                }
                return;
            }
            //storing CC numbers allowed from here down
            FormCreditCardEdit FormCCE = new FormCreditCardEdit(PatCur);

            FormCCE.CreditCardCur            = new CreditCard();
            FormCCE.CreditCardCur.IsNew      = true;
            FormCCE.CreditCardCur.Procedures = PrefC.GetString(PrefName.DefaultCCProcs);
            FormCCE.ShowDialog();
            if (FormCCE.DialogResult == DialogResult.OK)
            {
                FillGrid();
                if (gridMain.ListGridRows.Count > 0)
                {
                    gridMain.SetSelected(gridMain.ListGridRows.Count - 1, true);
                }
            }
        }
Esempio n. 12
0
        ///<summary>If using the Add button on FormEhrNotPerformed, an input box will allow the user to select from the list of available items that are not being performed.  The SelectedItemIndex will hold the index of the item selected wich corresponds to the enum EhrNotPerformedItem.  We will use this selected item index to set the EhrNotPerformed code and code system.</summary>
        private void FormEhrNotPerformedEdit_Load(object sender, EventArgs e)
        {
            if (IsDateReadOnly)
            {
                textDate.ReadOnly = true;
            }
            List <string> listValueSetOIDs = new List <string>();

            switch (SelectedItemIndex)
            {
            case 0:                    //BMIExam
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.600.1.681"
                };                                                                                         //'BMI LOINC Value' value set
                break;

            case 1:                    //InfluenzaVaccination
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.526.3.402", "2.16.840.1.113883.3.526.3.1254"
                };                                                                                                                             //'Influenza Vaccination' and 'Influenza Vaccine' value sets
                radioMedReason.Visible = true;
                radioPatReason.Visible = true;
                radioSysReason.Visible = true;
                break;

            case 2:                    //TobaccoScreening
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.526.3.1278"
                };                                                                                             //'Tobacco Use Screening' value set
                break;

            case 3:                    //DocumentCurrentMeds
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.600.1.462"
                };                                                                                            //'Current Medications Documented SNMD' value set
                break;

            default:                    //should never happen
                break;
            }
            List <EhrCode> listEhrCodes = EhrCodes.GetForValueSetOIDs(listValueSetOIDs, true);

            if (listEhrCodes.Count == 0)           //This should only happen if the EHR.dll does not exist or if the codes in the ehrcode list do not exist in the corresponding table
            {
                MsgBox.Show(this, "The codes used for Not Performed items do not exist in the table in your database.  You should run the Code System Importer tool in Setup | Chart | EHR.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (EhrNotPerfCur.IsNew)             //if new, CodeValue and CodeSystem are not set, might have to select one
            {
                if (listEhrCodes.Count == 1)     //only one code in the selected value set, use it
                {
                    EhrNotPerfCur.CodeValue  = listEhrCodes[0].CodeValue;
                    EhrNotPerfCur.CodeSystem = listEhrCodes[0].CodeSystem;
                }
                else
                {
                    List <string> listCodeDescripts = new List <string>();
                    for (int i = 0; i < listEhrCodes.Count; i++)
                    {
                        listCodeDescripts.Add(listEhrCodes[i].CodeValue + " - " + listEhrCodes[i].Description);
                    }
                    InputBox chooseItem = new InputBox(Lan.g(this, "Select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed from the list below."), listCodeDescripts);
                    if (SelectedItemIndex == (int)EhrNotPerformedItem.InfluenzaVaccination)
                    {
                        //chooseItem.comboSelection.DropDownWidth=730;
                    }
                    if (chooseItem.ShowDialog() != DialogResult.OK)
                    {
                        DialogResult = DialogResult.Cancel;
                        return;
                    }
                    if (chooseItem.comboSelection.SelectedIndex == -1)
                    {
                        MsgBox.Show(this, "You must select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed.");
                        DialogResult = DialogResult.Cancel;
                        return;
                    }
                    EhrNotPerfCur.CodeValue  = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeValue;
                    EhrNotPerfCur.CodeSystem = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeSystem;
                }
            }
            for (int i = 0; i < listEhrCodes.Count; i++)
            {
                if (listEhrCodes[i].CodeValue == EhrNotPerfCur.CodeValue && listEhrCodes[i].CodeSystem == EhrNotPerfCur.CodeSystem)
                {
                    textDescription.Text = listEhrCodes[i].Description;
                }
            }
            textCode.Text       = EhrNotPerfCur.CodeValue;
            textCodeSystem.Text = EhrNotPerfCur.CodeSystem;
            textDate.Text       = EhrNotPerfCur.DateEntry.ToShortDateString();
            textNote.Text       = EhrNotPerfCur.Note;
            FillReasonList();
            if (comboCodeReason.SelectedIndex > 0)
            {
                textCodeSystemReason.Text  = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].CodeSystem;
                textDescriptionReason.Text = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].Description;
            }
        }
Esempio n. 13
0
        private void butOK_Click(object sender, EventArgs e)
        {
            //validate--------------------------------------
            DateTime date;

            if (textDate.Text == "")
            {
                MsgBox.Show(this, "Please enter a date.");
                return;
            }
            try {
                date = DateTime.Parse(textDate.Text);
            }
            catch {
                MsgBox.Show(this, "Please fix date first.");
                return;
            }
            string codeVal = "";
            string codeSys = "";

            if (gridMain.GetSelectedIndex() == -1)           //no intervention code selected
            {
                MsgBox.Show(this, "You must select a code for this intervention.");
                return;
            }
            else
            {
                codeVal = listCodes[gridMain.GetSelectedIndex()].CodeValue;
                codeSys = listCodes[gridMain.GetSelectedIndex()].CodeSystem;
            }
            //save--------------------------------------
            //Intervention grid may contain medications, have to insert a new med if necessary and load FormMedPat for user to input data
            if (codeSys == "RXNORM" && !checkPatientDeclined.Checked)
            {
                //codeVal will be RxCui of medication, see if it already exists in Medication table
                Medication medCur = Medications.GetMedicationFromDbByRxCui(PIn.Long(codeVal));
                if (medCur == null)               //no med with this RxCui, create one
                {
                    medCur = new Medication();
                    Medications.Insert(medCur);                    //so that we will have the primary key
                    medCur.GenericNum = medCur.MedicationNum;
                    medCur.RxCui      = PIn.Long(codeVal);
                    medCur.MedName    = RxNorms.GetDescByRxCui(codeVal);
                    Medications.Update(medCur);
                    Medications.RefreshCache();                    //refresh cache to include new medication
                }
                MedicationPat medPatCur = new MedicationPat();
                medPatCur.PatNum        = InterventionCur.PatNum;
                medPatCur.ProvNum       = InterventionCur.ProvNum;
                medPatCur.MedicationNum = medCur.MedicationNum;
                medPatCur.RxCui         = medCur.RxCui;
                medPatCur.DateStart     = date;
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = medPatCur;
                FormMP.IsNew            = true;
                FormMP.ShowDialog();
                if (FormMP.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (FormMP.MedicationPatCur.DateStart.Date < InterventionCur.DateEntry.AddMonths(-6).Date || FormMP.MedicationPatCur.DateStart.Date > InterventionCur.DateEntry.Date)
                {
                    MsgBox.Show(this, "The medication order just entered is not within the 6 months prior to the date of this intervention.  You can modify the date of the medication order in the patient's medical history section.");
                }
                DialogResult = DialogResult.OK;
                return;
            }
            InterventionCur.DateEntry     = date;
            InterventionCur.CodeValue     = codeVal;
            InterventionCur.CodeSystem    = codeSys;
            InterventionCur.Note          = textNote.Text;
            InterventionCur.IsPatDeclined = checkPatientDeclined.Checked;
            string selectedCodeSet = comboCodeSet.SelectedItem.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];

            if (IsAllTypes)                   //CodeSet will be set by calling function unless showing all types, in which case we need to determine which InterventionCodeSet to assign
            {
                if (selectedCodeSet == "All") //All types showing and set to All, have to determine which InterventionCodeSet this code belongs to
                {
                    List <string> listVSFound = new List <string>();
                    foreach (KeyValuePair <string, string> kvp in dictValueCodeSets)
                    {
                        List <EhrCode> listCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                            kvp.Value
                        }, true);
                        for (int i = 0; i < listCodes.Count; i++)
                        {
                            if (listCodes[i].CodeValue == codeVal)
                            {
                                listVSFound.Add(kvp.Key);
                                break;
                            }
                        }
                    }
                    if (listVSFound.Count > 1)                   //Selected code found in more than one value set, ask the user which InterventionCodeSet to assign to this intervention
                    {
                        InputBox chooseSet = new InputBox(Lan.g(this, "The selected code belongs to more than one intervention code set.  Select the code set to assign to this intervention from the list below."), listVSFound);
                        if (chooseSet.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        if (chooseSet.comboSelection.SelectedIndex == -1)
                        {
                            MsgBox.Show(this, "You must select an intervention code set for the selected code.");
                            return;
                        }
                        selectedCodeSet = chooseSet.comboSelection.SelectedItem.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];
                    }
                    else                      //the code must belong to at least one value set, since count in listVSFound is not greater than 1, it must be a code from exactly one set, use that for the InterventionCodeSet
                    {
                        selectedCodeSet = listVSFound[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];
                    }
                }
                InterventionCur.CodeSet = (InterventionCodeSet)Enum.Parse(typeof(InterventionCodeSet), selectedCodeSet);
            }
            //Nutrition is used for both nutrition and physical activity counseling for children, we have to determine which set this code belongs to
            else if (InterventionCur.CodeSet == InterventionCodeSet.Nutrition && selectedCodeSet != "Nutrition") //Nutrition set by calling form, user is showing all or physical activity codes only
            {
                if (selectedCodeSet == "All")                                                                    //showing all codes from Nutrition and PhysicalActivity interventions, determine which set it belongs to
                //No codes exist in both code sets, so if it is not in the PhysicalActivity code set, we can safely assume this is a Nutrition intervention
                {
                    List <EhrCode> listCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                        dictValueCodeSets[InterventionCodeSet.PhysicalActivity.ToString() + " Counseling"]
                    }, true);
                    for (int i = 0; i < listCodes.Count; i++)
                    {
                        if (listCodes[i].CodeValue == codeVal)
                        {
                            InterventionCur.CodeSet = InterventionCodeSet.PhysicalActivity;
                            break;
                        }
                    }
                }
                else
                {
                    InterventionCur.CodeSet = InterventionCodeSet.PhysicalActivity;
                }
            }
            else
            {
                //if not all types, and not Nutrition with All or PhysicalActivity selected in combo box, the code set sent in by calling form will remain the code set for this intervention
            }
            if (InterventionCur.IsNew)
            {
                Interventions.Insert(InterventionCur);
            }
            else
            {
                Interventions.Update(InterventionCur);
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 14
0
        public static Bug AddBugAndJob(ODForm form, List <BugSubmission> listSelectedSubs, Patient pat)
        {
            if (!JobPermissions.IsAuthorized(JobPerm.Concept, true) &&
                !JobPermissions.IsAuthorized(JobPerm.NotifyCustomer, true) &&
                !JobPermissions.IsAuthorized(JobPerm.FeatureManager, true) &&
                !JobPermissions.IsAuthorized(JobPerm.Documentation, true))
            {
                return(null);
            }
            if (listSelectedSubs.Count == 0)
            {
                MsgBox.Show(form, "You must select a bug submission to create a job for.");
                return(null);
            }
            Job jobNew = new Job();

            jobNew.Category = JobCategory.Bug;
            InputBox titleBox = new InputBox("Provide a brief title for the job.");

            if (titleBox.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(titleBox.textResult.Text))
            {
                MsgBox.Show(form, "You must type a title to create a job.");
                return(null);
            }
            List <Def> listJobPriorities = Defs.GetDefsForCategory(DefCat.JobPriorities, true);

            if (listJobPriorities.Count == 0)
            {
                MsgBox.Show(form, "You have no priorities setup in definitions.");
                return(null);
            }
            jobNew.Title = titleBox.textResult.Text;
            long priorityNum = 0;

            priorityNum           = listJobPriorities.FirstOrDefault(x => x.ItemValue.Contains("BugDefault")).DefNum;
            jobNew.Priority       = priorityNum == 0?listJobPriorities.First().DefNum:priorityNum;
            jobNew.PhaseCur       = JobPhase.Concept;
            jobNew.UserNumConcept = Security.CurUser.UserNum;
            Bug bugNew = new Bug();

            bugNew = Bugs.GetNewBugForUser();
            InputBox bugDescription = new InputBox("Provide a brief description for the bug. This will appear in the bug tracker.", jobNew.Title);

            if (bugDescription.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(bugDescription.textResult.Text))
            {
                MsgBox.Show(form, "You must type a description to create a bug.");
                return(null);
            }
            FormVersionPrompt FormVP = new FormVersionPrompt("Enter versions found");

            FormVP.ShowDialog();
            if (FormVP.DialogResult != DialogResult.OK || string.IsNullOrEmpty(FormVP.VersionText))
            {
                MsgBox.Show(form, "You must enter a version to create a bug.");
                return(null);
            }
            bugNew.Status_       = BugStatus.Accepted;
            bugNew.VersionsFound = FormVP.VersionText;
            bugNew.Description   = bugDescription.textResult.Text;
            BugSubmission sub = listSelectedSubs.First();

            jobNew.Requirements = BugSubmissions.GetSubmissionDescription(pat, sub);
            Jobs.Insert(jobNew);
            JobLink jobLinkNew = new JobLink();

            jobLinkNew.LinkType = JobLinkType.Bug;
            jobLinkNew.JobNum   = jobNew.JobNum;
            jobLinkNew.FKey     = Bugs.Insert(bugNew);
            JobLinks.Insert(jobLinkNew);
            BugSubmissions.UpdateBugIds(bugNew.BugId, listSelectedSubs.Select(x => x.BugSubmissionNum).ToList());
            if (MsgBox.Show(form, MsgBoxButtons.YesNo, "Would you like to create a task too?"))
            {
                long taskNum = CreateTask(pat, sub);
                if (taskNum != 0)
                {
                    jobLinkNew          = new JobLink();
                    jobLinkNew.LinkType = JobLinkType.Task;
                    jobLinkNew.JobNum   = jobNew.JobNum;
                    jobLinkNew.FKey     = taskNum;
                    JobLinks.Insert(jobLinkNew);
                }
            }
            Signalods.SetInvalid(InvalidType.Jobs, KeyType.Job, jobNew.JobNum);
            FormOpenDental.S_GoToJob(jobNew.JobNum);
            return(bugNew);
        }
Esempio n. 15
0
        private void FormRepeatChargeEdit_Load(object sender, EventArgs e)
        {
            SetPatient();
            if (IsNew)
            {
                FormProcCodes FormP = new FormProcCodes();
                FormP.IsSelectionMode = true;
                FormP.ShowDialog();
                if (FormP.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                ProcedureCode procCode = ProcedureCodes.GetProcCode(FormP.SelectedCodeNum);
                if (procCode.TreatArea != TreatmentArea.Mouth &&
                    procCode.TreatArea != TreatmentArea.None)
                {
                    MsgBox.Show(this, "Procedure codes that require tooth numbers are not allowed.");
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                RepeatCur.ProcCode     = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum);
                RepeatCur.IsEnabled    = true;
                RepeatCur.CreatesClaim = false;
            }
            textCode.Text      = RepeatCur.ProcCode;
            textDesc.Text      = ProcedureCodes.GetProcCode(RepeatCur.ProcCode).Descript;
            textChargeAmt.Text = RepeatCur.ChargeAmt.ToString("F");
            if (RepeatCur.DateStart.Year > 1880)
            {
                textDateStart.Text = RepeatCur.DateStart.ToShortDateString();
            }
            if (RepeatCur.DateStop.Year > 1880)
            {
                textDateStop.Text = RepeatCur.DateStop.ToShortDateString();
            }
            textNote.Text = RepeatCur.Note;
            _isErx        = false;
            if (PrefC.GetBool(PrefName.DistributorKey) && Regex.IsMatch(RepeatCur.ProcCode, "^Z[0-9]{3,}$"))            //Is eRx if HQ and a using an eRx Z code.
            {
                _isErx = true;
                labelPatNum.Visible       = true;
                textPatNum.Visible        = true;
                butMoveTo.Visible         = true;
                labelNpi.Visible          = true;
                textNpi.Visible           = true;
                labelProviderName.Visible = true;
                textProvName.Visible      = true;
                labelErxAccountId.Visible = true;
                textErxAccountId.Visible  = true;
                if (IsNew && RepeatCur.ProcCode == "Z100")               //DoseSpot Procedure Code
                {
                    List <string> listDoseSpotAccountIds = ClinicErxs.GetAccountIdsForPatNum(RepeatCur.PatNum)
                                                           .Union(ProviderErxs.GetAccountIdsForPatNum(RepeatCur.PatNum))
                                                           .Union(
                        RepeatCharges.GetForErx()
                        .FindAll(x => x.PatNum == RepeatCur.PatNum && x.ProcCode == "Z100")
                        .Select(x => x.ErxAccountId)
                        .ToList()
                        )
                                                           .Distinct()
                                                           .ToList()
                                                           .FindAll(x => DoseSpot.IsDoseSpotAccountId(x));
                    if (listDoseSpotAccountIds.Count == 0)
                    {
                        listDoseSpotAccountIds.Add(DoseSpot.GenerateAccountId(RepeatCur.PatNum));
                    }
                    if (listDoseSpotAccountIds.Count == 1)
                    {
                        textErxAccountId.Text = listDoseSpotAccountIds[0];
                    }
                    else if (listDoseSpotAccountIds.Count > 1)
                    {
                        InputBox inputAccountIds = new InputBox(Lans.g(this, "Multiple Account IDs found.  Select one to assign to this repeat charge."), listDoseSpotAccountIds, 0);
                        inputAccountIds.ShowDialog();
                        if (inputAccountIds.DialogResult == DialogResult.OK)
                        {
                            textErxAccountId.Text = listDoseSpotAccountIds[inputAccountIds.SelectedIndex];
                        }
                    }
                }
                else                  //Existing eRx repeating charge.
                {
                    textNpi.Text              = RepeatCur.Npi;
                    textErxAccountId.Text     = RepeatCur.ErxAccountId;
                    textProvName.Text         = RepeatCur.ProviderName;
                    textNpi.ReadOnly          = true;
                    textErxAccountId.ReadOnly = true;
                    textProvName.ReadOnly     = true;
                }
            }
            checkCopyNoteToProc.Checked = RepeatCur.CopyNoteToProc;
            checkCreatesClaim.Checked   = RepeatCur.CreatesClaim;
            checkIsEnabled.Checked      = RepeatCur.IsEnabled;
            if (PrefC.GetBool(PrefName.DistributorKey))             //OD HQ disable the IsEnabled and CreatesClaim checkboxes
            {
                checkCreatesClaim.Enabled = false;
                checkIsEnabled.Enabled    = false;
            }
            if (PrefC.IsODHQ && EServiceCodeLink.IsProcCodeAnEService(RepeatCur.ProcCode))
            {
                if (IsNew)
                {
                    MsgBox.Show(this, "You cannot manually create any eService repeating charges.\r\n"
                                + "Use the Signup Portal instead.\r\n\r\n"
                                + "The Charge Amount can be manually edited after the Signup Portal has created the desired eService repeating charge.");
                    DialogResult = DialogResult.Abort;
                    return;
                }
                //The only things that users should be able to do for eServices are:
                //1. Change the repeating charge amount.
                //2. Manipulate the Start Date.
                //3. Manipulate the Note.
                //4. Manipulate Billing Day because not all customers will have a non-eService repeating charge in order to manipulate.
                //This is because legacy users (versions prior to 17.1) need the ability to manually set their monthly charge amount, etc.
                SetFormReadOnly(this, butOK, butCancel
                                , textChargeAmt, labelChargeAmount
                                , textDateStart, labelDateStart
                                , textNote, labelNote
                                , textBillingDay, labelBillingCycleDay);
            }
            Patient pat = Patients.GetPat(RepeatCur.PatNum);          //pat should never be null. If it is, this will fail.

            //If this is a new repeat charge and no other active repeat charges exist, set the billing cycle day to today
            if (IsNew && !RepeatCharges.ActiveRepeatChargeExists(RepeatCur.PatNum))
            {
                textBillingDay.Text = DateTimeOD.Today.Day.ToString();
            }
            else
            {
                textBillingDay.Text = pat.BillingCycleDay.ToString();
            }
            if (PrefC.GetBool(PrefName.BillingUseBillingCycleDay))
            {
                labelBillingCycleDay.Visible = true;
                textBillingDay.Visible       = true;
            }
            checkUsePrepay.Checked = RepeatCur.UsePrepay;
        }