private void FormXchargeTrans_Load(object sender, EventArgs e) { CashBackAmount = 0; textCashBackAmt.Text = CashBackAmount.ToString("F2"); listTransType.Items.Clear(); listTransType.Items.Add("Purchase"); listTransType.Items.Add("Return"); listTransType.Items.Add("Debit Purchase"); listTransType.Items.Add("Debit Return"); listTransType.Items.Add("Force"); listTransType.Items.Add("Pre-Authorization"); listTransType.Items.Add("Adjustment"); listTransType.Items.Add("Void"); listTransType.SelectedIndex = 0; checkSaveToken.Checked = PrefC.GetBool(PrefName.StoreCCtokens); Program prog = Programs.GetCur(ProgramName.Xcharge); if (prog == null) { return; } checkSignature.Checked = PromptSignature; checkPrintReceipt.Checked = PrintReceipt; if (PIn.Bool(ProgramProperties.GetPropVal(prog.ProgramNum, ProgramProperties.PropertyDescs.XCharge.XChargePreventSavingNewCC, ClinicNum))) { checkSaveToken.Checked = false; checkSaveToken.Enabled = false; } }
private void RefreshModuleScreen() { if (PatCur == null) { return; } if (PIn.Bool(ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "FeeSchedulesSetManually"))) { comboFeeSched.Enabled = true; } else { comboFeeSched.Enabled = false; } comboFeeSched.Items.Clear(); comboFeeSched.Items.Add(Lan.g(this, "none")); comboFeeSched.SelectedIndex = 0; for (int i = 0; i < FeeSchedC.ListShort.Count; i++) { comboFeeSched.Items.Add(FeeSchedC.ListShort[i].Description); if (FeeSchedC.ListShort[i].FeeSchedNum == PatCur.FeeSched) { comboFeeSched.SelectedIndex = i + 1; } } }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> public bool SaveCommItem(bool showMsg) { Commlog commlog; if (!_view.TryGetCommItem(showMsg, out commlog)) { return(false); } if (IsNew || IsPersistent) { _view.SetCommlogNum(Commlogs.Insert(commlog)); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert"); //Post insert persistent user preferences. if (IsPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { _view.ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { _view.ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(commlog); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, ""); } return(true); }
private void FormPaySimple_Load(object sender, EventArgs e) { _progCur = Programs.GetCur(ProgramName.PaySimple); if (_progCur == null) { MsgBox.Show(this, "PaySimple does not exist in the database."); DialogResult = DialogResult.Cancel; return; } if (_patCur == null || _patCur.PatNum == 0) //Prepaid card { radioAuthorization.Enabled = false; checkOneTimePayment.Checked = true; checkOneTimePayment.Enabled = false; tabControl.TabPages.Remove(tabACH); } else { checkOneTimePayment.Checked = !PrefC.GetBool(PrefName.StoreCCtokens); checkOneTimePaymentACH.Checked = !PrefC.GetBool(PrefName.StoreCCtokens); textZipCode.Text = _patCur.Zip; textNameOnCard.Text = _patCur.GetNameFL(); if (_creditCardCur != null) { FillFieldsFromCard(); } } if (_isAddingCard) { radioAuthorization.Checked = true; _trantype = PaySimple.TransType.AUTH; groupTransType.Enabled = false; labelAmount.Visible = false; textAmount.Visible = false; labelAmountACH.Visible = false; textAmountACH.Visible = false; checkOneTimePayment.Checked = false; checkOneTimePayment.Enabled = false; checkOneTimePaymentACH.Checked = false; checkOneTimePaymentACH.Enabled = false; } if (_creditCardCur == null || _creditCardCur.CCSource != CreditCardSource.PaySimpleACH) { textCardNumber.Select(); } else { tabControl.SelectedTab = tabACH; textRoutingNumber.Select(); } if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, _clinicNum))) { textCardNumber.ReadOnly = true; textRoutingNumber.ReadOnly = true; textCheckSaveNumber.ReadOnly = true; textBankName.ReadOnly = true; } }
private void FillForm() { try { checkUseService.Checked = PIn.Bool(_useService.PropertyValue); checkShowCommlogsInChart.Checked = PIn.Bool(_showCommlogsInChartAndAccount.PropertyValue); checkEnabled.Checked = _progCur.Enabled; checkHideButtons.Checked = PIn.Bool(_disableAdvertising.PropertyValue); textApptSetComplete.Text = _apptSetCompleteMins.PropertyValue; textApptTimeArrived.Text = _apptTimeArrivedMins.PropertyValue; textApptTimeDismissed.Text = _apptTimeDismissedMins.PropertyValue; textCompNameOrIP.Text = _compName.PropertyValue; textAPIToken.Text = _apiToken.PropertyValue; if (_dictLocationIDs.ContainsKey(_clinicNumCur)) { textLocationID.Text = _dictLocationIDs[_clinicNumCur].PropertyValue; } else { textLocationID.Text = _dictLocationIDs[0].PropertyValue; //Default to showing the HQ value when filling info for a clinic with no program property. } _existingPatTriggerEnum = PIn.Enum <ReviewInvitationTrigger>(_existingPatTriggerType.PropertyValue); _newPatTriggerEnum = PIn.Enum <ReviewInvitationTrigger>(_newPatTriggerType.PropertyValue); switch (_existingPatTriggerEnum) { case ReviewInvitationTrigger.AppointmentCompleted: radioSetCompleteExistingPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeArrived: radioTimeArrivedExistingPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeDismissed: radioTimeDismissedExistingPat.Checked = true; break; } switch (_newPatTriggerEnum) { case ReviewInvitationTrigger.AppointmentCompleted: radioSetCompleteNewPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeArrived: radioTimeArrivedNewPat.Checked = true; break; case ReviewInvitationTrigger.AppointmentTimeDismissed: radioTimeDismissedNewPat.Checked = true; break; } } catch (Exception) { MsgBox.Show(this, "You are missing a program property from the database. Please call support to resolve this issue."); DialogResult = DialogResult.Cancel; return; } }
///<summary>Details displayed in form may be for HQ clinic and not the currently selected clinic if the current clinic is synced with HQ. If the ///values are modified and the currently selected clinic is not the HQ clinic but the HQ details are being displayed, the HQ clinic details will ///remain unchanged and the currently selected clinic will no longer be synced with HQ and will have a set of props added to the dict.</summary> private void FillFields() { long clinicNum = 0; if (PrefC.HasClinicsEnabled) { clinicNum = _listUserClinicNums[comboClinic.SelectedIndex]; } List <ProgramProperty> listPropsCurClinic; if (!_dictClinicListProgProps.TryGetValue(clinicNum, out listPropsCurClinic)) { listPropsCurClinic = _dictClinicListProgProps[0]; //dictionary guaranteed to have ClinicNum 0 in it } foreach (ProgramProperty propCur in listPropsCurClinic) { switch (propCur.PropertyDesc) { case "SftpServerAddress": textSftpAddress.Text = propCur.PropertyValue; continue; case "SftpServerPort": textSftpPort.Text = propCur.PropertyValue; continue; case "SftpUsername": textSftpUsername.Text = propCur.PropertyValue; continue; case "SftpPassword": textSftpPassword.Text = propCur.PropertyValue; continue; case "ClientIdAccelerator": textClientIdAccelerator.Text = propCur.PropertyValue; continue; case "ClientIdCollection": textClientIdCollection.Text = propCur.PropertyValue; continue; case "IsThankYouLetterEnabled": checkThankYouLetter.Checked = PIn.Bool(propCur.PropertyValue); continue; case "SelectedServices": checkAccelService.Checked = propCur.PropertyValue.Contains(((int)TsiDemandType.Accelerator).ToString()); checkPRService.Checked = propCur.PropertyValue.Contains(((int)TsiDemandType.ProfitRecovery).ToString()); checkCollService.Checked = propCur.PropertyValue.Contains(((int)TsiDemandType.Collection).ToString()); continue; } } SetAdvertising(); }
///<summary>Helper method for setting UI for boolean preferences. Some of the preferences calling this may not exist in the database.</summary> private void FillOptionalPrefBool(CheckBox checkPref, PrefName pref) { string valueString = GetHiddenPrefString(pref); if (valueString == null) { checkPref.Visible = false; return; } checkPref.Checked = PIn.Bool(valueString); }
///<summary>If there is no val for this clinic, then it uses the default pref, which is also in the available list.</summary> public bool GetBoolVal(PrefName prefName, long clinicNum) { if (clinicNum < 0) //Shouldn't happen { return(false); } if (_listClinicPrefs.Any(x => x.ClinicNum == clinicNum && x.PrefName == prefName)) //we've already loaded this item, just load it's checked value { return(PIn.Bool(_listClinicPrefs.FirstOrDefault(x => x.ClinicNum == clinicNum && x.PrefName == prefName).ValueString)); } return(PIn.Bool(_listClinicPrefs.FirstOrDefault(x => x.ClinicNum == 0 && x.PrefName == prefName).ValueString)); }
private void PatientChangedEvent_Fired(ODEventArgs e) { if (e.Name != "FormOpenDental" || e.Tag.GetType() != typeof(long)) { return; } //The tag for this event is the newly selected PatNum _view.SetPatNum((long)e.Tag); if (IsPersistent && (_userOdPrefUpdateDateTimeNewPat == null || PIn.Bool(_userOdPrefUpdateDateTimeNewPat.ValueString))) { _view.UpdateButNow(); } }
private void PatientChangedEvent_Fired(ODEventArgs e) { if (e.EventType != ODEventType.Patient || e.Tag.GetType() != typeof(long)) { return; } //The tag for this event is the newly selected PatNum long patNum = (long)e.Tag; _commlogCur.PatNum = patNum; textPatientName.Text = Patients.GetLim(patNum).GetNameFL(); if (_isPersistent && (_userOdPrefUpdateDateTimeNewPat == null || PIn.Bool(_userOdPrefUpdateDateTimeNewPat.ValueString))) { UpdateButNow(); } }
public FormTaskOptions(bool isShowFinishedTasks, DateTime dateTimeStartShowFinished, bool isAptDateTimeSort) { InitializeComponent(); Lan.F(this); checkShowFinished.Checked = isShowFinishedTasks; textStartDate.Text = dateTimeStartShowFinished.ToShortDateString(); checkTaskSortApptDateTime.Checked = isAptDateTimeSort; List <UserOdPref> listPrefs = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.TaskCollapse); _taskCollapsedPref = listPrefs.Count == 0? null : listPrefs[0]; checkCollapsed.Checked = _taskCollapsedPref == null ? false : PIn.Bool(_taskCollapsedPref.ValueString); if (!isShowFinishedTasks) { labelStartDate.Enabled = false; textStartDate.Enabled = false; } }
///<summary>Downloads Canadian procedure codes from our website and updates _codeList accordingly.</summary> private void CanadaDownloadProcedureCodes() { Cursor = Cursors.WaitCursor; _codeList = new List <ProcedureCode>(); string url = @"http://www.opendental.com/feescanada/procedurecodes.txt"; string tempFile = PrefC.GetRandomTempFile(".tmp"); WebClient myWebClient = new WebClient(); try { myWebClient.DownloadFile(url, tempFile); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Failed to download procedure codes") + ":\r\n" + ex.Message); Cursor = Cursors.Default; return; } string codeData = File.ReadAllText(tempFile); File.Delete(tempFile); string[] codeLines = codeData.Split('\n'); for (int i = 0; i < codeLines.Length; i++) { string[] fields = codeLines[i].Split('\t'); if (fields.Length < 1) //Skip blank lines if they exist. { continue; } ProcedureCode procCode = new ProcedureCode(); procCode.ProcCode = PIn.String(fields[0]); //0 ProcCode procCode.Descript = PIn.String(fields[1]); //1 Description procCode.TreatArea = (TreatmentArea)PIn.Int(fields[2]); //2 TreatArea procCode.NoBillIns = PIn.Bool(fields[3]); //3 NoBillIns procCode.IsProsth = PIn.Bool(fields[4]); //4 IsProsth procCode.IsHygiene = PIn.Bool(fields[5]); //5 IsHygiene procCode.PaintType = (ToothPaintingType)PIn.Int(fields[6]); //6 PaintType procCode.ProcCatDescript = PIn.String(fields[7]); //7 ProcCatDescript procCode.ProcTime = PIn.String(fields[8]); //8 ProcTime procCode.AbbrDesc = PIn.String(fields[9]); //9 AbbrDesc procCode.CanadaTimeUnits = PIn.Double(fields[10]); //10 CanadaTimeUnits _codeList.Add(procCode); } Cursor = Cursors.Default; }
private void FormSupplyOrders_Load(object sender, EventArgs e) { Height = SystemInformation.WorkingArea.Height; //max height Location = new Point(Location.X, 0); //move to top of screen _listSupplyOrders = new List <SupplyOrder>(); _listSuppliers = Suppliers.GetAll(); comboSupplier.IncludeAll = true; comboSupplier.Items.AddList(_listSuppliers, x => x.Name); comboSupplier.IsAllSelected = true; _userPrefShowReceived = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.ReceivedSupplyOrders).FirstOrDefault(); if (_userPrefShowReceived != null && PIn.Bool(_userPrefShowReceived.ValueString)) { checkShowReceived.Checked = true; } else { checkShowReceived.Checked = false; } FillGridOrders(); gridOrders.ScrollToEnd(); }
private void radioWebService_CheckedChanged(object sender, EventArgs e) { radioTerminal.Checked = !radioWebService.Checked; if (!radioWebService.Checked) { return; } foreach (TextBox textBox in Controls.OfType <TextBox>()) { textBox.ReadOnly = false; } radioForce.Enabled = true; checkSaveToken.Enabled = true; checkForceDuplicate.Enabled = true; FillFieldsFromCard(); textNameOnCard.Text = _patCur.GetNameFL(); if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, _clinicNum))) { textCardNumber.ReadOnly = true; } }
///<summary>Returns true if the commlog was able to save to the database. Otherwise returns false. ///Set showMsg to true to show a meaningful message when the commlog cannot be saved.</summary> private bool SaveCommItem(bool showMsg) { if (!SyncCommlogWithUI(showMsg)) { return(false); } if (_isPersistent && string.IsNullOrWhiteSpace(_commlogCur.Note)) //in persistent mode, we don't want to save empty commlogs { return(false); } if (_commlogOld.IsNew || _isPersistent) { Commlogs.Insert(_commlogCur); _commlogCur.IsNew = false; _commlogOld = _commlogCur.Copy(); textCommlogNum.Text = _commlogCur.CommlogNum.ToString(); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, "Insert"); //Post insert persistent user preferences. if (_isPersistent) { if (_userOdPrefClearNote == null || PIn.Bool(_userOdPrefClearNote.ValueString)) { ClearNote(); } if (_userOdPrefEndDate == null || PIn.Bool(_userOdPrefEndDate.ValueString)) { ClearDateTimeEnd(); } ODException.SwallowAnyException(() => { FormOpenDental.S_RefreshCurrentModule(); }); } } else { Commlogs.Update(_commlogCur); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, _commlogCur.PatNum, ""); } return(true); }
private void FillFields() { long clinicNum = 0; if (PrefC.HasClinicsEnabled) { clinicNum = _listUserClinicNums[comboClinic.SelectedIndex]; } textUsername.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Username", clinicNum); textPassword.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Password", clinicNum); textPassword.UseSystemPasswordChar = textPassword.Text.Trim().Length > 0; string payTypeDefNum = ProgramProperties.GetPropValFromList(_listProgProps, "PaymentType", clinicNum); string processingMethod = ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.DefaultProcessingMethod, clinicNum); checkTerminal.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, "TerminalProcessingEnabled", clinicNum)); checkForceRecurring.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.PayConnectForceRecurringCharge, clinicNum)); checkPreventSavingNewCC.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, clinicNum)); checkPatientPortalPayEnabled.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.PatientPortalPaymentsEnabled, clinicNum)); textToken.Text = PIn.String(ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.PatientPortalPaymentsToken, clinicNum)); comboPaymentType.Items.Clear(); _listPaymentTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true); for (int i = 0; i < _listPaymentTypeDefs.Count; i++) { comboPaymentType.Items.Add(_listPaymentTypeDefs[i].ItemName); if (_listPaymentTypeDefs[i].DefNum.ToString() == payTypeDefNum) { comboPaymentType.SelectedIndex = i; } } comboDefaultProcessing.Items.Clear(); comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.WebService.GetDescription())); comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.Terminal.GetDescription())); if (processingMethod == "0" || processingMethod == "1") { comboDefaultProcessing.SelectedIndex = PIn.Int(processingMethod); } }
private void FillFields() { long clinicNum = 0; if (PrefC.HasClinicsEnabled) { clinicNum = _listUserClinicNums[comboClinic.SelectedIndex]; } textUsername.Text = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiUserName, clinicNum); textKey.Text = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiKey, clinicNum); string payTypeDefNumCC = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeCC, clinicNum); string payTypeDefNumACH = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeACH, clinicNum); checkPreventSavingNewCC.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, clinicNum)); _listPaymentTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true); comboPaymentTypeCC.Items.Clear(); comboPaymentTypeCC.Items.AddDefs(_listPaymentTypeDefs); comboPaymentTypeCC.SetSelectedDefNum(PIn.Long(payTypeDefNumCC)); comboPaymentTypeACH.Items.Clear(); comboPaymentTypeACH.Items.AddDefs(_listPaymentTypeDefs); comboPaymentTypeACH.SetSelectedDefNum(PIn.Long(payTypeDefNumACH)); }
private void FillFields() { long clinicNum = 0; if (PrefC.HasClinicsEnabled) { clinicNum = _listUserClinicNums[comboClinic.SelectedIndex]; } textUsername.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Username", clinicNum); textPassword.Text = ProgramProperties.GetPropValFromList(_listProgProps, "Password", clinicNum); string payTypeDefNum = ProgramProperties.GetPropValFromList(_listProgProps, "PaymentType", clinicNum); string processingMethod = ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.DefaultProcessingMethod, clinicNum); checkTerminal.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, "TerminalProcessingEnabled", clinicNum)); checkForceRecurring.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps, PayConnect.ProgramProperties.PayConnectForceRecurringCharge, clinicNum)); //Patient portal payments with PayConnect are currently not supported, checkWebPayEnabled is never visible, so always set to 0, //but we'll leave this here for future functionality //checkWebPayEnabled.Checked=PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps,"IsOnlinePaymentsEnabled",clinicNum)); comboPaymentType.Items.Clear(); _listPaymentTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true); for (int i = 0; i < _listPaymentTypeDefs.Count; i++) { comboPaymentType.Items.Add(_listPaymentTypeDefs[i].ItemName); if (_listPaymentTypeDefs[i].DefNum.ToString() == payTypeDefNum) { comboPaymentType.SelectedIndex = i; } } comboDefaultProcessing.Items.Clear(); comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.WebService.GetDescription())); comboDefaultProcessing.Items.Add(Lan.g(this, PayConnectProcessingMethod.Terminal.GetDescription())); if (processingMethod == "0" || processingMethod == "1") { comboDefaultProcessing.SelectedIndex = PIn.Int(processingMethod); } }
///<summary>Set all fields of this control. This is an alternative to constructing an entirely new instance. ///All uses of this control currently construct as Visible=false so that is the default here.</summary> public void ResetData(DataRow rowApt, DataTable tableApptFields, DataTable tablePatFields, Point location, bool visible = false) { DataRoww = rowApt; TableApptFields = tableApptFields; TablePatFields = tablePatFields; Pattern = PIn.String(DataRoww["Pattern"].ToString()); PatternShowing = ApptSingleDrawing.GetPatternShowing(Pattern); Location = location; Size = ApptSingleDrawing.SetSize(Pattern); //These controls are always drawn as their Shadow bitmap. //They never actually render as a control. //Always set Visible to false here so that parent panel/form doesn't account for them when drawings it's controls. //In the case where it is a draggable control or on the pinboard, then it will be set to Visible=true. Visible = visible; //These are used heavily so deserialize here once to save time when accessing. AptNum = PIn.Long(DataRoww["AptNum"].ToString()); PatNum = PIn.Long(DataRoww["PatNum"].ToString()); AptDateTime = PIn.DateT(DataRoww["AptDateTime"].ToString()); OpNum = PIn.Long(DataRoww["Op"].ToString()); ClinicNum = PIn.Long(DataRoww["ClinicNum"].ToString()); ProvNum = PIn.Long(DataRoww["ProvNum"].ToString()); ProvHyg = PIn.Long(DataRoww["ProvHyg"].ToString()); Confirmed = PIn.Long(DataRoww["Confirmed"].ToString()); IsHygiene = PIn.Bool(DataRoww["IsHygiene"].ToString()); GrossProduction = PIn.Decimal(DataRoww["productionVal"].ToString()); WriteoffPPO = PIn.Decimal(DataRoww["writeoffPPO"].ToString()); AdjustmentTotal = PIn.Decimal(DataRoww["adjustmentTotal"].ToString()); ImageFolder = PIn.String(DataRoww["ImageFolder"].ToString()); PatientName = PIn.String(DataRoww["patientName"].ToString()); AptDate = PIn.String(DataRoww["aptDate"].ToString()); AptDay = PIn.String(DataRoww["aptDay"].ToString()); AptLength = PIn.String(DataRoww["aptLength"].ToString()); AptTime = PIn.String(DataRoww["aptTime"].ToString()); Email = PIn.String(DataRoww["Email"].ToString()); Language = PIn.String(DataRoww["language"].ToString()); ReferralTo = PIn.String(DataRoww["referralTo"].ToString()); ReferralFrom = PIn.String(DataRoww["referralFrom"].ToString()); ApptModNote = PIn.String(DataRoww["apptModNote"].ToString()); FamFinUrgNote = PIn.String(DataRoww["famFinUrgNote"].ToString()); AddrNote = PIn.String(DataRoww["addrNote"].ToString()); Insurance = PIn.String(DataRoww["insurance"].ToString()); ContactMethods = PIn.String(DataRoww["contactMethods"].ToString()); WirelessPhone = PIn.String(DataRoww["wirelessPhone"].ToString()); WkPhone = PIn.String(DataRoww["wkPhone"].ToString()); HmPhone = PIn.String(DataRoww["hmPhone"].ToString()); Age = PIn.String(DataRoww["age"].ToString()); BillingType = PIn.String(DataRoww["billingType"].ToString()); ChartNumber = PIn.String(DataRoww["chartNumber"].ToString()); Note = PIn.String(DataRoww["Note"].ToString()); Procs = PIn.String(DataRoww["procs"].ToString()); Lab = PIn.String(DataRoww["lab"].ToString()); MedUrgNote = PIn.String(DataRoww["MedUrgNote"].ToString()); PreMedFlag = PIn.String(DataRoww["preMedFlag"].ToString()); ConfirmedFromDef = PIn.String(DataRoww["confirmed"].ToString()); Production = PIn.String(DataRoww["production"].ToString()); Provider = PIn.String(DataRoww["provider"].ToString()); ApptStatus aptStatus; if (Enum.TryParse(PIn.String(DataRoww["AptStatus"].ToString()), out aptStatus)) { AptStatus = aptStatus; } else { AptStatus = ApptStatus.None; } ApptPriority priority; if (Enum.TryParse(PIn.String(DataRoww["Priority"].ToString()), out priority)) { Priority = priority; } else { Priority = ApptPriority.Normal; } }
private void butOK_Click(object sender, System.EventArgs e) { #region Validation //if clinics are not enabled and the PayConnect program link is enabled, make sure there is a username and password set //if clinics are enabled, the program link can be enabled with blank username and/or password fields for some clinics //clinics with blank username and/or password will essentially not have PayConnect enabled //if 'Enable terminal processing' is checked then the practice/clinic will not need a username and password. if (checkEnabled.Checked && !checkTerminal.Checked && !PrefC.HasClinicsEnabled && (textUsername.Text == "" || textPassword.Text == "")) { MsgBox.Show(this, "Please enter a username and password first."); return; } if (checkEnabled.Checked && //if PayConnect is enabled comboPaymentType.SelectedIndex < 0 && //and the payment type is not set (!PrefC.HasClinicsEnabled || //and either clinics are not enabled (meaning this is the only set of username, password, payment type values) (textUsername.Text != "" && textPassword.Text != ""))) //or clinics are enabled and this clinic's link has a username and password set { MsgBox.Show(this, "Please select a payment type first."); return; } if (checkEnabled.Checked && //if PayConnect is enabled comboDefaultProcessing.SelectedIndex < 0) { MsgBox.Show(this, "Please select a default processing method type first."); return; } SynchWithHQ(); //if the user changes the HQ credentials, any clinic that had the same credentials will be kept in synch with HQ long clinicNum = 0; if (PrefC.HasClinicsEnabled) { clinicNum = _listUserClinicNums[comboClinic.SelectedIndex]; } UpdateListProgramPropertiesForClinic(clinicNum); string payTypeCur; //make sure any other clinics with PayConnect enabled also have a payment type selected for (int i = 0; i < _listUserClinicNums.Count; i++) { if (!checkEnabled.Checked) //if program link is not enabled, do not bother checking the payment type selected { break; } payTypeCur = ProgramProperties.GetPropValFromList(_listProgProps, "PaymentType", _listUserClinicNums[i]); //if the program is enabled and the username and password fields are not blank, //PayConnect is enabled for this clinic so make sure the payment type is also set if (((ProgramProperties.GetPropValFromList(_listProgProps, "Username", _listUserClinicNums[i]) != "" && //if username set ProgramProperties.GetPropValFromList(_listProgProps, "Password", _listUserClinicNums[i]) != "") || //and password set ProgramProperties.GetPropValFromList(_listProgProps, "TerminalProcessingEnabled", _listUserClinicNums[i]) == "1") && //or terminal enabled !_listPaymentTypeDefs.Any(x => x.DefNum.ToString() == payTypeCur)) //and paytype is not a valid DefNum { MsgBox.Show(this, "Please select the payment type for all clinics with PayConnect username and password set."); return; } } #endregion Validation #region Save if (_progCur.Enabled != checkEnabled.Checked) //only update the program if the IsEnabled flag has changed { _progCur.Enabled = checkEnabled.Checked; Programs.Update(_progCur); } ProgramProperties.Sync(_listProgProps, _progCur.ProgramNum); //Find all clinics that have PayConnect online payments enabled _listProgProps.FindAll(x => x.PropertyDesc == PayConnect.ProgramProperties.PatientPortalPaymentsEnabled && PIn.Bool(x.PropertyValue)).ForEach(x => { //Find all XWeb program properties that we saved in this session. Only clinics that have changes will have an XWeb property in memory. //This is needed to ensure that we don't disable XWeb online payments if someone // checks to use PayConnect online payments and then decides to keep it disabled during the same session. ProgramProperty ppXWebOnlinePayments = _listXWebWebPayProgProps.FirstOrDefault(y => y.ClinicNum == x.ClinicNum); if (ppXWebOnlinePayments != null) { ProgramProperties.UpdateProgramPropertyWithValue(ppXWebOnlinePayments, POut.Bool(false)); } }); #endregion Save DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void FormPatFieldCheckEdit_Load(object sender, System.EventArgs e) { labelName.Text = _fieldCur.FieldName; checkFieldValue.Checked = PIn.Bool(_fieldCur.FieldValue); }
///<summary>Only called when user clicks Delete or OK. Not called repeatedly when adding discussions.</summary> private bool SaveChangesToDb(bool doDelete) { #region validation //validate--------------------------------------------------------------------------------------------------------- int difficulty = 0; int myPoints = 0; double myPledge = 0; double bounty = 0; if (!doDelete) { if (textDescription.Text == "") { MsgBox.Show(this, "Description cannot be blank."); return(false); } try{ difficulty = int.Parse(textDifficulty.Text); } catch { MsgBox.Show(this, "Difficulty is invalid."); return(false); } if (difficulty < 0 || difficulty > 10) { MsgBox.Show(this, "Difficulty is invalid."); return(false); } if (IsAdminMode) { try { bounty = PIn.Int(textBounty.Text); } catch { MsgBox.Show(this, "Bounty is invalid."); return(false); } } if (!IsAdminMode) { try{ myPoints = PIn.Int(textMyPoints.Text); //handles "" gracefully } catch { MsgBox.Show(this, "Points is invalid."); return(false); } if (difficulty < 0 || difficulty > 100) { MsgBox.Show(this, "Points is invalid."); return(false); } //still need to validate that they have enough points. if (textMyPledge.Text == "") { myPledge = 0; } else { try{ myPledge = double.Parse(textMyPledge.Text); } catch { MsgBox.Show(this, "Pledge is invalid."); return(false); } } if (myPledge < 0) { MsgBox.Show(this, "Pledge is invalid."); return(false); } } double myPointsRemain = PIn.Double(textMyPointsRemain.Text); if (myPointsRemain < 0) { MsgBox.Show(this, "You have gone over your allotted points."); return(false); } } //end of validation------------------------------------------------------------------------------------------------ #endregion validation //if user has made no changes, then exit out------------------------------------------------------------------------- bool changesMade = false; if (doDelete) { changesMade = true; } if (tableObj == null || tableObj.Rows.Count == 0) //new { changesMade = true; } else { ODDataRow row = tableObj.Rows[0]; if (textDescription.Text != row["Description"]) { changesMade = true; } if (textDetail.Text != row["Detail"]) { changesMade = true; } if (textDifficulty.Text != row["Difficulty"]) { changesMade = true; } int approval = PIn.Int(row["Approval"]); if (comboApproval.SelectedIndex != approval) { changesMade = true; } if (groupMyVotes.Visible) { if (textMyPoints.Text != row["myPoints"] || checkIsCritical.Checked != PIn.Bool(row["IsCritical"]) || textMyPledge.Text != row["myPledge"]) { changesMade = true; } } try { if (textBounty.Text != row["Bounty"]) { changesMade = true; } } catch { } } if (!changesMade) { //temporarily show me which ones shortcutted out //MessageBox.Show("no changes made"); return(true); } Cursor = Cursors.WaitCursor; //prepare the xml document to send-------------------------------------------------------------------------------------- XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); StringBuilder strbuild = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){ writer.WriteStartElement("FeatureRequestSubmitChanges"); //regkey writer.WriteStartElement("RegistrationKey"); writer.WriteString(PrefC.GetString(PrefName.RegistrationKey)); writer.WriteEndElement(); //requestId writer.WriteStartElement("RequestId"); writer.WriteString(RequestId.ToString()); //this will be zero for a new request. writer.WriteEndElement(); if (doDelete) { //delete writer.WriteStartElement("Delete"); writer.WriteString("true"); //all the other elements will be ignored. writer.WriteEndElement(); } else { if (!textDescription.ReadOnly) { //description writer.WriteStartElement("Description"); writer.WriteString(textDescription.Text); writer.WriteEndElement(); } if (!textDetail.ReadOnly) { //detail writer.WriteStartElement("Detail"); writer.WriteString(textDetail.Text); writer.WriteEndElement(); } if (IsAdminMode || RequestId == 0) //This allows the initial difficulty of 5 to get saved. { //difficulty writer.WriteStartElement("Difficulty"); writer.WriteString(difficulty.ToString()); writer.WriteEndElement(); } if (IsAdminMode) { //Bounty writer.WriteStartElement("Bounty"); writer.WriteString(bounty.ToString()); writer.WriteEndElement(); } //approval writer.WriteStartElement("Approval"); writer.WriteString(comboApproval.SelectedIndex.ToString()); writer.WriteEndElement(); if (!IsAdminMode) { //mypoints writer.WriteStartElement("MyPoints"); writer.WriteString(myPoints.ToString()); writer.WriteEndElement(); //iscritical writer.WriteStartElement("IsCritical"); if (checkIsCritical.Checked) { writer.WriteString("1"); } else { writer.WriteString("0"); } writer.WriteEndElement(); //mypledge writer.WriteStartElement("MyPledge"); writer.WriteString(myPledge.ToString("f2")); writer.WriteEndElement(); } } writer.WriteEndElement(); } #if DEBUG OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1(); #else OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1(); updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress); #endif //Send the message and get the result------------------------------------------------------------------------------------- string result = ""; try { result = updateService.FeatureRequestSubmitChanges(strbuild.ToString()); } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show("Error: " + ex.Message); return(false); } //textConnectionMessage.Text=Lan.g(this,"Connection successful."); //Application.DoEvents(); Cursor = Cursors.Default; //MessageBox.Show(result); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); //Process errors------------------------------------------------------------------------------------------------------------ XmlNode node = doc.SelectSingleNode("//Error"); if (node != null) { //textConnectionMessage.Text=node.InnerText; MessageBox.Show(node.InnerText, "Error"); return(false); } return(true); }
private void GetOneFromServer() { //get a table with data Cursor = Cursors.WaitCursor; //prepare the xml document to send-------------------------------------------------------------------------------------- XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); StringBuilder strbuild = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(strbuild, settings)){ writer.WriteStartElement("FeatureRequestGetOne"); writer.WriteStartElement("RegistrationKey"); writer.WriteString(PrefC.GetString(PrefName.RegistrationKey)); writer.WriteEndElement(); writer.WriteStartElement("RequestId"); writer.WriteString(RequestId.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); } #if DEBUG OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1(); #else OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1(); updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress); #endif //Send the message and get the result------------------------------------------------------------------------------------- string result = ""; try { result = updateService.FeatureRequestGetOne(strbuild.ToString()); } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show("Error: " + ex.Message); return; } //textConnectionMessage.Text=Lan.g(this,"Connection successful."); //Application.DoEvents(); Cursor = Cursors.Default; //MessageBox.Show(result); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); //Process errors------------------------------------------------------------------------------------------------------------ XmlNode node = doc.SelectSingleNode("//Error"); if (node != null) { //textConnectionMessage.Text=node.InnerText; MessageBox.Show(node.InnerText, "Error"); DialogResult = DialogResult.Cancel; return; } //Process a valid return value------------------------------------------------------------------------------------------------ node = doc.SelectSingleNode("//ResultTable"); tableObj = new ODDataTable(node.InnerXml); ODDataRow row = tableObj.Rows[0]; textDescription.Text = row["Description"]; string detail = row["Detail"]; detail = detail.Replace("\n", "\r\n"); textDetail.Text = detail; checkIsMine.Checked = PIn.Bool(row["isMine"]); textDifficulty.Text = row["Difficulty"]; int approval = PIn.Int(row["Approval"]); if (IsAdminMode) { textSubmitter.Text = row["submitter"]; } comboApproval.SelectedIndex = approval; //textApproval gets set automatically due to comboApproval_SelectedIndexChanged. if (!IsAdminMode && PIn.Bool(row["isMine"])) //user editing their own request { if ((ApprovalEnum)approval == ApprovalEnum.New || (ApprovalEnum)approval == ApprovalEnum.NeedsClarification || (ApprovalEnum)approval == ApprovalEnum.NotARequest || (ApprovalEnum)approval == ApprovalEnum.Redundant || (ApprovalEnum)approval == ApprovalEnum.TooBroad) //so user not allowed to edit if Approved,AlreadyDone,Obsolete, or InProgress. { textDescription.BackColor = Color.White; textDescription.ReadOnly = false; textDetail.BackColor = Color.White; textDetail.ReadOnly = false; if ((ApprovalEnum)approval != ApprovalEnum.New) { butResubmit.Visible = true; } butDelete.Visible = true; } } if ((ApprovalEnum)approval != ApprovalEnum.Approved) { //only allowed to vote on Approved features. //All others should always have zero votes, except InProgress and Complete groupMyVotes.Visible = false; } if ((ApprovalEnum)approval == ApprovalEnum.Approved || (ApprovalEnum)approval == ApprovalEnum.InProgress || (ApprovalEnum)approval == ApprovalEnum.Complete) { //even administrators should not be able to change things at this point textDescription.BackColor = colorDisabled; textDescription.ReadOnly = true; textDetail.BackColor = colorDisabled; textDetail.ReadOnly = true; } myPointsUsed = PIn.Int(row["myPointsUsed"]); try { myPointsAllotted = PIn.Int(row["myPointsAllotted"]); } catch { myPointsAllotted = 100; } //textMyPointsRemain.Text=;this will be filled automatically when myPoints changes textMyPoints.Text = row["myPoints"]; RecalcMyPoints(); checkIsCritical.Checked = PIn.Bool(row["IsCritical"]); textMyPledge.Text = row["myPledge"]; textTotalPoints.Text = row["totalPoints"]; textTotalCritical.Text = row["totalCritical"]; textTotalPledged.Text = row["totalPledged"]; textWeight.Text = row["Weight"]; try { textBounty.Text = row["Bounty"]; } catch { } }
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(); }
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); } } }
private void FormPayConnect_Load(object sender, EventArgs e) { _progCur = Programs.GetCur(ProgramName.PayConnect); if (_progCur == null) { MsgBox.Show(this, "PayConnect does not exist in the database."); DialogResult = DialogResult.Cancel; return; } if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, "TerminalProcessingEnabled", _clinicNum))) { try { //If the config file for the DentalXChange credit card processing .dll doesn't exist, construct it from the included resource. if (!File.Exists("DpsPos.dll.config")) { File.WriteAllText("DpsPos.dll.config", Properties.Resources.DpsPos_dll_config); } } catch (Exception ex) { FriendlyException.Show("Unable to create the config file for the terminal. Trying running the program as an administrator.", ex); //We will still allow them to run the transaction. Probably the worse that will happen is the timeout variable will be less than desired. } } if (!PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, "TerminalProcessingEnabled", _clinicNum)) || _isAddingCard) //When adding a card, the web service must be used. { groupProcessMethod.Visible = false; Height -= 55; //All the controls except for the Transaction Type group box should be anchored to the bottom, so they will move themselves up. } else { string procMethod = ProgramProperties.GetPropValForClinicOrDefault(_progCur.ProgramNum, PayConnect.ProgramProperties.DefaultProcessingMethod, _clinicNum); if (procMethod == "0") { radioWebService.Checked = true; } else if (procMethod == "1") { radioTerminal.Checked = true; } } textAmount.Text = POut.Decimal(_amountInit); if (_patCur == null) //Prepaid card { radioAuthorization.Enabled = false; radioVoid.Enabled = false; radioReturn.Enabled = false; textZipCode.ReadOnly = true; textNameOnCard.ReadOnly = true; checkSaveToken.Enabled = false; sigBoxWrapper.Enabled = false; } else //Other cards { textZipCode.Text = _patCur.Zip; textNameOnCard.Text = _patCur.GetNameFL(); checkSaveToken.Checked = PrefC.GetBool(PrefName.StoreCCtokens); if (PrefC.GetBool(PrefName.StoreCCnumbers)) { labelStoreCCNumWarning.Visible = true; } FillFieldsFromCard(); } if (_isAddingCard) //We will run a 0.01 authorization so we will not allow the user to change the transaction type or the amount. { radioAuthorization.Checked = true; _trantype = PayConnectService.transType.AUTH; groupTransType.Enabled = false; labelAmount.Visible = false; textAmount.Visible = false; checkSaveToken.Checked = true; checkSaveToken.Enabled = false; checkForceDuplicate.Checked = true; checkForceDuplicate.Enabled = false; } if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, _clinicNum))) { textCardNumber.ReadOnly = true; } }
///<summary>Processes a PayConnect payment via the PayConnect web service.</summary> private bool ProcessPaymentWebService(int expYear, int expMonth) { string refNumber = ""; if (_trantype == PayConnectService.transType.VOID || _trantype == PayConnectService.transType.RETURN) { refNumber = textRefNumber.Text; } string magData = null; if (_parser != null) { magData = _parser.Track2; } string cardNumber = textCardNumber.Text; //if using a stored CC and there is an X-Charge token saved for the CC and the user enters the whole card number to get a PayConnect token //and the number entered doesn't have the same last 4 digits and exp date, then assume it's not the same card and clear out the X-Charge token. if (_creditCardCur != null && //using a saved CC !string.IsNullOrEmpty(_creditCardCur.XChargeToken) && //there is an X-Charge token saved (cardNumber.Right(4) != _creditCardCur.CCNumberMasked.Right(4) || //the card number entered doesn't have the same last 4 digits expYear != _creditCardCur.CCExpiration.Year || //the card exp date entered doesn't have the same year expMonth != _creditCardCur.CCExpiration.Month)) //the card exp date entered doesn't have the same month { if (MsgBox.Show(this, MsgBoxButtons.YesNo, "The card number or expiration date entered does not match the X-Charge card on file. Do you wish " + "to replace the X-Charge card with this one?")) { _creditCardCur.XChargeToken = ""; } else { Cursor = Cursors.Default; return(false); } } //if the user has chosen to store CC tokens and the stored CC has a token and the token is not expired, //then use it instead of the CC number and CC expiration. if (checkSaveToken.Checked && _creditCardCur != null && //if the user selected a saved CC _creditCardCur.PayConnectToken != "" && //there is a stored token for this card _creditCardCur.PayConnectTokenExp.Date >= DateTime.Today.Date) //the token is not expired { cardNumber = _creditCardCur.PayConnectToken; expYear = _creditCardCur.PayConnectTokenExp.Year; expMonth = _creditCardCur.PayConnectTokenExp.Month; } else if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, _clinicNum))) { MsgBox.Show(this, "Cannot add a new credit card."); return(false); } string authCode = ""; if (_trantype == PayConnectService.transType.FORCE) { authCode = textRefNumber.Text; } _request = PayConnect.BuildSaleRequest(PIn.Decimal(textAmount.Text), cardNumber, expYear, expMonth, textNameOnCard.Text, textSecurityCode.Text, textZipCode.Text, magData, _trantype, refNumber, checkSaveToken.Checked, authCode, checkForceDuplicate.Checked); _response = PayConnect.ProcessCreditCard(_request, _clinicNum, x => MessageBox.Show(x)); if (_response == null || _response.Status.code != 0) //error in transaction { return(false); } PayConnectService.signatureResponse sigResponse = SendSignature(_response.RefNumber); if ((_trantype.In(PayConnectService.transType.SALE, PayConnectService.transType.RETURN, PayConnectService.transType.VOID)) && _response.Status.code == 0) //Only print a receipt if transaction is an approved SALE, RETURN, or VOID { _receiptStr = PayConnect.BuildReceiptString(_request, _response, sigResponse, _clinicNum); PrintReceipt(_receiptStr); } if (!PrefC.GetBool(PrefName.StoreCCnumbers) && !checkSaveToken.Checked) //not storing the card number or the token { return(true); } //response must be non-null and the status code must be 0=Approved //also, the user must have the pref StoreCCnumbers enabled or they have the checkSaveTokens checked if (_creditCardCur == null) //user selected Add new card from the payment window, save it or its token depending on settings { _creditCardCur = new CreditCard(); _creditCardCur.IsNew = true; _creditCardCur.PatNum = _patCur.PatNum; List <CreditCard> itemOrderCount = CreditCards.Refresh(_patCur.PatNum); _creditCardCur.ItemOrder = itemOrderCount.Count; } _creditCardCur.CCExpiration = new DateTime(expYear, expMonth, DateTime.DaysInMonth(expYear, expMonth)); if (PrefC.GetBool(PrefName.StoreCCnumbers)) { _creditCardCur.CCNumberMasked = textCardNumber.Text; } else { _creditCardCur.CCNumberMasked = textCardNumber.Text.Right(4).PadLeft(textCardNumber.Text.Length, 'X'); } _creditCardCur.Zip = textZipCode.Text; _creditCardCur.PayConnectToken = ""; _creditCardCur.PayConnectTokenExp = DateTime.MinValue; //Store the token and the masked CC number (only last four digits). if (checkSaveToken.Checked && _response.PaymentToken != null) { _creditCardCur.PayConnectToken = _response.PaymentToken.TokenId; _creditCardCur.PayConnectTokenExp = new DateTime(_response.PaymentToken.Expiration.year, _response.PaymentToken.Expiration.month, DateTime.DaysInMonth(_response.PaymentToken.Expiration.year, _response.PaymentToken.Expiration.month)); } _creditCardCur.CCSource = CreditCardSource.PayConnect; if (_creditCardCur.IsNew) { _creditCardCur.ClinicNum = _clinicNum; _creditCardCur.Procedures = PrefC.GetString(PrefName.DefaultCCProcs); CreditCards.Insert(_creditCardCur); } else { if (_creditCardCur.CCSource == CreditCardSource.XServer) //This card has also been added for XCharge. { _creditCardCur.CCSource = CreditCardSource.XServerPayConnect; } CreditCards.Update(_creditCardCur); } return(true); }
///<summary>Processes a PaySimple payment via the PaySimple API.</summary> private PaySimple.ApiResponse ProcessPayment(int expYear, int expMonth) { PaySimple.ApiResponse retVal = null; string refNumber = ""; if (_trantype == PaySimple.TransType.VOID || _trantype == PaySimple.TransType.RETURN) { refNumber = textRefNumber.Text; } string magData = null; if (_parser != null) { magData = _parser.Track2; } string cardNumber = textCardNumber.Text; //if using a stored CC and there is an X-Charge token saved for the CC and the user enters the whole card number to get a PaySimple token //and the number entered doesn't have the same last 4 digits and exp date, then assume it's not the same card and clear out the X-Charge token. if (_creditCardCur != null && //using a saved CC !string.IsNullOrEmpty(_creditCardCur.XChargeToken) && //there is an X-Charge token saved (cardNumber.Right(4) != _creditCardCur.CCNumberMasked.Right(4) || //the card number entered doesn't have the same last 4 digits expYear != _creditCardCur.CCExpiration.Year || //the card exp date entered doesn't have the same year expMonth != _creditCardCur.CCExpiration.Month)) //the card exp date entered doesn't have the same month { if (MsgBox.Show(this, MsgBoxButtons.YesNo, "The card number or expiration date entered does not match the X-Charge card on file. Do you wish " + "to replace the X-Charge card with this one?")) { _creditCardCur.XChargeToken = ""; } else { Cursor = Cursors.Default; return(null); } } //if the user has chosen to store CC tokens and the stored CC has a token and the token is not expired, //then use it instead of the CC number and CC expiration. if (!checkOneTimePayment.Checked && _creditCardCur != null && //if the user selected a saved CC !string.IsNullOrWhiteSpace(_creditCardCur.PaySimpleToken)) //there is a stored token for this card { cardNumber = _creditCardCur.PaySimpleToken; expYear = _creditCardCur.CCExpiration.Year; expMonth = _creditCardCur.CCExpiration.Month; } else if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, _clinicNum))) { MsgBox.Show(this, "Cannot add a new credit card."); return(null); } try { switch (_trantype) { case PaySimple.TransType.SALE: //If _patCur is null or the PatNum is 0, we will make a one time payment for an UNKNOWN patient. //This is currently only intended for prepaid insurance cards. retVal = PaySimple.MakePayment((_patCur == null ? 0 : _patCur.PatNum), _creditCardCur, PIn.Decimal(textAmount.Text), textCardNumber.Text , new DateTime(expYear, expMonth, 1), checkOneTimePayment.Checked, textZipCode.Text, textSecurityCode.Text, _clinicNum, _carrierName); break; case PaySimple.TransType.AUTH: //Will retreive a new customer id from PaySimple if the patient doesn't exist already. long paySimpleCustomerId = PaySimple.GetCustomerIdForPat(_patCur.PatNum, _patCur.FName, _patCur.LName, _clinicNum); //I have no idea if an insurance can make an auth payment but incase they can I check for it. if (paySimpleCustomerId == 0) //Insurance payment, make a new customer id every time per Nathan on 04/26/2018 { if ((_patCur == null || _patCur.PatNum == 0)) { paySimpleCustomerId = PaySimple.AddCustomer("UNKNOWN", "UNKNOWN", "", _clinicNum); } else { throw new ODException(Lan.g(this, "Invalid PaySimple Customer Id found.")); } } try { retVal = PaySimple.AddCreditCard(paySimpleCustomerId, textCardNumber.Text, new DateTime(expYear, expMonth, 1), textZipCode.Text, _clinicNum); } catch (PaySimpleException ex) { PaySimple.HandlePaySimpleException(ex, paySimpleCustomerId); } break; case PaySimple.TransType.RETURN: if (string.IsNullOrWhiteSpace(textRefNumber.Text)) { throw new ODException(Lan.g(this, "Invalid PaySimple Payment ID.")); } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "You are about to return a payment. This action is irreversible. Continue?")) { throw new ODException(Lan.g(this, "Payment return was cancelled by user.")); } retVal = PaySimple.ReversePayment(textRefNumber.Text, _clinicNum); break; case PaySimple.TransType.VOID: if (string.IsNullOrWhiteSpace(textRefNumber.Text)) { throw new ODException(Lan.g(this, "Invalid PaySimple Payment ID.")); } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "You are about to void a payment. This action is irreversible. Continue?")) { throw new ODException(Lan.g(this, "Payment void was cancelled by user.")); } retVal = PaySimple.VoidPayment(textRefNumber.Text, _clinicNum); break; default: throw new Exception("Invalid transmission type: " + _trantype.ToString()); } } catch (PaySimpleException ex) { MessageBox.Show(ex.Message); if (ex.ErrorType == PaySimpleError.CustomerDoesNotExist && MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete the link to the customer id for this patient?")) { PatientLinks.DeletePatNumTos(ex.CustomerId, PatientLinkType.PaySimple); } return(null); } catch (ODException wex) { MessageBox.Show(wex.Message); //This should have already been Lans.g if applicable. return(null); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Error:") + " " + ex.Message); return(null); } if (_trantype.In(PaySimple.TransType.SALE, PaySimple.TransType.RETURN, PaySimple.TransType.VOID)) //Only print a receipt if transaction is an approved SALE, RETURN, or VOID //The isSwiped boolean could be incorrectly set if the user swipes a card and then changes the data that was entered to a different card. { retVal.BuildReceiptString(cardNumber, expMonth, expYear, textNameOnCard.Text, _clinicNum, _parser != null); PrintReceipt(retVal.TransactionReceipt); } if (checkOneTimePayment.Checked) //not storing the card token { return(retVal); } UpsertCreditCard(retVal, textCardNumber.Text.Right(4).PadLeft(textCardNumber.Text.Length, 'X'), CreditCardSource.PaySimple, new DateTime(expYear, expMonth, DateTime.DaysInMonth(expYear, expMonth))); return(retVal); }
///<summary>Processes a PaySimple ACH payment via the PaySimple API.</summary> private PaySimple.ApiResponse ProcessPaymentACH() { PaySimple.ApiResponse retVal = null; string accountNumber = textCheckSaveNumber.Text; //if the user has chosen to store CC tokens and the stored CC has a token and the token is not expired, //then use it instead of the CC number and CC expiration. if (!checkOneTimePaymentACH.Checked && _creditCardCur != null && //if the user selected a saved CC !string.IsNullOrWhiteSpace(_creditCardCur.PaySimpleToken) && //there is a stored token for this card _creditCardCur.CCSource == CreditCardSource.PaySimpleACH) { accountNumber = _creditCardCur.PaySimpleToken; } else if (PIn.Bool(ProgramProperties.GetPropVal(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, _clinicNum))) { MsgBox.Show(this, "Cannot add a new ACH payment."); return(null); } try { if (_isAddingCard) { retVal = PaySimple.AddACHAccount(_patCur, textRoutingNumber.Text, textCheckSaveNumber.Text, textBankName.Text, radioCheckings.Checked, _clinicNum); } else { retVal = PaySimple.MakePaymentACH(_patCur, _creditCardCur, PIn.Decimal(textAmountACH.Text), textRoutingNumber.Text, textCheckSaveNumber.Text, textBankName.Text, radioCheckings.Checked, checkOneTimePaymentACH.Checked, _clinicNum); try { string result = WebServiceMainHQProxy.GetWebServiceMainHQInstance() .InsertPaySimpleACHId(PayloadHelper.CreatePayload( PayloadHelper.CreatePayloadContent(retVal.RefNumber.ToString(), "PaymentId"), eServiceCode.PaySimple)); PayloadHelper.CheckForError(result); } catch (Exception ex) { FriendlyException.Show("Unable to register for ACH Settled event", ex); } } } catch (PaySimpleException ex) { MessageBox.Show(ex.Message); if (ex.ErrorType == PaySimpleError.CustomerDoesNotExist && MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete the link to the customer id for this patient?")) { PatientLinks.DeletePatNumTos(ex.CustomerId, PatientLinkType.PaySimple); } return(null); } catch (ODException ex) { MessageBox.Show(ex.Message); //This should have already been Lans.g if applicable. return(null); } catch (Exception ex) { FriendlyException.Show(Lan.g(this, "Error:") + " " + ex.Message, ex); return(null); } if (!_isAddingCard) { retVal.BuildReceiptString(accountNumber, -1, -1, _patCur?.GetNameFL(), _clinicNum, wasSwiped: false, isACH: true); PrintReceipt(retVal.TransactionReceipt); } if (checkOneTimePaymentACH.Checked) //not storing the account token { return(retVal); } UpsertCreditCard(retVal, textCheckSaveNumber.Text.Right(4).PadLeft(textCheckSaveNumber.Text.Length, '*'), CreditCardSource.PaySimpleACH, DateTime.MinValue); return(retVal); }
///<summary>For ClinicNum==0</summary> public bool GetDefaultBoolVal(PrefName prefName) { return(PIn.Bool(_listClinicPrefs.First(x => x.ClinicNum == 0 && x.PrefName == prefName).ValueString)); }