private void FormRecurringCharges_Load(object sender, EventArgs e)
 {
     nowDateTime       = MiscData.GetNowDateTime();
     prog              = Programs.GetCur(ProgramName.Xcharge);
     xPath             = Programs.GetProgramPath(prog);
     labelCharged.Text = Lan.g(this, "Charged=") + "0";
     labelFailed.Text  = Lan.g(this, "Failed=") + "0";
     FillGrid();
     gridMain.SetSelected(true);
     labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
 }
예제 #2
0
        private void FormXchargeTokenTool_Load(object sender, EventArgs e)
        {
            Program prog = Programs.GetCur(ProgramName.Xcharge);

            if (prog == null || !prog.Enabled)
            {
                MsgBox.Show(this, "X-Charge program link is not set up.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            string path = Programs.GetProgramPath(prog);

            if (!File.Exists(path))
            {
                MsgBox.Show(this, "X-Charge path is not valid.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            //In order for X-Charge to be enabled, the enabled flag must be set and there must be a valid Username, Password, and PaymentType
            //If clinics are enabled, the Username, Password, and PaymentType fields are allowed to be blank/invalid for any clinic not using X-Charge
            //Therefore, we will validate the credentials and payment type using FormOpenDental.ClinicNum
            string     paymentType      = ProgramProperties.GetPropVal(prog.ProgramNum, "PaymentType", Clinics.ClinicNum);
            List <Def> _listPayTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true).FindAll(x => x.DefNum.ToString() == paymentType);      //should be a list of 0 or 1

            _xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum);
            _xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum);
            if (string.IsNullOrEmpty(_xUsername) || string.IsNullOrEmpty(_xPassword) || _listPayTypeDefs.Count < 1)
            {
                MsgBox.Show(this, "X-Charge username, password, or payment type for this clinic is invalid.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            _listCreditCards = CreditCards.GetCardsWithTokenBySource(
                new List <CreditCardSource> {
                CreditCardSource.XServer, CreditCardSource.XServerPayConnect
            });
            textTotal.Text    = _listCreditCards.Count.ToString();
            textVerified.Text = "0";
            textInvalid.Text  = "0";
            if (_listCreditCards.Count == 0)
            {
                MsgBox.Show(this, "There are no credit cards with stored X-Charge tokens in the database.");
                return;
            }
        }
예제 #3
0
        private void FormXchargeTokenTool_Load(object sender, EventArgs e)
        {
            CardList          = CreditCards.GetCreditCardsWithTokens();
            textTotal.Text    = CardList.Count.ToString();
            textVerified.Text = "0";
            textInvalid.Text  = "0";
            Program prog = Programs.GetCur(ProgramName.Xcharge);
            string  path = Programs.GetProgramPath(prog);

            if (prog == null || !prog.Enabled)
            {
                MsgBox.Show(this, "X-Charge entry is not set up.");               //should never happen
                butCheck.Visible = false;
                return;
            }
            if (!File.Exists(path))
            {
                MsgBox.Show(this, "X-Charge path is not valid.");
                butCheck.Visible = false;
                return;
            }
        }
예제 #4
0
        private void FilterCardList()
        {
            int verified = 0;
            int invalid  = 0;

            textVerified.Text = "0";
            textInvalid.Text  = "0";
            for (int i = _listCreditCards.Count - 1; i >= 0; i--)     //looping backwards to remove cards that are valid
            {
                Program          prog       = Programs.GetCur(ProgramName.Xcharge);
                string           path       = Programs.GetProgramPath(prog);
                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.");
                    break;
                }
                info.Arguments += "/TRANSACTIONTYPE:ARCHIVEVAULTQUERY ";
                info.Arguments += "/XCACCOUNTID:" + _listCreditCards[i].XChargeToken + " ";
                info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                info.Arguments += "/USERID:" + ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum) + " ";
                info.Arguments += "/PASSWORD:"******"Password", Clinics.ClinicNum)) + " ";
                info.Arguments += "/AUTOPROCESS ";
                info.Arguments += "/AUTOCLOSE ";
                info.Arguments += "/NORESULTDIALOG ";
                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.
                string resulttext = "";
                string line       = "";
                string account    = "";
                string exp        = "";
                try {
                    using (TextReader reader = new StreamReader(resultfile)) {
                        line = reader.ReadLine();
                        while (line != null)
                        {
                            if (resulttext != "")
                            {
                                resulttext += "\r\n";
                            }
                            resulttext += line;
                            if (line.StartsWith("ACCOUNT="))
                            {
                                account = line.Substring(8);
                            }
                            else if (line.StartsWith("EXPIRATION="))
                            {
                                exp = line.Substring(11);
                            }
                            line = reader.ReadLine();
                        }
                        if (_listCreditCards[i].CCNumberMasked.Length > 4 && account.Length > 4 &&
                            _listCreditCards[i].CCNumberMasked.Substring(_listCreditCards[i].CCNumberMasked.Length - 4) == account.Substring(account.Length - 4) &&
                            _listCreditCards[i].CCExpiration.ToString("MMyy") == exp)
                        {
                            //The credit card on file matches the one in X-Charge, so remove from the list.
                            _listCreditCards.RemoveAt(i);
                            verified++;
                        }
                        else
                        {
                            invalid++;
                        }
                    }
                }
                catch {
                    MsgBox.Show(this, "Something went wrong validating X-Charge tokens.  Please try again.");
                    break;
                }
                textVerified.Text = verified.ToString();
                textInvalid.Text  = invalid.ToString();
            }
        }
