private void FormBackup_Load(object sender, System.EventArgs e) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) //Archive not supported over MT connection. Show warning if Middle Tier is in use. { butArchive.Enabled = false; labelWarning.Text = Lan.g(this, "Not available when using a Middle Tier connection. You may only remove old data when directly connected to the server."); labelWarning.Visible = true; } #region Backup Tab //usesInternalImages=(PrefC.GetString(PrefName.ImageStore)=="OpenDental.Imaging.SqlStore"); checkExcludeImages.Checked = PrefC.GetBool(PrefName.BackupExcludeImageFolder); checkArchiveDoBackupFirst.Checked = PrefC.GetBool(PrefName.ArchiveDoBackupFirst); textBackupFromPath.Text = PrefC.GetString(PrefName.BackupFromPath); textBackupToPath.Text = PrefC.GetString(PrefName.BackupToPath); textBackupRestoreFromPath.Text = PrefC.GetString(PrefName.BackupRestoreFromPath); textBackupRestoreToPath.Text = PrefC.GetString(PrefName.BackupRestoreToPath); textBackupRestoreAtoZToPath.Text = PrefC.GetString(PrefName.BackupRestoreAtoZToPath); textBackupRestoreAtoZToPath.Enabled = ShouldUseAtoZFolder(); butBrowseRestoreAtoZTo.Enabled = ShouldUseAtoZFolder(); if (ProgramProperties.IsAdvertisingDisabled(ProgramName.CentralDataStorage)) { groupManagedBackups.Visible = false; } #endregion #region Archive Tab string decryptedPass; CDT.Class1.Decrypt(PrefC.GetString(PrefName.ArchivePassHash), out decryptedPass); textArchivePass.Text = decryptedPass; textArchivePass.PasswordChar = (textArchivePass.Text == "" ? default(char) : '*'); textArchiveServerName.Text = PrefC.GetString(PrefName.ArchiveServerName); textArchiveUser.Text = PrefC.GetString(PrefName.ArchiveUserName); //If pref is set, use it. Otherwise, 3 years ago. dateTimeArchive.Value = PrefC.GetDate(PrefName.ArchiveDate) == DateTime.MinValue?DateTime.Today.AddYears(-3):PrefC.GetDate(PrefName.ArchiveDate); ToggleBackupSettings(); #endregion #region Supplemental Tab checkSupplementalBackupEnabled.Checked = PrefC.GetBool(PrefName.SupplementalBackupEnabled); if (PrefC.GetDate(PrefName.SupplementalBackupDateLastComplete).Year > 1880) { textSupplementalBackupDateLastComplete.Text = PrefC.GetDate(PrefName.SupplementalBackupDateLastComplete).ToString(); } textSupplementalBackupCopyNetworkPath.Text = PrefC.GetString(PrefName.SupplementalBackupNetworkPath); #endregion Supplemental Tab if (ODBuild.IsWeb()) { //OD Cloud users cannot use this tool because they're InnoDb. tabControl1.TabPages.Remove(tabPageBackup); //We don't want to allow the user to connect to another server. checkArchiveDoBackupFirst.Visible = false; checkArchiveDoBackupFirst.Checked = false; groupBoxBackupConnection.Visible = false; //We don't want the user to be able to tell if a directory exists. tabControl1.TabPages.Remove(tabPageSupplementalBackups); } }
private void FormEcwDiagAdv_Load(object sender, EventArgs e) { fillQueryList(); server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer"); //this property will not exist if using Oracle, eCW will never use Oracle port = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort"); //this property will not exist if using Oracle, eCW will never use Oracle buildConnectionString(); dummyConnString = "Server=" + server + ";" + "Port=" + port + ";" //although this does seem to cause a bug in Mono. We will revisit this bug if needed to exclude the port option only for Mono. + "Database=;" //ecwMaster;" //+"Connect Timeout=20;" + "User ID=" + username + ";" + "Password=;" //no password information. + "CharSet=utf8;" + "Treat Tiny As Boolean=false;" + "Allow User Variables=true;" + "Default Command Timeout=300;" //default is 30seconds + "Pooling=false" ; textConnString.Text = "Server=" + server + ";" + "Port=" + port + ";" //although this does seem to cause a bug in Mono. We will revisit this bug if needed to exclude the port option only for Mono. + "Database=;" //ecwMaster;" //+"Connect Timeout=20;" + "User ID=" + username + ";" + "Password=;" //no password information + "CharSet=utf8;" + "Treat Tiny As Boolean=false;" + "Allow User Variables=true;" + "Default Command Timeout=300;" //default is 30seconds + "Pooling=false" ;; //textQuery.Text="SHOW VARIABLES;"; //Show some relevent variables textQuery.Text = "SHOW VARIABLES " + "WHERE Variable_name IN " + "('basedir'," + " 'connect_timout'," + " 'datadir'," + " 'default_storage_engine'," + " 'general_log'," + " 'general_log_file'," + " 'hostname'," + " 'log_error'," + " 'pid_file'," + " 'port'," + " 'storage_engine'," + " 'tmpdir'," + " 'version'," + " 'version_compile_machine'," + " 'version_compile_os'" + ");"; RunQuery(); FillTables(); }
private void FormProgramLinkEdit_Load(object sender, System.EventArgs e) { if (ProgramCur.ProgName != "") { //user not allowed to delete program links that we include, only their own. butDelete.Enabled = false; } pathOverrideOld = ProgramProperties.GetLocalPathOverrideForProgram(ProgramCur.ProgramNum); textOverride.Text = pathOverrideOld; FillForm(); }
/// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually disabled if it is not OK, but this is needed for Confirmations, Recalls, etc.) </summary> public void SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk) { if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk)) { return; } if (wirelessPhone == "") { MsgBox.Show(this, "Please enter a phone number."); return; } if (!Programs.IsEnabled(ProgramName.CallFire)) { MsgBox.Show(this, "CallFire Program Link must be enabled."); return; } if (txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)) { MsgBox.Show(this, "It is not OK to text this patient."); return; } if (txtMsgOk == YN.No) { MsgBox.Show(this, "It is not OK to text this patient."); return; } string key = ProgramProperties.GetPropVal(ProgramName.CallFire, "Key From CallFire"); string msg = wirelessPhone + "," + message.Replace(",", ""); //ph#,msg Commas in msg cause error. try { CallFireService.SMSService callFire = new CallFireService.SMSService(); callFire.sendSMSCampaign( key, new string[] { msg }, "Open Dental"); } catch (Exception ex) { MsgBox.Show(this, "Error sending text message.\r\n\r\n" + ex.Message); return; } Commlog commlog = new Commlog(); commlog.CommDateTime = DateTime.Now; commlog.DateTStamp = DateTime.Now; commlog.CommType = DefC.Short[(int)DefCat.CommLogTypes][0].DefNum; //The first one in the list. We can enhance later. commlog.Mode_ = CommItemMode.Text; commlog.Note = msg; //phone,note commlog.PatNum = patNum; commlog.SentOrReceived = CommSentOrReceived.Sent; commlog.UserNum = Security.CurUser.UserNum; commlog.DateTimeEnd = DateTime.Now; Commlogs.Insert(commlog); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert Text Message"); }
private bool IsPaySimpleSetup() { //verify the selected clinic has a username and API key entered if (string.IsNullOrWhiteSpace(ProgramProperties.GetPropValForClinicOrDefault(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimpleApiUserName, _clinicNum)) || string.IsNullOrWhiteSpace(ProgramProperties.GetPropValForClinicOrDefault(_progCur.ProgramNum, PaySimple.PropertyDescs.PaySimpleApiKey, _clinicNum))) { MsgBox.Show(this, "The PaySimple username and/or key has not been set."); return(false); } return(true); }
private void FillGrid() { List <ProgramProperty> ProgramPropertiesForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum); Plugins.HookAddCode(this, "FormProgramLinkEdit.FillGrid_GetProgramProperties", ProgramPropertiesForProgram, ProgramCur); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g(this, "Property"), 260); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Value"), 130); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; foreach (ProgramProperty property in ProgramPropertiesForProgram) { if (property.PropertyDesc.In("Disable Advertising", ProgramProperties.PropertyDescs.ClinicHideButton)) //Don't display in grid { continue; } row = new GridRow(); row.Cells.Add(property.PropertyDesc); if (ProgramCur.ProgName == ProgramName.XVWeb.ToString() && property.PropertyDesc == XVWeb.ProgramProps.Password) { string decrypted; CDT.Class1.Decrypt(property.PropertyValue, out decrypted); row.Cells.Add(new string('*', decrypted.Length)); //Show the password as '*' } else if (ProgramCur.ProgName == ProgramName.XVWeb.ToString() && property.PropertyDesc == XVWeb.ProgramProps.ImageCategory) { Def imageCat = Defs.GetDefsForCategory(DefCat.ImageCats).FirstOrDefault(x => x.DefNum == PIn.Long(property.PropertyValue)); if (imageCat == null) { row.Cells.Add(""); } else if (imageCat.IsHidden) { row.Cells.Add(imageCat.ItemName + " " + Lans.g(this, "(hidden)")); } else { row.Cells.Add(imageCat.ItemName); } } else { row.Cells.Add(property.PropertyValue); } row.Tag = property; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void butOK_Click(object sender, System.EventArgs e) { ProgramPropertyCur.PropertyValue = textValue.Text; if (_isPassword) { string encryptedText; CDT.Class1.Encrypt(ProgramPropertyCur.PropertyValue, out encryptedText); ProgramPropertyCur.PropertyValue = encryptedText; } ProgramProperties.Update(ProgramPropertyCur); DialogResult = DialogResult.OK; }
///<summary>For each clinic, if the Username and Key are the same as the HQ (ClinicNum=0) Username and Key, update the clinic with the ///values in the text boxes. Only modifies other clinics if _indexClinicRevert=0, meaning user just modified the HQ clinic credentials.</summary> private void SynchWithHQ() { if (!PrefC.HasClinicsEnabled || _listUserClinicNums[_indexClinicRevert] > 0) //using clinics, and modifying the HQ clinic. otherwise return. { return; } string hqUsername = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiUserName, 0); //HQ Username before updating to value in textbox string hqKey = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiKey, 0); //HQ Key before updating to value in textbox string hqPayTypeCC = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeCC, 0); //HQ PaymentType before updating to combo box selection string payTypeCC = ""; if (comboPaymentTypeCC.SelectedIndex > -1) { payTypeCC = comboPaymentTypeCC.GetSelected <Def>().DefNum.ToString(); } string hqPayTypeACH = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeACH, 0); //HQ PaymentType before updating to combo box selection string payTypeACH = ""; if (comboPaymentTypeACH.SelectedIndex > -1) { payTypeACH = comboPaymentTypeACH.GetSelected <Def>().DefNum.ToString(); } //for each distinct ClinicNum in the prog property list for PaySimple except HQ foreach (long clinicNum in _listProgProps.Select(x => x.ClinicNum).Where(x => x > 0).Distinct()) { //if this clinic has a different username or key, skip it if (!_listProgProps.Exists(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiUserName && x.PropertyValue == hqUsername) || !_listProgProps.Exists(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimpleApiKey && x.PropertyValue == hqKey)) { continue; } //this clinic had a matching username and key, so update the username and key to keep it synched with HQ _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 if (!string.IsNullOrEmpty(payTypeCC)) { //update clinic payment type if it originally matched HQ's payment type and the selected payment type is valid _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePayTypeCC && x.PropertyValue == hqPayTypeCC) .ForEach(x => x.PropertyValue = payTypeCC); } if (!string.IsNullOrEmpty(payTypeACH)) { //update clinic payment type if it originally matched HQ's payment type and the selected payment type is valid _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == PaySimple.PropertyDescs.PaySimplePayTypeACH && x.PropertyValue == hqPayTypeACH) .ForEach(x => x.PropertyValue = payTypeACH); } } }
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.SelectedTag <Def>()?.DefNum ?? 0; 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; if (Prefs.UpdateString(PrefName.TransworldServiceTimeDue, accountUpdatesRuntime == DateTime.MinValue?"":POut.Time(accountUpdatesRuntime.TimeOfDay, false)) | Prefs.UpdateString(PrefName.TransworldServiceSendFrequency, updateFreq) | Prefs.UpdateLong(PrefName.TransworldPaidInFullBillingType, billTypePaidInFullDefNum)) { DataValid.SetInvalid(InvalidType.Prefs); } DialogResult = DialogResult.OK; }
private void gridMain_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e) { FormProgramProperty FormPP = new FormProgramProperty(); FormPP.ProgramPropertyCur = (ProgramProperty)ProgramPropertiesForProgram[e.Row]; FormPP.ShowDialog(); if (FormPP.DialogResult != DialogResult.OK) { return; } ProgramProperties.RefreshCache(); ProgramPropertiesForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum); FillGrid(); }
///<summary>Handles both visibility and checking of checkHideButtons.</summary> private void SetAdvertising() { checkHideButtons.Visible = true; ProgramProperty prop = ProgramProperties.GetForProgram(_progCur.ProgramNum).FirstOrDefault(x => x.PropertyDesc == "Disable Advertising"); if (checkEnabled.Checked || prop == null) { checkHideButtons.Visible = false; } if (prop != null) { checkHideButtons.Checked = (prop.PropertyValue == "1"); } }
private void FormClinics_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (IsSelectionMode) { return; } bool hasClinicChanges = false; if (Clinics.Sync(ListClinics, ListClinicsOld)) { hasClinicChanges = true; } if (Prefs.UpdateBool(PrefName.ClinicListIsAlphabetical, checkOrderAlphabetical.Checked)) { DataValid.SetInvalid(InvalidType.Prefs); } _listClinicDefLinksAll.Clear(); foreach (DefLinkClinic defLinkClinic in _listDefLinkClinicSpecialties) { if (defLinkClinic.ListDefLink.Exists(x => x.DefLinkNum == 0)) { defLinkClinic.ListDefLink.ForEach(x => x.FKey = defLinkClinic.Clinic.ClinicNum); } _listClinicDefLinksAll.AddRange(defLinkClinic.ListDefLink); } if (DefLinks.Sync(_listClinicDefLinksAll, _listClinicDefLinksAllOld)) { hasClinicChanges = true; } //Joe - Now that we have called sync on ListClinics we want to make sure that each clinic has program properties for PayConnect and XCharge //We are doing this because of a previous bug that caused some customers to have over 3.4 million duplicate rows in their programproperty table long payConnectProgNum = Programs.GetProgramNum(ProgramName.PayConnect); long xChargeProgNum = Programs.GetProgramNum(ProgramName.Xcharge); //Don't need to do this for PaySimple, because these will get generated as needed in FormPaySimpleSetup bool hasChanges = ProgramProperties.InsertForClinic(payConnectProgNum, ListClinics.Select(x => x.ClinicNum) .Where(x => ProgramProperties.GetListForProgramAndClinic(payConnectProgNum, x).Count == 0).ToList()); hasChanges = ProgramProperties.InsertForClinic(xChargeProgNum, ListClinics.Select(x => x.ClinicNum) .Where(x => ProgramProperties.GetListForProgramAndClinic(xChargeProgNum, x).Count == 0).ToList()) || hasChanges;//prevent short curcuit if (hasChanges) { DataValid.SetInvalid(InvalidType.Programs); } if (hasClinicChanges) { DataValid.SetInvalid(InvalidType.Providers); } }
///<summary>If Clinics are enabled, and the Program Link button is hidden for at least one clinic, display the warning label ///labelClinicStateWarning.</summary> private void ShowPLButHiddenLabel() { List <ProgramProperty> listProps = ProgramProperties.GetForProgram(ProgramCur.ProgramNum) .Where(x => x.PropertyDesc == ProgramProperties.PropertyDescs.ClinicHideButton).ToList(); if (PrefC.HasClinicsEnabled && !listProps.IsNullOrEmpty()) //If anything is in list, they have a hidden clinic. { labelClinicStateWarning.Visible = true; } else { labelClinicStateWarning.Visible = false; } }
///<summary>Opens a form where the user can type in their selection for a program poperty.</summary> private void ShowFormProgramProperty(ProgramProperty programProperty) { bool propIsPassword = ProgramCur.ProgName == ProgramName.XVWeb.ToString() && programProperty.PropertyDesc == XVWeb.ProgramProps.Password; FormProgramProperty formProgramProperty = new FormProgramProperty(propIsPassword); formProgramProperty.ProgramPropertyCur = programProperty; formProgramProperty.ShowDialog(); if (formProgramProperty.DialogResult != DialogResult.OK) { return; } ProgramProperties.RefreshCache(); FillGrid(); }
private void butOK_Click(object sender, EventArgs e) { try { string accessTokenFinal = WebSerializer.DeserializePrimitiveOrThrow <string>( WebServiceMainHQProxy.GetWebServiceMainHQInstance().GetDropboxAccessToken(WebSerializer.SerializePrimitive <string>(textAccessToken.Text))); ProgramPropertyAccessToken.PropertyValue = accessTokenFinal; ProgramProperties.Update(ProgramPropertyAccessToken); DataValid.SetInvalid(InvalidType.Programs); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Error:") + " " + ex.Message); return; } DialogResult = DialogResult.OK; }
private void FormDoseSpotAssignUserId_Load(object sender, EventArgs e) { _listClinicsInComboBox = Clinics.GetForUserod(Security.CurUser, true, "Headquarters"); List <ProgramProperty> listProgramProperties = ProgramProperties.GetForProgram(Programs.GetCur(ProgramName.eRx).ProgramNum); _listClinicIDs = listProgramProperties.FindAll(x => x.PropertyDesc == Erx.PropertyDescs.ClinicID); _listClinicKeys = listProgramProperties.FindAll(x => x.PropertyDesc == Erx.PropertyDescs.ClinicKey); _listClinicsInComboBox.RemoveAll(x =>//Remove all clinics that already have a DoseSpot Clinic ID OR Clinic Key entered _listClinicIDs.FindAll(y => !string.IsNullOrWhiteSpace(y.PropertyValue)).Select(y => y.ClinicNum).Contains(x.ClinicNum) || _listClinicKeys.FindAll(y => !string.IsNullOrWhiteSpace(y.PropertyValue)).Select(y => y.ClinicNum).Contains(x.ClinicNum) ); FillComboBox(); textClinicId.Text = _clinicErxCur.ClinicId; //ClinicID passed from Alert textClinicKey.Text = _clinicErxCur.ClinicKey; //ClinicKey passed from Alert textClinicDesc.Text = _clinicErxCur.ClinicDesc; //ClinicDesc passed from Alert }
///<summary>Opens a form where the user can select an option from a combo box for a program poperty.</summary> ///<param name="listValuesForDb">The value that should be stored in the db for the corresponding display item that is selected. This list should ///have the same number of items as listForDisplay.</param> ///<param name="listForDisplay">The value that will be displayed to the user in the combo box. This list should have the same number of items ///as listValuesForDb.</param> private void ShowComboBoxForProgramProperty(ProgramProperty programProperty, List <string> listValuesForDb, List <string> listForDisplay , string prompt) { ProgramProperty programPropertyOld = programProperty.Copy(); InputBox inputBox = new InputBox(prompt, listForDisplay, listValuesForDb.FindIndex(x => x == programProperty.PropertyValue)); inputBox.ShowDialog(); if (inputBox.DialogResult != DialogResult.OK || inputBox.SelectedIndex == -1 || listValuesForDb[inputBox.SelectedIndex] == programPropertyOld.PropertyValue) { return; } programProperty.PropertyValue = listValuesForDb[inputBox.SelectedIndex]; ProgramProperties.Update(programProperty, programPropertyOld); ProgramProperties.RefreshCache(); FillGrid(); }
private void FormXchargeTokenTool_Load(object sender, EventArgs e) { Program prog = Programs.GetCur(ProgramName.Xcharge); if (prog == null || !prog.Enabled) { MsgBox.Show(this, "X-Charge program link is not set up."); DialogResult = DialogResult.Cancel; return; } string path = Programs.GetProgramPath(prog); if (!File.Exists(path)) { MsgBox.Show(this, "X-Charge path is not valid."); DialogResult = DialogResult.Cancel; return; } //In order for X-Charge to be enabled, the enabled flag must be set and there must be a valid Username, Password, and PaymentType //If clinics are enabled, the Username, Password, and PaymentType fields are allowed to be blank/invalid for any clinic not using X-Charge //Therefore, we will validate the credentials and payment type using FormOpenDental.ClinicNum string paymentType = ProgramProperties.GetPropVal(prog.ProgramNum, "PaymentType", Clinics.ClinicNum); List <Def> _listPayTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true).FindAll(x => x.DefNum.ToString() == paymentType); //should be a list of 0 or 1 _xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum); _xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum); if (string.IsNullOrEmpty(_xUsername) || string.IsNullOrEmpty(_xPassword) || _listPayTypeDefs.Count < 1) { MsgBox.Show(this, "X-Charge username, password, or payment type for this clinic is invalid."); DialogResult = DialogResult.Cancel; return; } _listCreditCards = CreditCards.GetCardsWithTokenBySource( new List <CreditCardSource> { CreditCardSource.XServer, CreditCardSource.XServerPayConnect }); textTotal.Text = _listCreditCards.Count.ToString(); textVerified.Text = "0"; textInvalid.Text = "0"; if (_listCreditCards.Count == 0) { MsgBox.Show(this, "There are no credit cards with stored X-Charge tokens in the database."); return; } }
private void FormTrojanCollectSetup_Load(object sender, EventArgs e) { if (ODBuild.IsWeb()) { MsgBox.Show(this, "This program is not available in web mode."); Close(); return; } _progCur = Programs.GetCur(ProgramName.TrojanExpressCollect); textExportFolder.Text = ProgramProperties.GetPropVal(_progCur.ProgramNum, "FolderPath"); long billtype = PIn.Long(ProgramProperties.GetPropVal(_progCur.ProgramNum, "BillingType")); _listBillingTypeDefs = Defs.GetDefsForCategory(DefCat.BillingTypes, true); comboBillType.Items.AddRange(_listBillingTypeDefs.Select(x => x.ItemName).ToArray()); comboBillType.SelectedIndex = Math.Max(_listBillingTypeDefs.FindIndex(x => x.DefNum == billtype), 0); textPassword.Text = ProgramProperties.GetPropVal(_progCur.ProgramNum, "Password"); checkEnabled.Checked = _progCur.Enabled; }
private void UpsertProgramPropertiesForClinics() { List <ProgramProperty> listLocationIDsFromDb = ProgramProperties.GetForProgram(_progCur.ProgramNum).FindAll(x => x.PropertyDesc == Podium.PropertyDescs.LocationID); List <ProgramProperty> listLocationIDsCur = _dictLocationIDs.Values.ToList(); foreach (ProgramProperty ppCur in listLocationIDsCur) { if (listLocationIDsFromDb.Exists(x => x.ProgramPropertyNum == ppCur.ProgramPropertyNum)) { UpdateProgramProperty(listLocationIDsFromDb[listLocationIDsFromDb.FindIndex(x => x.ProgramPropertyNum == ppCur.ProgramPropertyNum)], ppCur.PropertyValue); //ppCur.PropertyValue will match textLocationID.Text } else { ProgramProperties.Insert(ppCur); //Program property for that clinicnum didn't exist, so insert it into the db. _hasProgramPropertyChanged = true; } } }
private void FormFHIRSetup_Load(object sender, EventArgs e) { Program prog = Programs.GetCur(ProgramName.FHIR); checkEnabled.Checked = prog.Enabled; textSubInterval.Text = ProgramProperties.GetPropVal(prog.ProgramNum, "SubscriptionProcessingFrequency"); Cursor = Cursors.WaitCursor; _listApiKeysHQ = GetApiKeys(); Cursor = Cursors.Default; if (_listApiKeysHQ == null) { DialogResult = DialogResult.Cancel; //We have already shown them an error message. return; } _listApiKeysLocal = _listApiKeysHQ.Select(x => x.Copy()).ToList(); FillGrid(); FillPermissions(); }
private void butOK_Click(object sender, EventArgs e) { if (comboClinics.SelectedIndex == -1) { MsgBox.Show(this, "Please select a clinic."); return; } _clinicErxCur.ClinicNum = comboClinics.GetSelected <Clinic>().ClinicNum; Program progErx = Programs.GetCur(ProgramName.eRx); ProgramProperty ppClinicID = _listClinicIDs.FirstOrDefault(x => x.ClinicNum == _clinicErxCur.ClinicNum); if (ppClinicID == null) { ppClinicID = new ProgramProperty(); ppClinicID.ProgramNum = progErx.ProgramNum; ppClinicID.ClinicNum = _clinicErxCur.ClinicNum; ppClinicID.PropertyDesc = Erx.PropertyDescs.ClinicID; ppClinicID.PropertyValue = _clinicErxCur.ClinicId; ProgramProperties.Insert(ppClinicID); } else { ppClinicID.PropertyValue = _clinicErxCur.ClinicId; ProgramProperties.Update(ppClinicID); } ProgramProperty ppClinicKey = _listClinicKeys.FirstOrDefault(x => x.ClinicNum == _clinicErxCur.ClinicNum); if (ppClinicKey == null) { ppClinicKey = new ProgramProperty(); ppClinicKey.ProgramNum = progErx.ProgramNum; ppClinicKey.ClinicNum = _clinicErxCur.ClinicNum; ppClinicKey.PropertyDesc = Erx.PropertyDescs.ClinicKey; ppClinicKey.PropertyValue = _clinicErxCur.ClinicKey; ProgramProperties.Insert(ppClinicKey); } else { ppClinicKey.PropertyValue = _clinicErxCur.ClinicKey; ProgramProperties.Update(ppClinicKey); } DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }
private void butClinicLink_Click(object sender, EventArgs e) { //Get the users total list of unrestricted clinics, then acquire their list of ProgramProperties so we can tell which PL buttons //should be hidden based upon ProgramProperty.PropertyDesc/ClinicNum. List <Clinic> listClinics = Clinics.GetForUserod(Security.CurUser, doIncludeHQ: true, hqClinicName: Lan.g(this, "HQ")); //Include HQ if user not restricted. //Filter the list of all Hidden button ProgramProperties down to the clinics the user has access to. This will be passed to FormProgramLinkHideClinics. List <ProgramProperty> listPropsForUser = ProgramProperties.GetForProgram(ProgramCur.ProgramNum) .Where(x => x.PropertyDesc == ProgramProperties.PropertyDescs.ClinicHideButton && x.ClinicNum.In(listClinics.Select(y => y.ClinicNum))) .ToList(); FormProgramLinkHideClinics formProgramLinkHideClinics = new FormProgramLinkHideClinics(ProgramCur, listPropsForUser, listClinics); if (formProgramLinkHideClinics.ShowDialog() == DialogResult.OK) { //Ensure other WS update their "hidden by clinic" properties. DataValid.SetInvalid(InvalidType.Programs, InvalidType.ToolBut); } ShowPLButHiddenLabel(); //Set the "Hide Button for Clinics" button based on the updated list. }
private void FormXchargeSetup_Load(object sender, EventArgs e) { prog = Programs.GetCur("Xcharge"); if (prog == null) { return; } checkEnabled.Checked = prog.Enabled; textPath.Text = prog.Path; prop = (ProgramProperty)ProgramProperties.GetForProgram(prog.ProgramNum)[0]; for (int i = 0; i < DefB.Short[(int)DefCat.PaymentTypes].Length; i++) { comboPaymentType.Items.Add(DefB.Short[(int)DefCat.PaymentTypes][i].ItemName); if (DefB.Short[(int)DefCat.PaymentTypes][i].DefNum.ToString() == prop.PropertyValue) { comboPaymentType.SelectedIndex = i; } } }
///<summary>Fill the rest of the UI with the current bridge settings.</summary> private void FillSettings() { //Set Enabled checkEnabled.Checked = Programs.IsEnabled(ProgramName.AvaTax); //Set radio buttons if (AvaTax.IsProduction) { radioProdEnv.Checked = true; } else { radioTestEnv.Checked = true; } //Set username and password textUsername.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Username); textPassword.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Password); //Fill Log Level options listBoxLogLevel.Items.Clear(); foreach (LogLevel lv in Enum.GetValues(typeof(LogLevel))) { ODBoxItem <LogLevel> currentItem = new ODBoxItem <LogLevel>(lv.ToString(), lv); listBoxLogLevel.Items.Add(currentItem); if (currentItem.Tag == AvaTax.LogDetailLevel) { listBoxLogLevel.SelectedItem = currentItem; } } //Set company code and sales tax def textCompanyCode.Text = AvaTax.CompanyCode; _defCurrentSalesTaxAdjType = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxAdjType); textAdjType.Text = _defCurrentSalesTaxAdjType.ItemName; _defCurrentSalesTaxReturnAdjType = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxReturnAdjType) ?? new Def(); textReturnAdjType.Text = _defCurrentSalesTaxReturnAdjType.ItemName; _patFieldDefCurrentTaxExempt = AvaTax.TaxExemptPatField; textTaxExempt.Text = (_patFieldDefCurrentTaxExempt != null) ? _patFieldDefCurrentTaxExempt.FieldName : ""; validTaxLockDate.Text = AvaTax.TaxLockDate.ToShortDateString(); //Set list of procCodes textPrePayCodes.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Prepay Proc Codes"); textDiscountCodes.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Discount Proc Codes"); //Set the list of overrides textOverrides.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Tax Code Overrides"); }
private void FillForm() { //ComboClinic is filled in the load method if (PIn.Int(_patNumOrChartNum.PropertyValue) == 1) { radioChart.Checked = true; } else { radioPatient.Checked = true; } List <ToolButItem> listToolButItems = ToolButItems.GetForProgram(_progCur.ProgramNum); listToolBars.Items.Clear(); for (int i = 0; i < Enum.GetNames(typeof(ToolBarsAvail)).Length; i++) { listToolBars.Items.Add(Enum.GetNames(typeof(ToolBarsAvail))[i]); } for (int i = 0; i < listToolButItems.Count; i++) { listToolBars.SetSelected((int)listToolButItems[i].ToolBar, true); } checkEnabled.Checked = _progCur.Enabled; textPath.Text = _progCur.Path; textButtonText.Text = listToolButItems[0].ButtonText; pictureBox.Image = PIn.Bitmap(_progCur.ButtonImage); try { textInfoFile.Text = _infoFilePath.PropertyValue; _pathOverrideOld = ProgramProperties.GetLocalPathOverrideForProgram(_progCur.ProgramNum); textOverride.Text = _pathOverrideOld; if (_dictLocationIDs.ContainsKey(_clinicNumCur)) { textLocationID.Text = _dictLocationIDs[_clinicNumCur].PropertyValue; } } 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; } }
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 (textOverride.Text != "") { if (!File.Exists(textOverride.Text)) { MsgBox.Show(this, "Local override path is not valid."); return; } } else 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; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(prog.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } 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; }
private void FormProgramLinkEdit_Load(object sender, System.EventArgs e) { _isLoading = true; if (ProgramCur.ProgName != "") { //user not allowed to delete program links that we include, only their own. butDelete.Enabled = false; } pathOverrideOld = ProgramProperties.GetLocalPathOverrideForProgram(ProgramCur.ProgramNum); textOverride.Text = pathOverrideOld; FillForm(); DisableUIElementsBasedOnClinicRestriction(); //Disable the UI Elements if needed. HideClinicControls(PrefC.HasClinicsEnabled); //Hide the "Hide Button for Clinics" button based upon the user's clinics being on or off. ShowPLButHiddenLabel(); //Display warning label for "Hide Button for Clinics" if needed. SetAdvertising(); if (!CanEnableProgram()) { labelCloudMessage.Visible = true; } _isLoading = false; }
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>For each clinic, if the Username and Password are the same as the HQ (ClinicNum=0) Username and Password, update the clinic with the ///values in the text boxes. Only modifies other clinics if _indexClinicRevert=0, meaning user just modified the HQ clinic credentials.</summary> private void SynchWithHQ() { if (!PrefC.HasClinicsEnabled || _listUserClinicNums[_indexClinicRevert] > 0) //using clinics, and modifying the HQ clinic. otherwise return. { return; } string hqUsername = ProgramProperties.GetPropValFromList(_listProgProps, "Username", 0); //HQ Username before updating to value in textbox string hqPassword = ProgramProperties.GetPropValFromList(_listProgProps, "Password", 0); //HQ Password before updating to value in textbox string hqPayType = ProgramProperties.GetPropValFromList(_listProgProps, "PaymentType", 0); //HQ PaymentType before updating to combo box selection //IsOnlinePaymentsEnabled will not be synced with HQ, since some clinics may need to disable patient portal payments //Token will not be synced with HQ, since some clinics may need to disable patient portal payments string payTypeCur = ""; if (comboPaymentType.SelectedIndex > -1) { payTypeCur = _listPaymentTypeDefs[comboPaymentType.SelectedIndex].DefNum.ToString(); } //for each distinct ClinicNum in the prog property list for PayConnect except HQ foreach (long clinicNum in _listProgProps.Select(x => x.ClinicNum).Where(x => x > 0).Distinct()) { //if this clinic has a different username or password, skip it if (!_listProgProps.Exists(x => x.ClinicNum == clinicNum && x.PropertyDesc == "Username" && x.PropertyValue == hqUsername) || !_listProgProps.Exists(x => x.ClinicNum == clinicNum && x.PropertyDesc == "Password" && x.PropertyValue == hqPassword)) { continue; } //this clinic had a matching username and password, so update the username and password to keep it synched with HQ _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 if (string.IsNullOrEmpty(payTypeCur)) { continue; } //update clinic payment type if it originally matched HQ's payment type and the selected payment type is valid _listProgProps.FindAll(x => x.ClinicNum == clinicNum && x.PropertyDesc == "PaymentType" && x.PropertyValue == hqPayType) .ForEach(x => x.PropertyValue = payTypeCur); //always 1 item; null safe } }