public static bool HideDef(ODGrid gridDefs, DefCatOptions selectedDefCatOpt) { if (gridDefs.GetSelectedIndex() == -1) { MsgBox.Show(_lanThis, "Please select item first,"); return(false); } Def selectedDef = (Def)gridDefs.Rows[gridDefs.GetSelectedIndex()].Tag; //Warn the user if they are about to hide a billing type currently in use. if (selectedDefCatOpt.DefCat == DefCat.BillingTypes && Patients.IsBillingTypeInUse(selectedDef.DefNum)) { if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients, insurance plans, or preferences.")) { return(false); } } if (selectedDef.Category == DefCat.ProviderSpecialties && (Providers.IsSpecialtyInUse(selectedDef.DefNum) || Referrals.IsSpecialtyInUse(selectedDef.DefNum))) { MsgBox.Show(_lanThis, "You cannot hide a specialty if it is in use by a provider or a referral source."); return(false); } if (Defs.IsDefinitionInUse(selectedDef)) { if (selectedDef.DefNum == PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType) || selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeArrivedTrigger) || selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeSeatedTrigger) || selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeDismissedTrigger) || selectedDef.DefNum == PrefC.GetLong(PrefName.TreatPlanDiscountAdjustmentType) || selectedDef.DefNum == PrefC.GetLong(PrefName.BillingChargeAdjustmentType) || selectedDef.DefNum == PrefC.GetLong(PrefName.PracticeDefaultBillType) || selectedDef.DefNum == PrefC.GetLong(PrefName.FinanceChargeAdjustmentType)) { MsgBox.Show(_lanThis, "You cannot hide a definition if it is in use within Module Preferences."); return(false); } else { if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program.")) { return(false); } } } //Stop users from hiding the last definition in categories that must have at least one def in them. if (Defs.IsHidable(selectedDef.Category)) { List <Def> listDefsCurNotHidden = Defs.GetDefsForCategory(selectedDefCatOpt.DefCat, true); if (listDefsCurNotHidden.Count == 1) { MsgBox.Show(_lanThis, "You cannot hide the last definition in this category."); return(false); } } Defs.HideDef(selectedDef); return(true); }
private void butOK_Click(object sender, System.EventArgs e) { if (checkHidden.Checked) { if (Defs.IsDefinitionInUse(DefCur)) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program.")) { return; } } } if (textName.Text == "") { MsgBox.Show(this, "Name required."); return; } DefCur.ItemName = textName.Text; string itemVal = ""; if (checkChartModule.Checked) { itemVal += "X"; } if (checkPatientForms.Checked) { itemVal += "F"; } if (checkPatientPortal.Checked) { itemVal += "L"; } if (checkPatientPictures.Checked) { itemVal += "P"; } if (checkStatements.Checked) { itemVal += "S"; } if (checkToothCharts.Checked) { itemVal += "T"; } if (checkTreatmentPlans.Checked) { itemVal += "R"; } if (checkExpanded.Checked) { itemVal += "E"; } if (checkPaymentPlans.Checked) { itemVal += "A"; } if (!IsNew && checkExpanded.Checked != DefCur.ItemValue.Contains("E")) //If checkbox has been changed since opening form. { if (MsgBox.Show(this, true, "Expanded by default option changed. This change will affect all users. Continue?")) { //Remove all user specific preferences to enforce the new default. UserOdPrefs.DeleteForFkey(0, UserOdFkeyType.Definition, DefCur.DefNum); } } if (checkClaimAttachments.Checked) { itemVal += "C"; } if (checkLabCases.Checked) { itemVal += "B"; } DefCur.ItemValue = itemVal; DefCur.IsHidden = checkHidden.Checked; if (IsNew) { Defs.Insert(DefCur); } else { Defs.Update(DefCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (Defs.IsHidable(DefCur.Category) && checkHidden.Checked) { if (Defs.IsDefinitionInUse(DefCur)) { if (DefCur.DefNum == PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType) || DefCur.DefNum == PrefC.GetLong(PrefName.AppointmentTimeArrivedTrigger) || DefCur.DefNum == PrefC.GetLong(PrefName.AppointmentTimeSeatedTrigger) || DefCur.DefNum == PrefC.GetLong(PrefName.AppointmentTimeDismissedTrigger) || DefCur.DefNum == PrefC.GetLong(PrefName.TreatPlanDiscountAdjustmentType) || DefCur.DefNum == PrefC.GetLong(PrefName.BillingChargeAdjustmentType) || DefCur.DefNum == PrefC.GetLong(PrefName.FinanceChargeAdjustmentType) || DefCur.DefNum == PrefC.GetLong(PrefName.PrepaymentUnearnedType) || DefCur.DefNum == PrefC.GetLong(PrefName.PracticeDefaultBillType) || DefCur.DefNum == PrefC.GetLong(PrefName.SalesTaxAdjustmentType)) { MsgBox.Show(this, "You cannot hide a definition if it is in use within Module Preferences."); return; } else if (DefCur.DefNum.In( PrefC.GetLong(PrefName.RecallStatusMailed), PrefC.GetLong(PrefName.RecallStatusTexted), PrefC.GetLong(PrefName.RecallStatusEmailed), PrefC.GetLong(PrefName.RecallStatusEmailedTexted))) { MsgBox.Show(this, "You cannot hide a definition that is used as a status in the Setup Recall window."); return; } else if (DefCur.DefNum == PrefC.GetLong(PrefName.WebSchedNewPatConfirmStatus)) { MsgBox.Show(this, "You cannot hide a definition that is used as an appointment confirmation status in Web Sched New Pat Appt."); return; } else if (DefCur.DefNum == PrefC.GetLong(PrefName.WebSchedRecallConfirmStatus)) { MsgBox.Show(this, "You cannot hide a definition that is used as an appointment confirmation status in Web Sched Recall Appt."); return; } else { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program.")) { return; } } } //Stop users from hiding the last definition in categories that must have at least one def in them. if (!_defsList.Any(x => x.DefNum != DefCur.DefNum && !x.IsHidden)) { MsgBox.Show(this, "You cannot hide the last definition in this category."); return; } } if (textName.Text == "") { MsgBox.Show(this, "Name required."); return; } switch (DefCur.Category) { case DefCat.AccountQuickCharge: case DefCat.ApptProcsQuickAdd: string[] procCodes = textValue.Text.Split(','); List <string> listProcCodes = new List <string>(); for (int i = 0; i < procCodes.Length; i++) { ProcedureCode procCode = ProcedureCodes.GetProcCode(procCodes[i]); if (procCode.CodeNum == 0) { //Now check to see if the trimmed version of the code does not exist either. procCode = ProcedureCodes.GetProcCode(procCodes[i].Trim()); if (procCode.CodeNum == 0) { MessageBox.Show(Lan.g(this, "Invalid procedure code entered") + ": " + procCodes[i]); return; } } listProcCodes.Add(procCode.ProcCode); } textValue.Text = String.Join(",", listProcCodes); break; case DefCat.AdjTypes: if (textValue.Text != "+" && textValue.Text != "-" && textValue.Text != "dp") { MessageBox.Show(Lan.g(this, "Valid values are +, -, or dp.")); return; } break; case DefCat.BillingTypes: if (textValue.Text != "" && textValue.Text != "E" && textValue.Text != "C") { MsgBox.Show(this, "Valid values are blank, E, or C."); return; } if (checkHidden.Checked && Patients.IsBillingTypeInUse(DefCur.DefNum)) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients, insurance plans, or preferences.")) { return; } } break; case DefCat.ClaimCustomTracking: int value = 0; if (!Int32.TryParse(textValue.Text, out value) || value < 0) { MsgBox.Show(this, "Days Suppressed must be a valid non-negative number."); return; } break; case DefCat.CommLogTypes: if (textValue.Text != "" && textValue.Text != "MISC" && textValue.Text != "APPT" && textValue.Text != "FIN" && textValue.Text != "RECALL" && textValue.Text != "TEXT") { MessageBox.Show(Lan.g(this, "Valid values are blank,APPT,FIN,RECALL,MISC,or TEXT.")); return; } break; case DefCat.DiscountTypes: int discVal; if (textValue.Text == "") { break; } try { discVal = System.Convert.ToInt32(textValue.Text); } catch { MessageBox.Show(Lan.g(this, "Not a valid number")); return; } if (discVal < 0 || discVal > 100) { MessageBox.Show(Lan.g(this, "Valid values are between 0 and 100")); return; } textValue.Text = discVal.ToString(); break; /*case DefCat.FeeSchedNames: * if(textValue.Text=="C" || textValue.Text=="c") { * textValue.Text="C"; * } * else if(textValue.Text=="A" || textValue.Text=="a") { * textValue.Text="A"; * } * else textValue.Text=""; * break;*/ case DefCat.ImageCats: textValue.Text = textValue.Text.ToUpper().Replace(",", ""); if (!Regex.IsMatch(textValue.Text, @"^[XPS]*$")) { textValue.Text = ""; } break; case DefCat.InsurancePaymentType: if (textValue.Text != "" && textValue.Text != "N") { MsgBox.Show(this, "Valid values are blank or N."); return; } break; case DefCat.OperatoriesOld: if (textValue.Text.Length > 5) { MessageBox.Show(Lan.g(this, "Maximum length of abbreviation is 5.")); return; } break; case DefCat.ProcCodeCats: if (checkHidden.Checked) { if (IsDefCurLastShowing()) { MsgBox.Show(this, "At least one procedure code category must be enabled."); return; } } break; case DefCat.ProviderSpecialties: if (checkHidden.Checked && (Providers.IsSpecialtyInUse(DefCur.DefNum) || Referrals.IsSpecialtyInUse(DefCur.DefNum))) { MsgBox.Show(this, "You cannot hide a specialty if it is in use by a provider or a referral source."); checkHidden.Checked = false; return; } break; case DefCat.RecallUnschedStatus: if (textValue.Text.Length > 7) { MessageBox.Show(Lan.g(this, "Maximum length is 7.")); return; } break; case DefCat.TaskPriorities: if (checkHidden.Checked) { if (IsDefCurLastShowing()) { MsgBox.Show(this, "You cannot hide the last priority."); return; } } break; case DefCat.TxPriorities: if (textValue.Text.Length > 7) { MessageBox.Show(Lan.g(this, "Maximum length of abbreviation is 7.")); return; } break; default: break; } //end switch DefCur.Category DefCur.ItemName = textName.Text; DefCur.ItemValue = _selectedValueString; if (_defCatOptions.EnableValue && !_defCatOptions.IsValueDefNum) { DefCur.ItemValue = textValue.Text; } if (_defCatOptions.EnableColor) { DefCur.ItemColor = butColor.BackColor; } DefCur.IsHidden = checkHidden.Checked; if (IsNew) { Defs.Insert(DefCur); } else { Defs.Update(DefCur); } //Must be after the upsert so that we have access to the DefNum for new Defs. if (DefCur.Category == DefCat.ApptConfirmed) { //==================== EXCLUDE SEND ==================== if (checkExcludeSend.Checked) { _listExcludeSendNums.Add(DefCur.DefNum); } else { _listExcludeSendNums.RemoveAll(x => x == DefCur.DefNum); } string sendString = string.Join(",", _listExcludeSendNums.Distinct().OrderBy(x => x)); Prefs.UpdateString(PrefName.ApptConfirmExcludeESend, sendString); //==================== EXCLUDE CONFIRM ==================== if (checkExcludeConfirm.Checked) { _listExcludeConfirmNums.Add(DefCur.DefNum); } else { _listExcludeConfirmNums.RemoveAll(x => x == DefCur.DefNum); } string confirmString = string.Join(",", _listExcludeConfirmNums.Distinct().OrderBy(x => x)); Prefs.UpdateString(PrefName.ApptConfirmExcludeEConfirm, confirmString); //==================== EXCLUDE REMIND ==================== if (checkExcludeRemind.Checked) { _listExcludeRemindNums.Add(DefCur.DefNum); } else { _listExcludeRemindNums.RemoveAll(x => x == DefCur.DefNum); } string remindString = string.Join(",", _listExcludeRemindNums.Distinct().OrderBy(x => x)); Prefs.UpdateString(PrefName.ApptConfirmExcludeERemind, remindString); Signalods.SetInvalid(InvalidType.Prefs); } DialogResult = DialogResult.OK; }