protected string GetPhoneNbrs(int entity_id) { if (Utilities.GetAddressType().ToString() == "Contact") { Contact[] list = ContactDB.GetByEntityID(2, entity_id); string result = string.Empty; for (int i = 0; i < list.Length; i++) { result += (i > 0 ? Environment.NewLine : "") + list[i].AddrLine1; } return(result); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { ContactAus[] list = ContactAusDB.GetByEntityID(2, entity_id); string result = string.Empty; for (int i = 0; i < list.Length; i++) { result += (i > 0 ? Environment.NewLine : "") + list[i].AddrLine1; } return(result); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } }
public static void UnsubscribeAll(int patientID, string DB) { SystemVariables sysVariables = SystemVariableDB.GetAll(DB); if (sysVariables["AddressType"].Value == "Contact") { Contact[] emails = ContactDB.GetByEntityID(-1, patientID, 27, false, DB); foreach (Contact email in emails) { ContactDB.UpdateIsBillingIsNonbilling(email.ContactID, email.IsBilling, false, DB); } } else if (sysVariables["AddressType"].Value == "ContactAus") { ContactAus[] emails = ContactAusDB.GetByEntityID(-1, patientID, 27, false, DB); foreach (ContactAus email in emails) { ContactAusDB.UpdateIsBillingIsNonbilling(email.ContactID, email.IsBilling, false, DB); } } else { throw new Exception("Unknown AddressType in config: " + sysVariables["AddressType"].Value); } }
public static ContactAus GetFirstByEntityID(string contact_type_group_id, int entity_id, string contact_type_id = null, bool orderByShippingBeforeBilling = false) { ContactAus[] contacts = ContactAusDB.GetByEntityID(contact_type_group_id, entity_id, contact_type_id, orderByShippingBeforeBilling); if (contacts.Length == 0) { return(null); } else { return(contacts[0]); } }
public static string[] GetFaxesByEntityID(int entityID) // clone from ContactAus.GetEmailsByEntityID(entityID) { string[] faxes; if (Utilities.GetAddressType().ToString() == "Contact") { faxes = Contact.RemoveInvalidPhoneNumbers(ContactDB.GetByEntityID(-1, entityID, 29)).Select(r => Regex.Replace(r.AddrLine1, "[^0-9]", "")).ToArray(); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { faxes = ContactAus.RemoveInvalidPhoneNumbers(ContactAusDB.GetByEntityID(-1, entityID, 29)).Select(r => Regex.Replace(r.AddrLine1, "[^0-9]", "")).ToArray(); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } return(faxes); }
public static string[] GetEmailsByEntityID(int entityID) // clone from ContactAus.GetEmailsByEntityID(entityID) { string[] emails; if (Utilities.GetAddressType().ToString() == "Contact") { emails = Contact.RemoveInvalidEmailAddresses(ContactDB.GetByEntityID(-1, entityID, 27)).Select(r => r.AddrLine1).ToArray(); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { emails = ContactAus.RemoveInvalidEmailAddresses(ContactAusDB.GetByEntityID(-1, entityID, 27)).Select(r => r.AddrLine1).ToArray(); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } return(emails); }
protected void btnRegisterReferrerSelectionUpdate_Click(object sender, EventArgs e) { // can update info ... if needed... int newRegisterReferrerID = Convert.ToInt32(registerReferrerID.Value); if (newRegisterReferrerID == -1) { lblReferrerText.Text = "<b>All Referreres</b>"; } else { RegisterReferrer regRef = RegisterReferrerDB.GetByID(newRegisterReferrerID); //lblReferrerText.Text = regRef.Referrer.Person.FullnameWithoutMiddlename; string phNumTxt = string.Empty; if (Utilities.GetAddressType().ToString() == "Contact") { Contact[] phNums = ContactDB.GetByEntityID(2, regRef.Organisation.EntityID); for (int i = 0; i < phNums.Length; i++) { phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " (" + phNums[i].ContactType.Descr + ")"; } } else if (Utilities.GetAddressType().ToString() == "ContactAus") { ContactAus[] phNums = ContactAusDB.GetByEntityID(2, regRef.Organisation.EntityID); for (int i = 0; i < phNums.Length; i++) { phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " (" + phNums[i].ContactType.Descr + ")"; } } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } lblReferrerText.Text = "<b>" + regRef.Referrer.Person.FullnameWithoutMiddlename + "</b> [" + regRef.Organisation.Name + "]" + "<br />" + (phNumTxt.Length == 0 ? "" : phNumTxt + "<br />"); // put in referrers fax and phone numbers } }
protected void CreateNoteFile(string tmpFilename) { string header = string.Empty; Booking booking = BookingDB.GetByEntityID(GetFormID()); if (booking != null) { Site site = SiteDB.GetByID(Convert.ToInt32(Session["SiteID"])); string[] phNums; if (Utilities.GetAddressType().ToString() == "Contact") { phNums = ContactDB.GetByEntityID(-1, booking.Organisation.EntityID, 34).Select(r => r.AddrLine1).ToArray(); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { phNums = ContactAusDB.GetByEntityID(-1, booking.Organisation.EntityID, 34).Select(r => r.AddrLine1).ToArray(); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } if (phNums.Length == 0) { if (Utilities.GetAddressType().ToString() == "Contact") { phNums = ContactDB.GetByEntityID(-1, site.EntityID, 34).Select(r => r.AddrLine1).ToArray(); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { phNums = ContactAusDB.GetByEntityID(-1, site.EntityID, 34).Select(r => r.AddrLine1).ToArray(); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } } string numbers = string.Empty; if (phNums.Length > 0) { numbers += " - TEL " + phNums[0]; } if (phNums.Length > 1) { numbers += ", " + phNums[1]; } header += site.Name + numbers + Environment.NewLine; header += "Clinic: " + booking.Organisation.Name + Environment.NewLine; if (booking.Patient != null) { header += "Patient: " + booking.Patient.Person.FullnameWithoutMiddlename + Environment.NewLine; } if (booking.Offering != null) { header += "Service: " + booking.Offering.Name + Environment.NewLine; } header += "Provider: " + booking.Provider.Person.FullnameWithoutMiddlename + Environment.NewLine; header += "Date of Consultation: " + booking.DateStart.ToString("d MMM yyyy") + Environment.NewLine + Environment.NewLine + "Treatment Note:" + Environment.NewLine; } System.Collections.ArrayList notesList = new System.Collections.ArrayList(); foreach (GridViewRow row in GrdNote.Rows) { Label lblId = row.FindControl("lblId") as Label; Label lblText = row.FindControl("lblText") as Label; CheckBox chkPrint = row.FindControl("chkPrint") as CheckBox; if (lblId == null || lblText == null || chkPrint == null) { continue; } if (chkPrint.Checked) { notesList.Add(header + lblText.Text.Replace("<br/>", "\n")); } } if (notesList.Count == 0) { throw new CustomMessageException("Please select at least one note to print."); } UserView userView = UserView.GetInstance(); bool isAgedCare = booking != null && booking.Organisation != null ? booking.Organisation.IsAgedCare : userView.IsAgedCareView; string filename = isAgedCare ? "BlankTemplateAC.docx" : "BlankTemplate.docx"; string originalFile = Letter.GetLettersDirectory() + filename; if (!System.IO.File.Exists(originalFile)) { throw new CustomMessageException("Template File '" + filename + "' does not exist."); } string errorString = string.Empty; if (!WordMailMerger.Merge(originalFile, tmpFilename, null, null, 0, false, true, (string[])notesList.ToArray(typeof(string)), false, null, out errorString)) { throw new CustomMessageException("Error:" + errorString); } }
protected int AddPhoneNbrIfNotExists(Patient patient, int siteID, string phoneNumber) { // add phone number if different from existing int phone_id = -1; string[] phoneNumbers; if (Utilities.GetAddressType().ToString() == "Contact") { phoneNumbers = ContactDB.GetByEntityID(2, patient.Person.EntityID, -1).Select(r => r.AddrLine1).ToArray(); } else if (Utilities.GetAddressType().ToString() == "ContactAus") { phoneNumbers = ContactAusDB.GetByEntityID(2, patient.Person.EntityID, -1).Select(r => r.AddrLine1).ToArray(); } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } bool phoneNumberAlreadyExists = false; foreach (string p in phoneNumbers) { if (Regex.Replace(p, "[^0-9]", "") == Regex.Replace(phoneNumber, "[^0-9]", "")) { phoneNumberAlreadyExists = true; } } if (!phoneNumberAlreadyExists) { if (Utilities.GetAddressType().ToString() == "Contact") { if (phoneNumber.Length > 0) { phone_id = ContactDB.Insert(patient.Person.EntityID, Convert.ToInt32(ddlPhoneNumberType.SelectedValue), "", System.Text.RegularExpressions.Regex.Replace(phoneNumber, "[^0-9]", ""), string.Empty, -1, -1, -1, siteID, true, true); } } else if (Utilities.GetAddressType().ToString() == "ContactAus") { if (phoneNumber.Length > 0) { phone_id = ContactAusDB.Insert(patient.Person.EntityID, Convert.ToInt32(ddlPhoneNumberType.SelectedValue), "", System.Text.RegularExpressions.Regex.Replace(phoneNumber, "[^0-9]", ""), string.Empty, string.Empty, -1, -1, -1, siteID, true, true); } } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } } return(phone_id); }
protected void InitForm(int patientID) { HideAllRows(); string url = "/PatientReferrerHistoryPopupV2.aspx?id=" + patientID; string text = "History"; string onclick = @"onclick=""open_new_tab('" + url + @"');return false;"""; lblPatientReferrerHistoryPopup.Text = "<a " + onclick + " href=\"\">" + text + "</a>"; PatientReferrer[] patientReferrer = PatientReferrerDB.GetActiveEPCPatientReferrersOf(patientID); // = PatientReferrerDB.GetEPCPatientReferrersOf(patient.PatientID); if (patientReferrer.Length > 0) { PatientReferrer currentPatRegReferrer = patientReferrer[patientReferrer.Length - 1]; // get latest RegisterReferrer curRegReferrer = currentPatRegReferrer.RegisterReferrer; displayHaveReferrerRow.Visible = true; // only allow removing a referrer if no EPC set [ie no active healthcard, or healthcard with neither date set] HealthCard hc = HealthCardDB.GetActiveByPatientID(patientID); bool allowDelete = hc == null || !hc.HasEPC(); btnDelete.Visible = allowDelete; lblDeleteRegistrationReferrerBtnSeperator.Visible = allowDelete; //lblReferrer.Text = curRegReferrer.Referrer.Person.Surname + ", " + curRegReferrer.Referrer.Person.Firstname + " [" + curRegReferrer.Organisation.Name + "]" + " [" + currentPatRegReferrer.PatientReferrerDateAdded.ToString("dd-MM-yyyy") + "]"; string phNumTxt = string.Empty; if (Utilities.GetAddressType().ToString() == "Contact") { Contact[] phNums = ContactDB.GetByEntityID(2, curRegReferrer.Organisation.EntityID); for (int i = 0; i < phNums.Length; i++) { phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " (" + phNums[i].ContactType.Descr + ")"; } } else if (Utilities.GetAddressType().ToString() == "ContactAus") { ContactAus[] phNums = ContactAusDB.GetByEntityID(2, curRegReferrer.Organisation.EntityID); for (int i = 0; i < phNums.Length; i++) { phNumTxt += (i > 0 ? "<br />" : "") + Utilities.FormatPhoneNumber(phNums[i].AddrLine1) + " (" + phNums[i].ContactType.Descr + ")"; } } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } lblReferrer.Text = curRegReferrer.Referrer.Person.Surname + ", " + curRegReferrer.Referrer.Person.Firstname + (curRegReferrer.Organisation.Name.Length == 0 ? "" : " [" + curRegReferrer.Organisation.Name + "]") + "<br />" + Environment.NewLine + "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" + Environment.NewLine + "<tr><td>" + "Provider Nbr:" + "</td><td style=\"width:12px\"></td><td><font color=\"#A52A2A\">" + currentPatRegReferrer.RegisterReferrer.ProviderNumber + "</font></td></tr>" + Environment.NewLine + "<tr><td>" + "Date Added:" + "</td><td style=\"width:12px\"></td><td><font color=\"#A52A2A\">" + currentPatRegReferrer.PatientReferrerDateAdded.ToString("dd-MM-yyyy") + "</font></td></tr>" + Environment.NewLine + "</table>" + Environment.NewLine + (phNumTxt.Length == 0 ? "" : phNumTxt + "<br />"); // put in referrers fax and phone numbers lblReferrerRegisterID.Text = curRegReferrer.RegisterReferrerID.ToString(); } else { displayNoReferrerRow.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utilities.SetNoCache(Response); } try { if (Session == null || Session["DB"] == null) { throw new SessionTimedOutException(); } string booking_id = Request.QueryString["booking_id"]; if (booking_id == null || !Regex.IsMatch(booking_id, @"^\d+$")) { throw new CustomMessageException("Booking id does not exist or is not a number"); } Booking booking = BookingDB.GetByID(Convert.ToInt32(booking_id)); if (booking == null) { throw new CustomMessageException("Booking is null"); } Patient patient = booking.Patient; if (booking.Patient == null) { Response.Write("NONE"); } else { bool is_confirmed = booking.DateConfirmed != DateTime.MinValue; string ret = string.Empty; ret += booking.Patient.Person.FullnameWithoutMiddlename + "::"; ret += (is_confirmed ? "1" : "0") + "::"; if (Utilities.GetAddressType().ToString() == "Contact") { Contact[] phNums = ContactDB.GetByEntityID(2, booking.Patient.Person.EntityID); for (int i = 0; i < phNums.Length; i++) { if (i > 0) { ret += ","; } ret += phNums[i].AddrLine1; } } else if (Utilities.GetAddressType().ToString() == "ContactAus") { ContactAus[] phNums = ContactAusDB.GetByEntityID(2, booking.Patient.Person.EntityID); for (int i = 0; i < phNums.Length; i++) { if (i > 0) { ret += ","; } ret += phNums[i].AddrLine1; } } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } Response.Write(ret); } } catch (SessionTimedOutException) { Utilities.UnsetSessionVariables(); Response.Write("SessionTimedOutException"); } catch (Exception ex) { Response.Write((Utilities.IsDev() ? "Exception: " + ex.ToString() : "Error - please contact system administrator.")); } }