private void butOK_Click(object sender, System.EventArgs e) { #region Validation //if clinics are not enabled and the PaySimple program link is enabled, make sure there is a username and key set //if clinics are enabled, the program link can be enabled with blank username and/or key fields for some clinics //clinics with blank username and/or key will essentially not have PaySimple enabled if (checkEnabled.Checked && !IsClinicCurSetupDone()) //Also works for offices not using clinics { MsgBox.Show(this, "Please enter a username, key, and/or payment 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]; } string payTypeSelected = ""; if (comboPaymentType.SelectedIndex > -1) { payTypeSelected = _listPaymentTypeDefs[comboPaymentType.SelectedIndex].DefNum.ToString(); } //set the values in the list for this clinic _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiUserName) .ForEach(x => x.PropertyValue = textUsername.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiKey) .ForEach(x => x.PropertyValue = textKey.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePayType) .ForEach(x => x.PropertyValue = payTypeSelected); //always 1 item; null safe string payTypeCur; //make sure any other clinics with PaySimple 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, PaySimple.PropertyDescs.PaySimplePayType, _listUserClinicNums[i]); //if the program is enabled and the username and key fields are not blank, //PaySimple is enabled for this clinic so make sure the payment type is also set if (ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiUserName, _listUserClinicNums[i]) != "" && //if username set ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiKey, _listUserClinicNums[i]) != "" && //and key set !_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 PaySimple username and key 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); #endregion Save DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void butClose_Click(object sender, EventArgs e) { if (!textSubInterval.IsValid) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (comboPayType.SelectedIndex < 0) { MsgBox.Show(this, "Please select a payment type."); return; } Program prog = Programs.GetCur(ProgramName.FHIR); prog.Enabled = checkEnabled.Checked; Programs.Update(prog); ProgramProperty progProp = ProgramProperties.GetPropByDesc("SubscriptionProcessingFrequency", ProgramProperties.GetForProgram(prog.ProgramNum)); ProgramProperties.UpdateProgramPropertyWithValue(progProp, textSubInterval.Text); DataValid.SetInvalid(InvalidType.Programs); if (Prefs.UpdateLong(PrefName.ApiPaymentType, comboPayType.GetSelectedDefNum())) { DataValid.SetInvalid(InvalidType.Prefs); } Close(); }
private void butOK_Click(object sender, System.EventArgs e) { if (prog == null) { MsgBox.Show(this, "X-Charge entry is missing from the database."); //should never happen return; } if (!File.Exists(textPath.Text)) { MsgBox.Show(this, "Path is not valid."); return; } if (comboPaymentType.SelectedIndex == -1) { MsgBox.Show(this, "Please select a payment type first."); return; } prog.Enabled = checkEnabled.Checked; prog.Path = textPath.Text; Programs.Update(prog); string paymentType = DefC.Short[(int)DefCat.PaymentTypes][comboPaymentType.SelectedIndex].DefNum.ToString(); ProgramProperties.SetProperty(prog.ProgramNum, "PaymentType", paymentType); ProgramProperties.SetProperty(prog.ProgramNum, "Username", textUser.Text); ProgramProperties.SetProperty(prog.ProgramNum, "Password", textPassword.Text); DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
///<summary>Only save program properties on close</summary> private void butOK_Click(object sender, EventArgs e) { if (!validTaxLockDate.IsValid) { MsgBox.Show(this, "Enter a valid tax lock date"); return; } long progNum = ProgramCur.ProgramNum; ProgramCur.Enabled = checkEnabled.Checked; Programs.Update(ProgramCur); ProgramProperties.SetProperty(progNum, "Test (T) or Production (P)", radioProdEnv.Checked?"P":"T"); ProgramProperties.SetProperty(progNum, ProgramProperties.PropertyDescs.Username, textUsername.Text); ProgramProperties.SetProperty(progNum, ProgramProperties.PropertyDescs.Password, textPassword.Text); ProgramProperties.SetProperty(progNum, "Company Code", textCompanyCode.Text); ProgramProperties.SetProperty(progNum, "Sales Tax Adjustment Type", POut.Long(_defCurrentSalesTaxAdjType.DefNum)); ProgramProperties.SetProperty(progNum, "Sales Tax Return Adjustment Type", POut.Long(_defCurrentSalesTaxReturnAdjType.DefNum)); ProgramProperties.SetProperty(progNum, "Taxable States", string.Join(",", listBoxTaxedStates.Items.Cast <ODBoxItem <string> >().Select(x => x.Tag))); ProgramProperties.SetProperty(progNum, "Log Level", POut.Int((int)listBoxLogLevel.GetSelected <LogLevel>())); ProgramProperties.SetProperty(progNum, "Prepay Proc Codes", POut.String(textPrePayCodes.Text)); ProgramProperties.SetProperty(progNum, "Discount Proc Codes", POut.String(textDiscountCodes.Text)); ProgramProperties.SetProperty(progNum, "Tax Exempt Pat Field Def", _patFieldDefCurrentTaxExempt == null ? "0" : POut.Long(_patFieldDefCurrentTaxExempt.PatFieldDefNum)); ProgramProperties.SetProperty(progNum, "Tax Code Overrides", POut.String(textOverrides.Text)); ProgramProperties.SetProperty(progNum, "Tax Lock Date", POut.String(validTaxLockDate.Text)); DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.Note = textNote.Text; if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }
private void SaveProgram() { SaveClinicCurProgramPropertiesToDict(); _progCur.Enabled = checkEnabled.Checked; _progCur.Path = textPath.Text; _progCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); ToolButItems.DeleteAllForProgram(_progCur.ProgramNum); //Then add one toolButItem for each highlighted row in listbox ToolButItem toolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { toolButItemCur = new ToolButItem() { ProgramNum = _progCur.ProgramNum, ButtonText = textButtonText.Text, ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i] }; ToolButItems.Insert(toolButItemCur); } if (_pathOverrideOld != textOverride.Text) //If there was no previous override _pathOverrideOld will be empty string. { _hasProgramPropertyChanged = true; ProgramProperties.InsertOrUpdateLocalOverridePath(_progCur.ProgramNum, textOverride.Text); } UpdateProgramProperty(_patNumOrChartNum, POut.Bool(radioChart.Checked)); //Will need to be enhanced if another radio button ever gets added. UpdateProgramProperty(_infoFilePath, textInfoFile.Text); UpsertProgramPropertiesForClinics(); Programs.Update(_progCur); }
private bool SaveToDb() { if (textProgDesc.Text == "") { MsgBox.Show(this, "Description may not be blank."); return(false); } if (radioModeTight.Checked && comboDefaultUserGroup.SelectedIndex == -1) { MsgBox.Show(this, "Please select a default user group first."); return(false); } if (textHL7FolderOut.Text == "") { MsgBox.Show(this, "HL7 out folder may not be blank."); return(false); } if (radioModeTight.Checked && textHL7FolderIn.Text == "") { MsgBox.Show(this, "HL7 in folder may not be blank."); return(false); } ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; Programs.Update(ProgramCur); Prefs.UpdateString(PrefName.HL7FolderOut, textHL7FolderOut.Text); if (radioModeTight.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsStandalone", "0"); Prefs.UpdateString(PrefName.HL7FolderIn, textHL7FolderIn.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", UserGroups.List[comboDefaultUserGroup.SelectedIndex].UserGroupNum.ToString()); if (checkShowImages.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "0"); } if (this.checkFeeSchedules.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } } else //standalone { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsStandalone", "1"); Prefs.UpdateString(PrefName.HL7FolderIn, ""); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", "0"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } DataValid.SetInvalid(InvalidType.Programs, InvalidType.Prefs); return(true); }
private void butOK_Click(object sender, System.EventArgs e) { if (checkEnabled.Checked && textPluginDllName.Text != "") { string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, textPluginDllName.Text); if (dllPath.Contains("[VersionMajMin]")) { Version vers = new Version(Application.ProductVersion); dllPath = dllPath.Replace("[VersionMajMin]", ""); //now stripped clean } if (!File.Exists(dllPath)) { MessageBox.Show(Lan.g(this, "Dll file not found:") + " " + dllPath); return; } } if (textPluginDllName.Text != "" && textPath.Text != "") { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If both a path and a plug-in are specified, the path will be ignored. Continue anyway?")) { return; } } ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(ProgramCur.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.PluginDllName = textPluginDllName.Text; ProgramCur.Note = textNote.Text; ProgramCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { ErxOptionPP.PropertyValue = POut.Int((int)_eRxOption); _progCur.Enabled = checkEnabled.Checked; Programs.Update(_progCur); ProgramProperties.Sync(_listProgramProperties, _progCur.ProgramNum); DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textSftpPort.errorProvider1.GetError(textSftpPort))) { MsgBox.Show(this, "Please enter a valid integer for the Sftp Server Port."); return; } int sendFreq = (int)numericSendFrequency.Value; DateTime accountUpdatesRuntime = DateTime.MinValue; if (!string.IsNullOrWhiteSpace(textUpdatesTimeOfDay.Text) && !DateTime.TryParse(textUpdatesTimeOfDay.Text, out accountUpdatesRuntime)) { MsgBox.Show(this, "Account Updates Run Time must be blank or a valid time of day."); return; } if (comboSendFrequencyUnits.SelectedIndex < 0 || comboSendFrequencyUnits.SelectedIndex >= Enum.GetNames(typeof(FrequencyUnit)).Length) { //shouldn't be possible, but just in case MsgBox.Show(this, "Please select a valid unit of measurement for the Account Activity Updates repeat frequency."); return; } if (numericSendFrequency.Value < 1 || numericSendFrequency.Value > new[] { 30, 24, 60 }[comboSendFrequencyUnits.SelectedIndex]) { //shouldn't be possible, but just in case MsgBox.Show(this, "Please enter a valid value for the Account Activity Updates repeat frequency."); return; } long billTypePaidInFullDefNum = comboPaidInFullBillType.GetSelectedDefNum(); if (billTypePaidInFullDefNum == 0 && checkEnabled.Checked) { MsgBox.Show(this, "Please select a Paid in Full Billing Type."); return; } SyncWithHQ(); //will remove any clinic from the dict if all props exactly match the HQ props, or add clinic props if different if (_progCur.Enabled != checkEnabled.Checked) //only update the program if the IsEnabled flag has changed { _progCur.Enabled = checkEnabled.Checked; Programs.Update(_progCur); } ProgramProperties.Sync(_dictClinicListProgProps.Where(x => _listUserClinicNums.Contains(x.Key)).SelectMany(x => x.Value).ToList(), _progCur.ProgramNum, _listUserClinicNums); DataValid.SetInvalid(InvalidType.Programs); string updateFreq = numericSendFrequency.Value + " " + (FrequencyUnit)comboSendFrequencyUnits.SelectedIndex; bool hasChanged = false; if (Prefs.UpdateString(PrefName.TransworldServiceTimeDue, accountUpdatesRuntime == DateTime.MinValue?"":POut.Time(accountUpdatesRuntime.TimeOfDay, false)) | Prefs.UpdateString(PrefName.TransworldServiceSendFrequency, updateFreq)) { Prefs.UpdateDateT(PrefName.TransworldDateTimeLastUpdated, DateTime.MinValue); hasChanged = true; } if (Prefs.UpdateLong(PrefName.TransworldPaidInFullBillingType, billTypePaidInFullDefNum) | hasChanged) { DataValid.SetInvalid(InvalidType.Prefs); } DialogResult = DialogResult.OK; }
private void SaveProgram() { SaveClinicCurProgramPropertiesToDict(); _progCur.Enabled = checkEnabled.Checked; UpdateProgramProperty(_useService, POut.Bool(checkUseService.Checked)); UpdateProgramProperty(_showCommlogsInChartAndAccount, POut.Bool(checkShowCommlogsInChart.Checked)); UpdateProgramProperty(_disableAdvertising, POut.Bool(checkHideButtons.Checked)); UpdateProgramProperty(_apptSetCompleteMins, textApptSetComplete.Text); UpdateProgramProperty(_apptTimeArrivedMins, textApptTimeArrived.Text); UpdateProgramProperty(_apptTimeDismissedMins, textApptTimeDismissed.Text); UpdateProgramProperty(_compName, textCompNameOrIP.Text); UpdateProgramProperty(_apiToken, textAPIToken.Text); UpdateProgramProperty(_newPatTriggerType, POut.Int((int)_newPatTriggerEnum)); UpdateProgramProperty(_existingPatTriggerType, POut.Int((int)_existingPatTriggerEnum)); UpsertProgramPropertiesForClinics(); Programs.Update(_progCur); }
private bool SaveToDb() { if (textProgDesc.Text == "") { MsgBox.Show(this, "Description may not be blank."); return(false); } if (textHL7FolderOut.Text == "") { MsgBox.Show(this, "HL7 out folder may not be blank."); return(false); } ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; Programs.Update(ProgramCur); Prefs.UpdateString(PrefName.HL7FolderOut, textHL7FolderOut.Text); DataValid.SetInvalid(InvalidType.Programs, InvalidType.Prefs); return(true); }
private void butOK_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; if (!Directory.Exists(textExportFolder.Text)) { Cursor = Cursors.Default; MsgBox.Show(this, "Export folder does not exist."); return; } if (comboBillType.SelectedIndex == -1) { Cursor = Cursors.Default; MsgBox.Show(this, "Please select a billing type."); return; } if (!Regex.IsMatch(textPassword.Text, @"^[A-Z]{2}\d{4}$")) { Cursor = Cursors.Default; MsgBox.Show(this, "Password is not in correct format. Must be like this: AB1234"); return; } long billtype = _listBillingTypeDefs[comboBillType.SelectedIndex].DefNum; bool hasChanges = false; if (_progCur.Enabled != checkEnabled.Checked) { _progCur.Enabled = checkEnabled.Checked; Programs.Update(_progCur); hasChanges = true; } if (hasChanges | ProgramProperties.SetProperty(_progCur.ProgramNum, "FolderPath", textExportFolder.Text) > 0 | ProgramProperties.SetProperty(_progCur.ProgramNum, "BillingType", billtype.ToString()) > 0 | ProgramProperties.SetProperty(_progCur.ProgramNum, "Password", textPassword.Text) > 0) { DataValid.SetInvalid(InvalidType.Programs); } Cursor = Cursors.Default; DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { //Program _prog.Enabled = checkEnable.Checked; _prog.ProgDesc = textProgDesc.Text; _prog.Path = textPath.Text; Programs.Update(_prog); //Toolbar button ToolButItems.DeleteAllForProgram(_prog.ProgramNum); foreach (ToolBarsAvail toolbar in listToolBars.SelectedItems) { ToolButItem newBut = new ToolButItem(); newBut.ProgramNum = _prog.ProgramNum; newBut.ToolBar = toolbar; newBut.ButtonText = textButText.Text; ToolButItems.Insert(newBut); } //Update settings as necessary UpdateBencoSettings(); MsgBox.Show(this, "You will need to restart Open Dental for these changes to take effect."); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (prog == null) { MsgBox.Show(this, "PayConnect entry is missing from the database."); //should never happen return; } if (comboPaymentType.SelectedIndex == -1) { MsgBox.Show(this, "Please select a payment type first."); return; } prog.Enabled = checkEnabled.Checked; Programs.Update(prog); propUsername.PropertyValue = textUsername.Text; ProgramProperties.Update(propUsername); propPassword.PropertyValue = textPassword.Text; ProgramProperties.Update(propPassword); propPayType.PropertyValue = DefC.Short[(int)DefCat.PaymentTypes][comboPaymentType.SelectedIndex].DefNum.ToString(); ProgramProperties.Update(propPayType); DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void butClose_Click(object sender, EventArgs e) { if (textSubInterval.errorProvider1.GetError(textSubInterval) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } bool changed = false; foreach (APIKey apiKeyHQ in _listApiKeysHQ) { APIKey apiKeyLocal = _listApiKeysLocal.FirstOrDefault(x => x.Key == apiKeyHQ.Key); if (apiKeyLocal == null || //A new key was generated but then Cancel was clicked on FormFHIRAPIKeyEdit. apiKeyLocal.DeveloperName != apiKeyHQ.DeveloperName || apiKeyLocal.DeveloperEmail != apiKeyHQ.DeveloperEmail || apiKeyLocal.DeveloperPhone != apiKeyHQ.DeveloperPhone || apiKeyLocal.ListPermissions.Any(x => !apiKeyHQ.ListPermissions.Contains(x)) || apiKeyHQ.ListPermissions.Any(x => !apiKeyLocal.ListPermissions.Contains(x))) { changed = true; break; } } if (changed && !UpdateKeysForOffice(_listApiKeysLocal)) { return; } Program prog = Programs.GetCur(ProgramName.FHIR); prog.Enabled = checkEnabled.Checked; Programs.Update(prog); ProgramProperty progProp = ProgramProperties.GetPropByDesc("SubscriptionProcessingFrequency", ProgramProperties.GetForProgram(prog.ProgramNum)); ProgramProperties.UpdateProgramPropertyWithValue(progProp, textSubInterval.Text); DataValid.SetInvalid(InvalidType.Programs); Close(); }
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 butOK_Click(object sender, System.EventArgs e) { #region Validation //if clinics are not enabled and the PaySimple program link is enabled, make sure there is a username and key set //if clinics are enabled, the program link can be enabled with blank username and/or key fields for some clinics //clinics with blank username and/or key will essentially not have PaySimple enabled if (checkEnabled.Checked && !IsClinicCurSetupDone()) //Also works for offices not using clinics { MsgBox.Show(this, "Please enter a username, key, and/or payment 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]; } string payTypeCCSelected = ""; if (comboPaymentTypeCC.SelectedIndex > -1) { payTypeCCSelected = comboPaymentTypeCC.GetSelected <Def>().DefNum.ToString(); } string payTypeACHSelected = ""; if (comboPaymentTypeACH.SelectedIndex > -1) { payTypeACHSelected = comboPaymentTypeACH.GetSelected <Def>().DefNum.ToString(); } //set the values in the list for this clinic _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiUserName) .ForEach(x => x.PropertyValue = textUsername.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiKey) .ForEach(x => x.PropertyValue = textKey.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePayTypeCC) .ForEach(x => x.PropertyValue = payTypeCCSelected); //always 1 item _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePayTypeACH) .ForEach(x => x.PropertyValue = payTypeACHSelected); //always 1 item _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePreventSavingNewCC) .ForEach(x => x.PropertyValue = POut.Bool(checkPreventSavingNewCC.Checked)); string payTypeCC; string payTypeACH; //make sure any other clinics with PaySimple 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; } payTypeCC = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeCC, _listUserClinicNums[i]); payTypeACH = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeACH, _listUserClinicNums[i]); //if the program is enabled and the username and key fields are not blank, //PaySimple is enabled for this clinic so make sure the payment type is also set if (ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiUserName, _listUserClinicNums[i]) != "" && //if username set ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiKey, _listUserClinicNums[i]) != "" //and key set //and either paytype is not a valid DefNum && (!_listPaymentTypeDefs.Any(x => x.DefNum.ToString() == payTypeCC) || !_listPaymentTypeDefs.Any(x => x.DefNum.ToString() == payTypeACH))) { MsgBox.Show(this, "Please select payment types for all clinics with PaySimple username and key 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); #endregion Save DataValid.SetInvalid(InvalidType.Programs); //Webhooks calls validation. This code needs to be under the validation section so people enabling the program for the first time will //be able to save their fields and the program properties will get filled correctly. //get url for webhooks, then create the webhooks if not already present. Has to be done after validation so new user enables are able to save. //for each clinic that has a username and api key, make a call to paysimple's api to see what webhooks this api account has. if (PrefC.HasClinicsEnabled) { foreach (long clinic in _listUserClinicNums) { WebhookHelper(GetUsernameForClinic(clinic), GetKeyForClinic(clinic), clinic); } } else { WebhookHelper(textUsername.Text, textKey.Text, 0); } DialogResult = DialogResult.OK; }
private bool SaveToDb() { if ((radioModeTight.Checked || radioModeFull.Checked) && comboDefaultUserGroup.SelectedIndex == -1) { MsgBox.Show(this, "Please select a default user group first."); return(false); } if (checkEnabled.Checked) { if (textProgDesc.Text == "") { MsgBox.Show(this, "Description may not be blank."); return(false); } if (!HL7Defs.IsExistingHL7Enabled()) { if ((radioModeTight.Checked || radioModeFull.Checked) && textHL7FolderIn.Text == "") { MsgBox.Show(this, "HL7 in folder may not be blank."); return(false); } if (textHL7FolderOut.Text == "") { MsgBox.Show(this, "HL7 out folder may not be blank."); return(false); } if (textHL7Server.Text == "") { MsgBox.Show(this, "HL7 Server may not be blank."); return(false); } if (textHL7ServiceName.Text == "") { MsgBox.Show(this, "HL7 Service Name may not be blank."); return(false); } } } ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; Programs.Update(ProgramCur); Prefs.UpdateString(PrefName.HL7FolderOut, textHL7FolderOut.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HL7Server", textHL7Server.Text); //this property will not exist if using Oracle, eCW will never use Oracle ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HL7ServiceName", textHL7ServiceName.Text); //this property will not exist if using Oracle, eCW will never use Oracle ProgramProperties.SetProperty(ProgramCur.ProgramNum, "MedicalPanelUrl", textMedPanelURL.Text); //this property will not exist if using Oracle, eCW will never use Oracle if (checkLBSessionId.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsLBSessionIdExcluded", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsLBSessionIdExcluded", "0"); } if (checkQuadAsToothNum.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsQuadAsToothNum", "1"); //this property will not exist if using Oracle, eCW will never use Oracle } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "IsQuadAsToothNum", "0"); //this property will not exist if using Oracle, eCW will never use Oracle } if (checkHideButChartRx.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HideChartRxButtons", "1"); //this property will not exist if using Oracle, eCW will never use Oracle } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HideChartRxButtons", "0"); //this property will not exist if using Oracle, eCW will never use Oracle } if (checkProcRequireSignature.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ProcRequireSignature", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ProcRequireSignature", "0"); } if (checkProcNotesNoIncomplete.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ProcNotesNoIncomplete", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ProcNotesNoIncomplete", "0"); } if (radioModeTight.Checked || radioModeFull.Checked) { if (radioModeTight.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "0"); //Tight } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "2"); //Full } ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eCWServer", textECWServer.Text); //this property will not exist if using Oracle, eCW will never use Oracle Prefs.UpdateString(PrefName.HL7FolderIn, textHL7FolderIn.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", _listUserGroups[comboDefaultUserGroup.SelectedIndex].UserGroupNum.ToString()); if (checkShowImages.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "0"); } if (this.checkFeeSchedules.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } } else if (radioModeStandalone.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "1"); Prefs.UpdateString(PrefName.HL7FolderIn, ""); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", "0"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } DataValid.SetInvalid(InvalidType.Programs, InvalidType.Prefs); return(true); }
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]; } string payTypeSelected = ""; if (comboPaymentType.SelectedIndex > -1) { payTypeSelected = _listPaymentTypeDefs[comboPaymentType.SelectedIndex].DefNum.ToString(); } string processingMethodSelected = comboDefaultProcessing.SelectedIndex.ToString(); //set the values in the list for this clinic _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == "Username") .ForEach(x => x.PropertyValue = textUsername.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == "Password") .ForEach(x => x.PropertyValue = textPassword.Text); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == "PaymentType") .ForEach(x => x.PropertyValue = payTypeSelected); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PayConnect.ProgramProperties.DefaultProcessingMethod) .ForEach(x => x.PropertyValue = processingMethodSelected); _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == "TerminalProcessingEnabled") .ForEach(x => x.PropertyValue = POut.Bool(checkTerminal.Checked)); //always 1 item; null safe _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PayConnect.ProgramProperties.PayConnectForceRecurringCharge) .ForEach(x => x.PropertyValue = POut.Bool(checkForceRecurring.Checked)); //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 //_listProgProps.FindAll(x => x.ClinicNum==clinicNum && x.PropertyDesc=="IsOnlinePaymentsEnabled") // .ForEach(x => x.PropertyValue=POut.Bool(checkWebPayEnabled.Checked));//always 1 item; null safe 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); #endregion Save DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private bool SaveToDb() { if ((radioModeTight.Checked || radioModeFull.Checked) && comboDefaultUserGroup.SelectedIndex == -1) { MsgBox.Show(this, "Please select a default user group first."); return(false); } if (checkEnabled.Checked) { if (textProgDesc.Text == "") { MsgBox.Show(this, "Description may not be blank."); return(false); } if (!HL7Defs.IsExistingHL7Enabled()) { if ((radioModeTight.Checked || radioModeFull.Checked) && textHL7FolderIn.Text == "") { MsgBox.Show(this, "HL7 in folder may not be blank."); return(false); } if (textHL7FolderOut.Text == "") { MsgBox.Show(this, "HL7 out folder may not be blank."); return(false); } if (textHL7Server.Text == "") { MsgBox.Show(this, "HL7 Server may not be blank."); return(false); } if (textHL7ServiceName.Text == "") { MsgBox.Show(this, "HL7 Service Name may not be blank."); return(false); } } } ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; Programs.Update(ProgramCur); Prefs.UpdateString(PrefName.HL7FolderOut, textHL7FolderOut.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HL7Server", textHL7Server.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "HL7ServiceName", textHL7ServiceName.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "MedicalPanelUrl", textMedPanelURL.Text); if (radioModeTight.Checked || radioModeFull.Checked) { if (radioModeTight.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "0"); //Tight } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "2"); //Full } ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eCWServer", textECWServer.Text); Prefs.UpdateString(PrefName.HL7FolderIn, textHL7FolderIn.Text); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", UserGroups.List[comboDefaultUserGroup.SelectedIndex].UserGroupNum.ToString()); if (checkShowImages.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "0"); } if (this.checkFeeSchedules.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "1"); } else { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } } else if (radioModeStandalone.Checked) { ProgramProperties.SetProperty(ProgramCur.ProgramNum, "eClinicalWorksMode", "1"); Prefs.UpdateString(PrefName.HL7FolderIn, ""); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "DefaultUserGroup", "0"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "ShowImagesModule", "1"); ProgramProperties.SetProperty(ProgramCur.ProgramNum, "FeeSchedulesSetManually", "0"); } DataValid.SetInvalid(InvalidType.Programs, InvalidType.Prefs); return(true); }