예제 #5
0
        private void FormRecurringCharges_Load(object sender, EventArgs e)
        {
            if (Programs.HasMultipleCreditCardProgramsEnabled())
            {
                gridMain.HScrollVisible = true;
            }
            if (!PrefC.IsODHQ)
            {
                checkHideBold.Checked = true;
                checkHideBold.Visible = false;
            }
            Program progCur = null;

            if (Programs.IsEnabled(ProgramName.PaySimple))
            {
                progCur = Programs.GetCur(ProgramName.PaySimple);
                labelUpdated.Visible         = false;
                checkForceDuplicates.Checked = false;
                checkForceDuplicates.Visible = false;              //PaySimple always rejects identical transactions made within 5 minutes of eachother.
            }
            if (Programs.IsEnabled(ProgramName.PayConnect))
            {
                progCur = Programs.GetCur(ProgramName.PayConnect);
                labelUpdated.Visible         = false;
                checkForceDuplicates.Visible = true;
                checkForceDuplicates.Checked = PIn.Bool(ProgramProperties.GetPropValForClinicOrDefault(progCur.ProgramNum,
                                                                                                       PayConnect.ProgramProperties.PayConnectForceRecurringCharge, Clinics.ClinicNum));
            }
            if (Programs.IsEnabled(ProgramName.Xcharge))
            {
                progCur = Programs.GetCur(ProgramName.Xcharge);
                labelUpdated.Visible         = true;
                checkForceDuplicates.Visible = true;
                string xPath = Programs.GetProgramPath(progCur);
                checkForceDuplicates.Checked = PIn.Bool(ProgramProperties.GetPropValForClinicOrDefault(progCur.ProgramNum,
                                                                                                       ProgramProperties.PropertyDescs.XCharge.XChargeForceRecurringCharge, Clinics.ClinicNum));
                if (!File.Exists(xPath))                 //program path is invalid
                //if user has setup permission and they want to edit the program path, show the X-Charge setup window
                {
                    if (Security.IsAuthorized(Permissions.Setup) &&
                        MsgBox.Show(this, MsgBoxButtons.YesNo, "The X-Charge path is not valid.  Would you like to edit the path?"))
                    {
                        FormXchargeSetup FormX = new FormXchargeSetup();
                        FormX.ShowDialog();
                        if (FormX.DialogResult == DialogResult.OK)
                        {
                            //The user could have correctly enabled the X-Charge bridge, we need to update our local _programCur and _xPath variable2
                            progCur = Programs.GetCur(ProgramName.Xcharge);
                            xPath   = Programs.GetProgramPath(progCur);
                        }
                    }
                    //if the program path still does not exist, whether or not they attempted to edit the program link, tell them to edit and close the form
                    if (!File.Exists(xPath))
                    {
                        MsgBox.Show(this, "The X-Charge program path is not valid.  Edit the program link in order to use the CC Recurring Charges feature.");
                        Close();
                        return;
                    }
                }
            }
            if (progCur == null)
            {
                MsgBox.Show(this, "The PayConnect, PaySimple, or X-Charge program link must be enabled in order to use the CC Recurring Charges feature.");
                Close();
                return;
            }
            _isSelecting     = true;
            _listUserClinics = new List <Clinic>();
            if (PrefC.HasClinicsEnabled)
            {
                if (!Security.CurUser.ClinicIsRestricted)
                {
                    _listUserClinics.Add(new Clinic()
                    {
                        Description = Lan.g(this, "Unassigned")
                    });
                }
                Clinics.GetForUserod(Security.CurUser).ForEach(x => _listUserClinics.Add(x));
                for (int i = 0; i < _listUserClinics.Count; i++)
                {
                    listClinics.Items.Add(_listUserClinics[i].Description);
                    listClinics.SetSelected(i, true);
                }
                //checkAllClin.Checked=true;//checked true by default in designer so we don't trigger the event to select all and fill grid
            }
            else
            {
                groupClinics.Visible = false;
            }
            _charger = new RecurringChargerator(new ShowErrors(this), true);
            _charger.SingleCardFinished = new Action(() => {
                this.Invoke(() => {
                    labelCharged.Text = Lans.g(this, "Charged=") + _charger.Success;
                    labelFailed.Text  = Lans.g(this, "Failed=") + _charger.Failed;
                    labelUpdated.Text = Lans.g(this, "Updated=") + _charger.Updated;
                });
            });
            GeneralProgramEvent.Fired += StopRecurringCharges;          //This is so we'll be alerted in case of a shutdown.
            labelCharged.Text          = Lan.g(this, "Charged=") + "0";
            labelFailed.Text           = Lan.g(this, "Failed=") + "0";
            FillGrid(true);
            gridMain.SetSelected(true);
            labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
        }
예제 #6
0
        private List <CreditCard> FilterCardList()
        {
            int verified = 0;
            int invalid  = 0;

            textVerified.Text = verified.ToString();
            textInvalid.Text  = invalid.ToString();
            for (int i = CardList.Count - 1; i >= 0; i--)
            {
                Program          prog       = Programs.GetCur(ProgramName.Xcharge);
                string           path       = Programs.GetProgramPath(prog);
                ProgramProperty  prop       = (ProgramProperty)ProgramProperties.GetForProgram(prog.ProgramNum)[0];
                ProcessStartInfo info       = new ProcessStartInfo(path);
                string           resultfile = Path.Combine(Path.GetDirectoryName(path), "XResult.txt");
                File.Delete(resultfile);                //delete the old result file.
                info.Arguments += "/TRANSACTIONTYPE:ARCHIVEVAULTQUERY ";
                info.Arguments += "/XCACCOUNTID:" + CardList[i].XChargeToken + " ";
                info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                info.Arguments += "/USERID:" + ProgramProperties.GetPropVal(prog.ProgramNum, "Username") + " ";
                info.Arguments += "/PASSWORD:"******"Password") + " ";
                info.Arguments += "/AUTOPROCESS ";
                info.Arguments += "/AUTOCLOSE ";
                info.Arguments += "/NORESULTDIALOG ";
                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.
                string resulttext = "";
                string line       = "";
                string account    = "";
                string exp        = "";
                using (TextReader reader = new StreamReader(resultfile)) {
                    line = reader.ReadLine();
                    while (line != null)
                    {
                        if (resulttext != "")
                        {
                            resulttext += "\r\n";
                        }
                        resulttext += line;
                        if (line.StartsWith("ACCOUNT="))
                        {
                            account = line.Substring(8);
                        }
                        else if (line.StartsWith("EXPIRATION="))
                        {
                            exp = line.Substring(11);
                        }
                        line = reader.ReadLine();
                    }
                    if (CardList[i].CCNumberMasked.Length > 4 && account.Length > 4 &&
                        CardList[i].CCNumberMasked.Substring(CardList[i].CCNumberMasked.Length - 4) == account.Substring(account.Length - 4) &&
                        CardList[i].CCExpiration.ToString("MMyy") == exp)
                    {
                        //The credit card on file matches the one in X-Charge, so remove from the list.
                        CardList.Remove(CardList[i]);
                        verified++;
                    }
                    else
                    {
                        invalid++;
                    }
                }
                textVerified.Text = verified.ToString();
                textInvalid.Text  = invalid.ToString();
            }
            return(CardList);
        }
