///<summary>Inserts the new clinic, refreshes the cache and then returns the clinic.</summary> public static Clinic CreateClinic(string description = "", long emailAddressNum = 0, string address = "", Def regionDef = null) { Clinic clinic = new Clinic(); clinic.Description = description; clinic.Abbr = description; //Texting is off by default. Use OpenDentalWebTests.TableTypes.EServiceAccountT.SetupEServiceAccount() to turn on texting for this clinic. clinic.SmsContractDate = DateTime.MinValue; clinic.EmailAddressNum = emailAddressNum; clinic.Address = address; if (address == "") { clinic.Address = "3995 Fairview Ind Dr SE Ste 110"; } clinic.City = "Salem"; clinic.State = "OR"; clinic.Zip = "97302-1288"; clinic.Phone = "5033635432"; clinic.Region = regionDef?.DefNum ?? 0; Clinics.Insert(clinic); if (description == "") { clinic.Description = "Clinic " + clinic.ClinicNum.ToString(); clinic.Abbr = "Clinic " + clinic.ClinicNum.ToString(); Clinics.Update(clinic); } Clinics.RefreshCache(); return(clinic); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { Clinic clinCur = (Clinic)gridMain.ListGridRows[e.Row].Tag; Clinic clinOld = clinCur.Copy(); FormClinicEdit FormCE = new FormClinicEdit(clinCur); FormCE.ShowDialog(); if (FormCE.DialogResult == DialogResult.OK) { Clinics.Update(FormCE.ClinicCur, clinOld); DataValid.SetInvalid(InvalidType.Providers); FillGrid(); } }
public void EmailMessages_FindAndReplacePostalAddressTag() { //Format disclaimer. PrefT.UpdateString(PrefName.EmailDisclaimerTemplate, "This email has been sent to you from:\r\n[PostalAddress].\r\n\r\nHow to unsubscribe:\r\nIf you no longer want to receive any email messages from us, simply reply to this email with the word \"unsubscribe\" in the subject line."); //Setup practice address. PrefT.UpdateString(PrefName.PracticeAddress, "Practice Address1 Here"); PrefT.UpdateString(PrefName.PracticeAddress2, "3275 Marietta St SE"); PrefT.UpdateString(PrefName.PracticeCity, "Salem"); PrefT.UpdateString(PrefName.PracticeST, "OR"); PrefT.UpdateString(PrefName.PracticeZip, "97317"); //Setup clinic address. Clinic clinic = ClinicT.CreateClinic(); clinic.Address = "Clinic Address1 Here"; Clinics.Update(clinic); Clinics.RefreshCache(); //Turn feature off. PrefT.UpdateBool(PrefName.EmailDisclaimerIsOn, false); string emailBody = "Hi, this is an email.\r\n\r\nRegards,\r\nEvery OD Engineer... ever."; string emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, 0); //Feature is off so no disclaimer added. Assert.AreEqual(emailBody, emailBodyWithDisclaimer); //Turn feature on. PrefT.UpdateBool(PrefName.EmailDisclaimerIsOn, true); //Turn clinics off. PrefT.UpdateBool(PrefName.EasyNoClinics, true); emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, 0); //Feature is on so disclaimer added (no clinic). Assert.AreNotEqual(emailBody, emailBodyWithDisclaimer); Assert.IsTrue(emailBodyWithDisclaimer.EndsWith("subject line.")); Assert.IsTrue(emailBodyWithDisclaimer.Contains("Practice Address")); Assert.IsFalse(emailBodyWithDisclaimer.Contains("Clinic Address")); //Turn clinics on. PrefT.UpdateBool(PrefName.EasyNoClinics, false); emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, clinic.ClinicNum); //Feature is on so disclaimer added (with clinic). Assert.AreNotEqual(emailBody, emailBodyWithDisclaimer); Assert.IsTrue(emailBodyWithDisclaimer.EndsWith("subject line.")); Assert.IsTrue(emailBodyWithDisclaimer.Contains("Clinic Address")); Assert.IsFalse(emailBodyWithDisclaimer.Contains("Practice Address")); }