private void butDelete_Click(object sender, System.EventArgs e) { //Before deleting the actual type, we would need to check special types. /*if(RecallCur.IsNew){ * DialogResult=DialogResult.Cancel; * return; * } * if(!MsgBox.Show(this,true,"Delete this RecallType?")) { * return; * } * try{ * Pharmacies.DeleteObject(PharmCur.PharmacyNum); * DialogResult=DialogResult.OK; * } * catch(Exception ex){ * MessageBox.Show(ex.Message); * }*/ if (!Security.IsAuthorized(Permissions.SecurityAdmin)) { return; } if (listTriggers.Items.Count > 0) { MsgBox.Show(this, "All triggers must first be deleted."); return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Are you absolutely sure you want to delete all recalls of this type?")) { return; } Recalls.DeleteAllOfType(RecallTypeCur.RecallTypeNum); CountForType = Recalls.GetCountForType(RecallTypeCur.RecallTypeNum); MsgBox.Show(this, "Done."); }
private void FormRecallTypeEdit_Load(object sender, System.EventArgs e) { textDescription.Text = RecallTypeCur.Description; defaultIntervalOld = RecallTypeCur.DefaultInterval; comboSpecial.Items.Add(Lan.g(this, "none")); comboSpecial.Items.Add(Lan.g(this, "Prophy")); comboSpecial.Items.Add(Lan.g(this, "ChildProphy")); comboSpecial.Items.Add(Lan.g(this, "Perio")); SetSpecialIdx(); CountForType = Recalls.GetCountForType(RecallTypeCur.RecallTypeNum); TriggerList = RecallTriggers.GetForType(RecallTypeCur.RecallTypeNum); //works if 0, too. SetSpecialText(); FillTriggers(); if (PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy) == RecallTypeCur.RecallTypeNum) { textRecallAgeAdult.Text = PrefC.GetInt(PrefName.RecallAgeAdult).ToString(); } textYears.Text = RecallTypeCur.DefaultInterval.Years.ToString(); textMonths.Text = RecallTypeCur.DefaultInterval.Months.ToString(); textWeeks.Text = RecallTypeCur.DefaultInterval.Weeks.ToString(); textDays.Text = RecallTypeCur.DefaultInterval.Days.ToString(); textPattern.Text = RecallTypeCur.TimePattern; checkAppendToSpecial.Checked = RecallTypeCur.AppendToSpecial; FillProcs(); }
private void comboSpecial_SelectionChangeCommitted(object sender, EventArgs e) { if (CountForType > 0) { MessageBox.Show(Lan.g(this, "Cannot change Special Type. Patients using this recall type: ") + CountForType.ToString()); SetSpecialIdx(); //sets back to what it was when form opened return; } //cannot change a special type to one that is already in set for another recall type if that recall type is in use by patients long recallTypeNumPrev = 0; switch (comboSpecial.SelectedIndex) { case 1: recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialProphy); break; case 2: recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialChildProphy); break; case 3: recallTypeNumPrev = PrefC.GetLong(PrefName.RecallTypeSpecialPerio); break; } int countForTypePrev = 0; if (recallTypeNumPrev > 0) { countForTypePrev = Recalls.GetCountForType(recallTypeNumPrev); } if (countForTypePrev > 0) { MessageBox.Show(Lan.g(this, "Cannot change Special Type to one that is set for another recall type and in use by patients. " + "Patients using the other recall type: ") + countForTypePrev.ToString()); SetSpecialIdx(); //sets back to what it was when form opened return; } SetSpecialText(); }