예제 #7
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);
                }
            }
        }
예제 #8
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!VerifyData())
     {
         return;
     }
     CreditCardCur.ExcludeProcSync = checkExcludeProcSync.Checked;
     CreditCardCur.Address         = textAddress.Text;
     CreditCardCur.CCNumberMasked  = textCardNumber.Text;
     CreditCardCur.PatNum          = PatCur.PatNum;
     CreditCardCur.Zip             = textZip.Text;
     //Create an Audit Trail whenever CanChargeWhenNoBal changes
     if (checkChrgWithNoBal.Checked != CreditCardCur.CanChargeWhenNoBal)
     {
         SecurityLogs.MakeLogEntry(Permissions.AccountModule, PatCur.PatNum, "Credit Card " + CreditCardCur.CCNumberMasked + " set to "
                                   + (CreditCardCur.CanChargeWhenNoBal?"":"not ") + "run charges even when no patient balance is present.");
     }
     CreditCardCur.CanChargeWhenNoBal = checkChrgWithNoBal.Checked;
     if (_isXChargeEnabled || _isPayConnectEnabled || _isPaySimpleEnabled)             //Only update recurring if using X-Charge, PayConnect,or PaySimple.
     {
         CreditCardCur.ChargeAmt = PIn.Double(textChargeAmt.Text);
         CreditCardCur.DateStart = PIn.Date(textDateStart.Text);
         CreditCardCur.DateStop  = PIn.Date(textDateStop.Text);
         CreditCardCur.Note      = textNote.Text;
         if (comboPaymentPlans.SelectedIndex > 0)
         {
             CreditCardCur.PayPlanNum = PayPlanList[comboPaymentPlans.SelectedIndex - 1].PayPlanNum;
         }
         else
         {
             CreditCardCur.PayPlanNum = 0;                  //Allows users to change from a recurring payplan charge to a normal one.
         }
         CreditCardCur.ChargeFrequency = GetFormattedChargeFrequency();
     }
     if (CreditCardCur.IsNew)
     {
         List <CreditCard> itemOrderCount = CreditCards.Refresh(PatCur.PatNum);
         CreditCardCur.ItemOrder = itemOrderCount.Count;
         CreditCardCur.CCSource  = CreditCardSource.None;
         CreditCardCur.ClinicNum = Clinics.ClinicNum;
         CreditCards.Insert(CreditCardCur);
     }
     else
     {
         #region X-Charge
         //Special logic for had a token and changed number or expiration date X-Charge
         if (_isXChargeEnabled && CreditCardCur.XChargeToken != "" &&
             (_creditCardOld.CCNumberMasked != CreditCardCur.CCNumberMasked || _creditCardOld.CCExpiration != CreditCardCur.CCExpiration))
         {
             Program prog = Programs.GetCur(ProgramName.Xcharge);
             string  path = Programs.GetProgramPath(prog);
             if (prog == null)
             {
                 MsgBox.Show(this, "X-Charge entry is missing from the database.");                       //should never happen
                 return;
             }
             if (!prog.Enabled)
             {
                 if (Security.IsAuthorized(Permissions.Setup))
                 {
                     FormXchargeSetup FormX = new FormXchargeSetup();
                     FormX.ShowDialog();
                 }
                 return;
             }
             if (!File.Exists(path))
             {
                 MsgBox.Show(this, "Path is not valid.");
                 if (Security.IsAuthorized(Permissions.Setup))
                 {
                     FormXchargeSetup FormX = new FormXchargeSetup();
                     FormX.ShowDialog();
                 }
                 return;
             }
             //Either update the exp date or update credit card number by deleting archive so new token can be created next time it's used.
             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;
             }
             string xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum);
             string xPassword = CodeBase.MiscUtils.Decrypt(ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum));
             //We can only change exp date for X-Charge via ARCHIVEAULTUPDATE.
             info.Arguments += "/TRANSACTIONTYPE:ARCHIVEVAULTUPDATE ";
             info.Arguments += "/XCACCOUNTID:" + CreditCardCur.XChargeToken + " ";
             if (CreditCardCur.CCExpiration != null && CreditCardCur.CCExpiration.Year > 2005)
             {
                 info.Arguments += "/EXP:" + CreditCardCur.CCExpiration.ToString("MMyy") + " ";
             }
             info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
             info.Arguments += "/USERID:" + xUsername + " ";
             info.Arguments += "/PASSWORD:"******" ";
             info.Arguments += "/AUTOPROCESS ";
             info.Arguments += "/AUTOCLOSE ";
             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       = "";
             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")
                             {
                                 CreditCardCur = CreditCards.GetOne(CreditCardCur.CreditCardNum);
                                 FillData();
                                 return;
                             }
                         }
                         line = reader.ReadLine();
                     }
                 }
             }
             catch {
                 MsgBox.Show(this, "There was a problem creating or editing this card with X-Charge.  Please try again.");
                 return;
             }
         }                //End of special token logic
         #endregion
         #region PayConnect
         //Special logic for had a token and changed expiration date PayConnect
         //We have to compare the year and month of the expiration instead of just comparing expirations because the X-Charge logic stores the
         //expiration day of the month as the 1st in the db, but it makes more sense to set the expriation day of month to the last day in that month.
         //Since we only want to invalidate the PayConnect token if the expiration month or year is different, we will ignore any difference in day.
         if (_isPayConnectEnabled && CreditCardCur.PayConnectToken != "" &&
             (_creditCardOld.CCExpiration.Year != CreditCardCur.CCExpiration.Year ||
              _creditCardOld.CCExpiration.Month != CreditCardCur.CCExpiration.Month))
         {
             //if the expiration is changed, the token is no longer valid, so clear the token and token expiration so a new one can be
             //generated the next time a payment is processed using this card.
             CreditCardCur.PayConnectToken    = "";
             CreditCardCur.PayConnectTokenExp = DateTime.MinValue;
             //To match PaySimple, this should be enhanced to validate the cc number and get a new token.
         }
         #endregion
         #region PaySimple
         //Special logic for had a token and changed number or expiration date PaySimple
         //We have to compare the year and month of the expiration instead of just comparing expirations because the X-Charge logic stores the
         //expiration day of the month as the 1st in the db, but it makes more sense to set the expriation day of month to the last day in that month.
         //Since we only want to invalidate the PayConnect token if the expiration month or year is different, we will ignore any difference in day.
         if (_isPaySimpleEnabled && CreditCardCur.PaySimpleToken != "" &&
             (_creditCardOld.Zip != CreditCardCur.Zip ||
              _creditCardOld.CCExpiration.Year != CreditCardCur.CCExpiration.Year ||
              _creditCardOld.CCExpiration.Month != CreditCardCur.CCExpiration.Month))
         {
             //TODO: Open form to have user enter the CC number.  Then make API call to update cc instead of wiping out token.
             //If the billing zip or the expiration changes, the token is invalid and they need to get a new one.
             CreditCardCur.PaySimpleToken = "";
         }
         #endregion
         CreditCards.Update(CreditCardCur);
     }
     DialogResult = DialogResult.OK;
 }
예제 #9
0
        private void DeleteXChargeAlias()
        {
            Program prog = Programs.GetCur(ProgramName.Xcharge);
            string  path = Programs.GetProgramPath(prog);

            if (prog == null)
            {
                MsgBox.Show(this, "X-Charge entry is missing from the database.");               //should never happen
                return;
            }
            if (!prog.Enabled)
            {
                if (Security.IsAuthorized(Permissions.Setup))
                {
                    FormXchargeSetup FormX = new FormXchargeSetup();
                    FormX.ShowDialog();
                }
                return;
            }
            if (!File.Exists(path))
            {
                MsgBox.Show(this, "Path is not valid.");
                if (Security.IsAuthorized(Permissions.Setup))
                {
                    FormXchargeSetup FormX = new FormXchargeSetup();
                    FormX.ShowDialog();
                }
                return;
            }
            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;
            }
            string xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum);
            string xPassword = CodeBase.MiscUtils.Decrypt(ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum));

            info.Arguments += "/TRANSACTIONTYPE:ARCHIVEVAULTDELETE ";
            info.Arguments += "/XCACCOUNTID:" + CreditCardCur.XChargeToken + " ";
            info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
            info.Arguments += "/USERID:" + xUsername + " ";
            info.Arguments += "/PASSWORD:"******" ";
            info.Arguments += "/AUTOPROCESS ";
            info.Arguments += "/AUTOCLOSE ";
            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 line = "";

            try {
                using (TextReader reader = new StreamReader(resultfile)) {
                    line = reader.ReadLine();
                    while (line != null)
                    {
                        if (line == "RESULT=SUCCESS")
                        {
                            break;
                        }
                        if (line.StartsWith("DESCRIPTION") && !line.Contains("Alias does not exist"))                         //If token doesn't exist in X-Charge, still delete from OD
                        {
                            MsgBox.Show(this, "There was a problem deleting this card within X-Charge.  Please try again.");
                            return;                            //Don't delete the card from OD
                        }
                        line = reader.ReadLine();
                    }
                }
            }
            catch {
                MsgBox.Show(this, "Could not read XResult.txt file.  It may be in use by another program, flagged as read-only, or you might not have "
                            + "sufficient permissions.");
                return;
            }
        }
예제 #10
0
        ///<summary>Typically used when user clicks a button to a Program link.  This method attempts to identify and execute the program based on the given programNum.</summary>
        public static void Execute(long programNum, Patient pat)
        {
            Program prog = null;

            for (int i = 0; i < ProgramC.Listt.Count; i++)
            {
                if (ProgramC.Listt[i].ProgramNum == programNum)
                {
                    prog = ProgramC.Listt[i];
                }
            }
            if (prog == null)           //no match was found
            {
                MessageBox.Show("Error, program entry not found in database.");
                return;
            }
            if (prog.PluginDllName != "")
            {
                if (pat != null)
                {
                    Plugins.LaunchToolbarButton(programNum, pat.PatNum);
                }
                return;
            }
            if (prog.ProgName == ProgramName.Apixia.ToString())
            {
                Apixia.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apteryx.ToString())
            {
                Apteryx.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.BioPAK.ToString())
            {
                BioPAK.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Camsight.ToString())
            {
                Camsight.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CaptureLink.ToString())
            {
                CaptureLink.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Cerec.ToString())
            {
                Cerec.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CliniView.ToString())
            {
                Cliniview.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ClioSoft.ToString())
            {
                ClioSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DBSWin.ToString())
            {
                DBSWin.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.DentalEye.ToString())
            {
                DentalEye.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentalStudio.ToString())
            {
                DentalStudio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentX.ToString())
            {
                DentX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DrCeph.ToString())
            {
                DrCeph.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.DentForms.ToString())
            {
                DentForms.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dexis.ToString())
            {
                Dexis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Digora.ToString())
            {
                Digora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dolphin.ToString())
            {
                Dolphin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dxis.ToString())
            {
                Dxis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EvaSoft.ToString())
            {
                EvaSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EwooEZDent.ToString())
            {
                Ewoo.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.FloridaProbe.ToString())
            {
                FloridaProbe.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Guru.ToString())
            {
                Guru.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HouseCalls.ToString())
            {
                FormHouseCalls FormHC = new FormHouseCalls();
                FormHC.ProgramCur = prog;
                FormHC.ShowDialog();
                return;
            }
            else if (prog.ProgName == ProgramName.iCat.ToString())
            {
                ICat.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ImageFX.ToString())
            {
                ImageFX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Lightyear.ToString())
            {
                Lightyear.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MediaDent.ToString())
            {
                MediaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MiPACS.ToString())
            {
                MiPACS.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Owandy.ToString())
            {
                Owandy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Patterson.ToString())
            {
                Patterson.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PerioPal.ToString())
            {
                PerioPal.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Planmeca.ToString())
            {
                Planmeca.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Progeny.ToString())
            {
                Progeny.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PT.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, false);
                return;
            }
            else if (prog.ProgName == ProgramName.PTupdate.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, true);
                return;
            }
            else if (prog.ProgName == ProgramName.RayMage.ToString())
            {
                RayMage.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Schick.ToString())
            {
                Schick.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.Sirona.ToString())
            {
                Sirona.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Sopro.ToString())
            {
                Sopro.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TigerView.ToString())
            {
                TigerView.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Trophy.ToString())
            {
                Trophy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TrophyEnhanced.ToString())
            {
                TrophyEnhanced.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Tscan.ToString())
            {
                Tscan.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Vipersoft.ToString())
            {
                Vipersoft.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.VixWin.ToString())
            {
                VixWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase41.ToString())
            {
                VixWinBase41.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinOld.ToString())
            {
                VixWinOld.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.XDR.ToString())
            {
                Dexis.SendData(prog, pat);               //XDR uses the Dexis protocol
                return;
            }
            //all remaining programs:
            try{
                string cmdline = prog.CommandLine;
                string path    = Programs.GetProgramPath(prog);
                if (pat != null)
                {
                    cmdline = cmdline.Replace("[LName]", pat.LName);
                    cmdline = cmdline.Replace("[FName]", pat.FName);
                    cmdline = cmdline.Replace("[PatNum]", pat.PatNum.ToString());
                    cmdline = cmdline.Replace("[ChartNumber]", pat.ChartNumber);
                    cmdline = cmdline.Replace("[WirelessPhone]", pat.WirelessPhone);
                    cmdline = cmdline.Replace("[HmPhone]", pat.HmPhone);
                    cmdline = cmdline.Replace("[WkPhone]", pat.WkPhone);
                    cmdline = cmdline.Replace("[LNameLetter]", pat.LName.Substring(0, 1).ToUpper());
                    path    = path.Replace("[LName]", pat.LName);
                    path    = path.Replace("[FName]", pat.FName);
                    path    = path.Replace("[PatNum]", pat.PatNum.ToString());
                    path    = path.Replace("[ChartNumber]", pat.ChartNumber);
                    path    = path.Replace("[WirelessPhone]", pat.WirelessPhone);
                    path    = path.Replace("[HmPhone]", pat.HmPhone);
                    path    = path.Replace("[WkPhone]", pat.WkPhone);
                    path    = path.Replace("[LNameLetter]", pat.LName.Substring(0, 1).ToUpper());
                }
                Process.Start(path, cmdline);
            }
            catch {
                MessageBox.Show(prog.ProgDesc + " is not available.");
                return;
            }
        }
예제 #11
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!VerifyData())
     {
         return;
     }
     CreditCardCur.Address        = textAddress.Text;
     CreditCardCur.CCNumberMasked = textCardNumber.Text;
     CreditCardCur.PatNum         = PatCur.PatNum;
     CreditCardCur.Zip            = textZip.Text;
     if (IsXCharge)             //Only update recurring if using X-Charge.
     {
         CreditCardCur.ChargeAmt = PIn.Double(textChargeAmt.Text);
         CreditCardCur.DateStart = PIn.Date(textDateStart.Text);
         CreditCardCur.DateStop  = PIn.Date(textDateStop.Text);
         CreditCardCur.Note      = textNote.Text;
         if (comboPaymentPlans.SelectedIndex > 0)
         {
             CreditCardCur.PayPlanNum = PayPlanList[comboPaymentPlans.SelectedIndex - 1].PayPlanNum;
         }
         else
         {
             CreditCardCur.PayPlanNum = 0;                  //Allows users to change from a recurring payplan charge to a normal one.
         }
     }
     if (CreditCardCur.IsNew)
     {
         List <CreditCard> itemOrderCount = CreditCards.Refresh(PatCur.PatNum);
         CreditCardCur.ItemOrder = itemOrderCount.Count;
         CreditCards.Insert(CreditCardCur);
     }
     else
     {
         #region X-Charge
         //Special logic for had a token and changed number or expiration date
         if (CreditCardCur.XChargeToken != "" && IsXCharge &&
             (CreditCardOld.CCNumberMasked != CreditCardCur.CCNumberMasked || CreditCardOld.CCExpiration != CreditCardCur.CCExpiration))
         {
             Program prog = Programs.GetCur(ProgramName.Xcharge);
             string  path = Programs.GetProgramPath(prog);
             if (prog == null)
             {
                 MsgBox.Show(this, "X-Charge entry is missing from the database.");                       //should never happen
                 return;
             }
             if (!prog.Enabled)
             {
                 if (Security.IsAuthorized(Permissions.Setup))
                 {
                     FormXchargeSetup FormX = new FormXchargeSetup();
                     FormX.ShowDialog();
                 }
                 return;
             }
             if (!File.Exists(path))
             {
                 MsgBox.Show(this, "Path is not valid.");
                 if (Security.IsAuthorized(Permissions.Setup))
                 {
                     FormXchargeSetup FormX = new FormXchargeSetup();
                     FormX.ShowDialog();
                 }
                 return;
             }
             //Either update the exp date or update credit card number by deleting archive so new token can be created next time it's used.
             ProgramProperty  prop       = (ProgramProperty)ProgramProperties.GetForProgram(prog.ProgramNum)[0];
             ProcessStartInfo info       = new ProcessStartInfo(path);
             string           resultfile = Path.Combine(Path.GetDirectoryName(path), "XResult.txt");
             File.Delete(resultfile);                                          //delete the old result file.
             if (CreditCardOld.CCNumberMasked != CreditCardCur.CCNumberMasked) //They changed card number which we have to delete archived token which will create a new one next time card is charged.
             {
                 info.Arguments            += "/TRANSACTIONTYPE:ARCHIVEVAULTDELETE ";
                 info.Arguments            += "/XCACCOUNTID:" + CreditCardCur.XChargeToken + " ";
                 info.Arguments            += "/RESULTFILE:\"" + resultfile + "\" ";
                 info.Arguments            += "/USERID:" + ProgramProperties.GetPropVal(prog.ProgramNum, "Username") + " ";
                 info.Arguments            += "/PASSWORD:"******"Password") + " ";
                 info.Arguments            += "/AUTOPROCESS ";
                 info.Arguments            += "/AUTOCLOSE ";
                 CreditCardCur.XChargeToken = ""; //Clear the XChargeToken in our db.
             }
             else                                 //We can only change exp date for X-Charge via ARCHIVEAULTUPDATE.
             {
                 info.Arguments += "/TRANSACTIONTYPE:ARCHIVEVAULTUPDATE ";
                 info.Arguments += "/XCACCOUNTID:" + CreditCardCur.XChargeToken + " ";
                 if (CreditCardCur.CCExpiration != null && CreditCardCur.CCExpiration.Year > 2005)
                 {
                     info.Arguments += "/EXP:" + CreditCardCur.CCExpiration.ToString("MMyy") + " ";
                 }
                 info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                 info.Arguments += "/USERID:" + ProgramProperties.GetPropVal(prog.ProgramNum, "Username") + " ";
                 info.Arguments += "/PASSWORD:"******"Password") + " ";
                 info.Arguments += "/AUTOPROCESS ";
                 info.Arguments += "/AUTOCLOSE ";
             }
             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       = "";
             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")
                         {
                             CreditCardCur = CreditCards.GetOne(CreditCardCur.CreditCardNum);
                             FillData();
                             return;
                         }
                     }
                     line = reader.ReadLine();
                 }
             }
         }                //End of special token logic
         #endregion
         CreditCards.Update(CreditCardCur);
     }
     DialogResult = DialogResult.OK;
 }
예제 #12
0
        ///<summary>Typically used when user clicks a button to a Program link.  This method attempts to identify and execute the program based on the given programNum.</summary>
        public static void Execute(long programNum, Patient pat)
        {
            Program prog = Programs.GetFirstOrDefault(x => x.ProgramNum == programNum);

            if (prog == null)           //no match was found
            {
                MessageBox.Show("Error, program entry not found in database.");
                return;
            }
            if (pat != null && PrefC.GetBool(PrefName.ShowFeaturePatientClone))
            {
                pat = Patients.GetOriginalPatientForClone(pat);
            }
            if (prog.PluginDllName != "")
            {
                if (pat == null)
                {
                    Plugins.LaunchToolbarButton(programNum, 0);
                }
                else
                {
                    Plugins.LaunchToolbarButton(programNum, pat.PatNum);
                }
                return;
            }
            if (ODBuild.IsWeb() && prog.ProgName.In(Programs.GetListDisabledForWeb().Select(x => x.ToString())))
            {
                MsgBox.Show("ProgramLinks", "Bridge is not available while viewing through the web.");
                return;                //bridge is not available for web users at this time.
            }
            if (prog.ProgName == ProgramName.ActeonImagingSuite.ToString())
            {
                ActeonImagingSuite.SendData(prog, pat);
                return;
            }
            if (prog.ProgName == ProgramName.Adstra.ToString())
            {
                Adstra.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apixia.ToString())
            {
                Apixia.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apteryx.ToString())
            {
                Apteryx.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.AudaxCeph.ToString())
            {
                AudaxCeph.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.BencoPracticeManagement.ToString())
            {
                Benco.SendData(prog);
                return;
            }
            else if (prog.ProgName == ProgramName.BioPAK.ToString())
            {
                BioPAK.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CADI.ToString())
            {
                CADI.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Camsight.ToString())
            {
                Camsight.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CaptureLink.ToString())
            {
                CaptureLink.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Carestream.ToString())
            {
                Carestream.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Cerec.ToString())
            {
                Cerec.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CleaRay.ToString())
            {
                CleaRay.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CliniView.ToString())
            {
                Cliniview.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ClioSoft.ToString())
            {
                ClioSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DBSWin.ToString())
            {
                DBSWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DemandForce.ToString())
            {
                DemandForce.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.DentalEye.ToString())
            {
                DentalEye.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentalStudio.ToString())
            {
                DentalStudio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentX.ToString())
            {
                DentX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DrCeph.ToString())
            {
                DrCeph.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.DentalTekSmartOfficePhone.ToString())
            {
                DentalTek.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentForms.ToString())
            {
                DentForms.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dexis.ToString())
            {
                Dexis.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.DexisIntegrator.ToString())
            {
                DexisIntegrator.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.Digora.ToString())
            {
                Digora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dimaxis.ToString())
            {
                Planmeca.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Office.ToString())
            {
                Office.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dolphin.ToString())
            {
                Dolphin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DXCPatientCreditScore.ToString())
            {
                DentalXChange.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dxis.ToString())
            {
                Dxis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EvaSoft.ToString())
            {
                EvaSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EwooEZDent.ToString())
            {
                Ewoo.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.FloridaProbe.ToString())
            {
                FloridaProbe.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Guru.ToString())
            {
                Guru.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HandyDentist.ToString())
            {
                HandyDentist.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HouseCalls.ToString())
            {
                FormHouseCalls FormHC = new FormHouseCalls();
                FormHC.ProgramCur = prog;
                FormHC.ShowDialog();
                return;
            }
            else if (prog.ProgName == ProgramName.iCat.ToString())
            {
                ICat.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HdxWill.ToString())
            {
                HdxWill.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.iDixel.ToString())
            {
                iDixel.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ImageFX.ToString())
            {
                ImageFX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.iRYS.ToString())
            {
                Irys.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Lightyear.ToString())
            {
                Lightyear.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.NewTomNNT.ToString())
            {
                NewTomNNT.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MediaDent.ToString())
            {
                MediaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Midway.ToString())
            {
                Midway.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MiPACS.ToString())
            {
                MiPACS.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.OrthoCAD.ToString())
            {
                OrthoCad.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Oryx.ToString())
            {
                Oryx.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.OrthoInsight3d.ToString())
            {
                OrthoInsight3d.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Owandy.ToString())
            {
                Owandy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PandaPerio.ToString())
            {
                PandaPerio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PandaPerioAdvanced.ToString())
            {
                PandaPerioAdvanced.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Patterson.ToString())
            {
                Patterson.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PDMP.ToString())
            {
                string response = "";
                if (PDMP.TrySendData(prog, pat, out response))
                {
                    FormWebBrowser formWebBrowser = new FormWebBrowser(response);
                    formWebBrowser.Show();
                }
                else
                {
                    MessageBox.Show(response, "PDMP");
                }
                return;
            }
            else if (prog.ProgName == ProgramName.PerioPal.ToString())
            {
                PerioPal.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PracticeByNumbers.ToString())
            {
                PracticeByNumbers.ShowPage();
                return;
            }
            else if (prog.ProgName == ProgramName.Progeny.ToString())
            {
                Progeny.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PT.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, false);
                return;
            }
            else if (prog.ProgName == ProgramName.PTupdate.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, true);
                return;
            }
            else if (prog.ProgName == ProgramName.RayMage.ToString())
            {
                RayMage.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Romexis.ToString())
            {
                Romexis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Scanora.ToString())
            {
                Scanora.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Schick.ToString())
            {
                Schick.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.Sirona.ToString())
            {
                Sirona.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.SMARTDent.ToString())
            {
                SmartDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Sopro.ToString())
            {
                Sopro.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TigerView.ToString())
            {
                TigerView.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Triana.ToString())
            {
                Triana.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TrojanExpressCollect.ToString())
            {
                using (FormTrojanCollect FormT = new FormTrojanCollect(pat)) {
                    FormT.ShowDialog();
                }
                return;
            }
            else if (prog.ProgName == ProgramName.Trophy.ToString())
            {
                Trophy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TrophyEnhanced.ToString())
            {
                TrophyEnhanced.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Tscan.ToString())
            {
                Tscan.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Vipersoft.ToString())
            {
                Vipersoft.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.visOra.ToString())
            {
                Visora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VistaDent.ToString())
            {
                VistaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWin.ToString())
            {
                VixWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase36.ToString())
            {
                VixWinBase36.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase41.ToString())
            {
                VixWinBase41.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinNumbered.ToString())
            {
                VixWinNumbered.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinOld.ToString())
            {
                VixWinOld.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.XDR.ToString())
            {
                XDR.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.XVWeb.ToString())
            {
                XVWeb.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ZImage.ToString())
            {
                ZImage.SendData(prog, pat);
                return;
            }
            //all remaining programs:
            try{
                string cmdline        = prog.CommandLine;
                string path           = Programs.GetProgramPath(prog);
                string outputFilePath = prog.FilePath;
                string fileTemplate   = prog.FileTemplate;
                if (pat != null)
                {
                    cmdline = ReplaceHelper(cmdline, pat);
                    path    = ReplaceHelper(path, pat);
                    if (!String.IsNullOrEmpty(outputFilePath) && !String.IsNullOrEmpty(fileTemplate))
                    {
                        fileTemplate = ReplaceHelper(fileTemplate, pat);
                        fileTemplate = fileTemplate.Replace("\n", "\r\n");
                        ODFileUtils.WriteAllTextThenStart(outputFilePath, fileTemplate, path, cmdline);
                        //Nothing else to do so return;
                        return;
                    }
                }
                //We made it this far and we haven't started the program yet so start it.
                ODFileUtils.ProcessStart(path, cmdline);
            }
            catch (Exception e) {
                MessageBox.Show(prog.ProgDesc + " is not available.");
                return;
            }
        }
예제 #13
0
        ///<summary>Typically used when user clicks a button to a Program link.  This method attempts to identify and execute the program based on the given programNum.</summary>
        public static void Execute(long programNum, Patient pat)
        {
            Program prog = Programs.GetFirstOrDefault(x => x.ProgramNum == programNum);

            if (prog == null)           //no match was found
            {
                MessageBox.Show("Error, program entry not found in database.");
                return;
            }
            if (pat != null && PrefC.GetBool(PrefName.ShowFeaturePatientClone))
            {
                pat = Patients.GetOriginalPatientForClone(pat);
            }
            if (prog.PluginDllName != "")
            {
                if (pat == null)
                {
                    Plugins.LaunchToolbarButton(programNum, 0);
                }
                else
                {
                    Plugins.LaunchToolbarButton(programNum, pat.PatNum);
                }
                return;
            }
            if (prog.ProgName == ProgramName.ActeonImagingSuite.ToString())
            {
                ActeonImagingSuite.SendData(prog, pat);
                return;
            }
            if (prog.ProgName == ProgramName.Adstra.ToString())
            {
                Adstra.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apixia.ToString())
            {
                Apixia.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Apteryx.ToString())
            {
                Apteryx.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.AudaxCeph.ToString())
            {
                AudaxCeph.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.BioPAK.ToString())
            {
                BioPAK.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CADI.ToString())
            {
                CADI.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Camsight.ToString())
            {
                Camsight.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CaptureLink.ToString())
            {
                CaptureLink.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Carestream.ToString())
            {
                Carestream.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Cerec.ToString())
            {
                Cerec.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CleaRay.ToString())
            {
                CleaRay.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.CliniView.ToString())
            {
                Cliniview.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ClioSoft.ToString())
            {
                ClioSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DBSWin.ToString())
            {
                DBSWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DemandForce.ToString())
            {
                DemandForce.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.DentalEye.ToString())
            {
                DentalEye.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentalStudio.ToString())
            {
                DentalStudio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentX.ToString())
            {
                DentX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DrCeph.ToString())
            {
                DrCeph.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.DentalTekSmartOfficePhone.ToString())
            {
                DentalTek.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.DentForms.ToString())
            {
                DentForms.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dexis.ToString())
            {
                Dexis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Digora.ToString())
            {
                Digora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dimaxis.ToString())
            {
                Planmeca.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Office.ToString())
            {
                Office.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dolphin.ToString())
            {
                Dolphin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Dxis.ToString())
            {
                Dxis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EvaSoft.ToString())
            {
                EvaSoft.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.EwooEZDent.ToString())
            {
                Ewoo.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.FloridaProbe.ToString())
            {
                FloridaProbe.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Guru.ToString())
            {
                Guru.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HandyDentist.ToString())
            {
                HandyDentist.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HouseCalls.ToString())
            {
                FormHouseCalls FormHC = new FormHouseCalls();
                FormHC.ProgramCur = prog;
                FormHC.ShowDialog();
                return;
            }
            else if (prog.ProgName == ProgramName.iCat.ToString())
            {
                ICat.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.HdxWill.ToString())
            {
                HdxWill.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.iDixel.ToString())
            {
                iDixel.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ImageFX.ToString())
            {
                ImageFX.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.iRYS.ToString())
            {
                Irys.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Lightyear.ToString())
            {
                Lightyear.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.NewTomNNT.ToString())
            {
                NewTomNNT.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MediaDent.ToString())
            {
                MediaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.MiPACS.ToString())
            {
                MiPACS.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.OrthoCAD.ToString())
            {
                OrthoCad.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.OrthoInsight3d.ToString())
            {
                OrthoInsight3d.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Owandy.ToString())
            {
                Owandy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PandaPerio.ToString())
            {
                PandaPerio.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Patterson.ToString())
            {
                Patterson.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PerioPal.ToString())
            {
                PerioPal.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PracticeByNumbers.ToString())
            {
                PracticeByNumbers.ShowPage();
                return;
            }
            else if (prog.ProgName == ProgramName.Progeny.ToString())
            {
                Progeny.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.PT.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, false);
                return;
            }
            else if (prog.ProgName == ProgramName.PTupdate.ToString())
            {
                PaperlessTechnology.SendData(prog, pat, true);
                return;
            }
            else if (prog.ProgName == ProgramName.RayMage.ToString())
            {
                RayMage.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Romexis.ToString())
            {
                Romexis.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Scanora.ToString())
            {
                Scanora.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Schick.ToString())
            {
                Schick.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.Sirona.ToString())
            {
                Sirona.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.SMARTDent.ToString())
            {
                SmartDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Sopro.ToString())
            {
                Sopro.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TigerView.ToString())
            {
                TigerView.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Triana.ToString())
            {
                Triana.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Trophy.ToString())
            {
                Trophy.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.TrophyEnhanced.ToString())
            {
                TrophyEnhanced.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.Tscan.ToString())
            {
                Tscan.SendData(prog, pat);
                return;
            }
#if !DISABLE_WINDOWS_BRIDGES
            else if (prog.ProgName == ProgramName.Vipersoft.ToString())
            {
                Vipersoft.SendData(prog, pat);
                return;
            }
#endif
            else if (prog.ProgName == ProgramName.visOra.ToString())
            {
                Visora.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VistaDent.ToString())
            {
                VistaDent.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWin.ToString())
            {
                VixWin.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase36.ToString())
            {
                VixWinBase36.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinBase41.ToString())
            {
                VixWinBase41.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinNumbered.ToString())
            {
                VixWinNumbered.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.VixWinOld.ToString())
            {
                VixWinOld.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.XDR.ToString())
            {
                Dexis.SendData(prog, pat);               //XDR uses the Dexis protocol
                return;
            }
            else if (prog.ProgName == ProgramName.XVWeb.ToString())
            {
                XVWeb.SendData(prog, pat);
                return;
            }
            else if (prog.ProgName == ProgramName.ZImage.ToString())
            {
                ZImage.SendData(prog, pat);
                return;
            }
            //all remaining programs:
            try{
                string cmdline        = prog.CommandLine;
                string path           = Programs.GetProgramPath(prog);
                string outputFilePath = prog.FilePath;
                string fileTemplate   = prog.FileTemplate;
                if (pat != null)
                {
                    cmdline = Patients.ReplacePatient(cmdline, pat);
                    path    = Patients.ReplacePatient(path, pat);
                    if (!String.IsNullOrEmpty(outputFilePath) && !String.IsNullOrEmpty(fileTemplate))
                    {
                        fileTemplate = Patients.ReplacePatient(fileTemplate, pat);
                        fileTemplate = fileTemplate.Replace("\n", "\r\n");
                        File.WriteAllText(outputFilePath, fileTemplate);
                    }
                }
                Process.Start(path, cmdline);
            }
            catch {
                MessageBox.Show(prog.ProgDesc + " is not available.");
                return;
            }
        }
예제 #14
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            if (!PrefC.GetBool(PrefName.StoreCCnumbers))
            {
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    Program prog = Programs.GetCur(ProgramName.Xcharge);
                    string  path = Programs.GetProgramPath(prog);
                    if (!File.Exists(path))
                    {
                        MsgBox.Show(this, "Path is not valid.");
                        if (Security.IsAuthorized(Permissions.Setup))
                        {
                            FormXchargeSetup FormX = new FormXchargeSetup();
                            FormX.ShowDialog();
                            if (FormX.DialogResult != DialogResult.OK)
                            {
                                return;
                            }
                        }
                    }
                    string           user       = ProgramProperties.GetPropVal(prog.ProgramNum, "Username");
                    string           password   = ProgramProperties.GetPropVal(prog.ProgramNum, "Password");
                    ProcessStartInfo info       = new ProcessStartInfo(path);
                    string           resultfile = Path.Combine(Path.GetDirectoryName(path), "XResult.txt");
                    File.Delete(resultfile);                    //delete the old result file.
                    info.Arguments  = "";
                    info.Arguments += "/TRANSACTIONTYPE:ArchiveVaultAdd /LOCKTRANTYPE ";
                    info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                    info.Arguments += "/USERID:" + user + " ";
                    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;
                    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")
                                {
                                    break;
                                }
                                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.
                        {
                            CreditCard        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);
                            CreditCards.Insert(creditCardCur);
                        }
                    }
                    RefreshCardList();
                    return;
                }
                else
                {
                    MsgBox.Show(this, "Not allowed to store credit cards.");
                    return;
                }
            }
            bool remember  = false;
            int  placement = listCreditCards.SelectedIndex;

            if (placement != -1)
            {
                remember = true;
            }
            FormCreditCardEdit FormCCE = new FormCreditCardEdit(PatCur);

            FormCCE.CreditCardCur       = new CreditCard();
            FormCCE.CreditCardCur.IsNew = true;
            FormCCE.ShowDialog();
            RefreshCardList();
            if (remember)             //in case they canceled and had one selected
            {
                listCreditCards.SelectedIndex = placement;
            }
            if (FormCCE.DialogResult == DialogResult.OK && creditCards.Count > 0)
            {
                listCreditCards.SelectedIndex = 0;
            }
        }