using framework_business; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; public partial class controls_module_calendarEventToolTip : System.Web.UI.UserControl { private Appointment apt; public Appointment TargetAppointment { get { return apt; } set { apt = value; } } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); int apptId = 0; int.TryParse(apt.ID.ToString(), out apptId); StringBuilder toolTipBuilder = new StringBuilder(); foreach (oCalendarEvent evnt in xData.GetTypedByCriteriaSpecific("recId", typeof(oCalendarEvent), "recId", apptId.ToString())) { //setup tooltip title string eventype = String.Empty; foreach (oCalendarEventType evTyp in xData.GetTypedByCriteriaSpecific("recId", typeof(oCalendarEventType), "recId", evnt.calendarEventTypeId.ToString())) { eventype = evTyp.name; break; } string location = String.Empty; foreach (oCalendarRoom loc in xData.GetTypedByCriteriaSpecific("recId", typeof(oCalendarRoom), "recId", evnt.calendarRoomId.ToString())) { location = loc.name; break; } string status = String.Empty; string icon = String.Empty; foreach (oCalendarStatus stat in xData.GetTypedByCriteriaSpecific("recId", typeof(oCalendarStatus), "recId", evnt.statusId.ToString())) { status = stat.status; icon = ""; break; } lblEventTitle.Text = "Location: " + location + "
Type: " + eventype + "
Date: " + apt.Owner.UtcToDisplay(apt.Start).ToString("dd-MM-yyyy") + "
Time: " + apt.Owner.UtcToDisplay(apt.Start).ToString("HH:mm") + " - " + apt.Owner.UtcToDisplay(apt.End).ToString("HH:mm") + "
Status: " + status + " " + icon; if (evnt.users != String.Empty) { //get users for the event ArrayList users = xCalendar.GetUsersForCalendar(evnt.calendarId, evnt.users); if (handler.ReturnSetup().code == "GLOB-1" || handler.ReturnSetup().code == "GLOB-2" || handler.ReturnSetup().code == "MEDI-1")//custom tooltip detail { foreach (oCalendarEventModule calMod in xData.GetTypedByCriteriaSpecific("recId", typeof(oCalendarEventModule), "calendarId", evnt.calendarId.ToString())) { pNums.Module typ = (pNums.Module)Enum.ToObject(typeof(pNums.Module), calMod.moduleId); switch (typ) { case pNums.Module.Surface: foreach (oUser usr in users) { //fetch surface item data DataTable surfaceData = xData.GetSurfaceItemData(calMod.entityId, usr.recId); foreach (DataRow row in surfaceData.Rows) { //1. Account Number string accountNumber = row.Table.Columns.Contains("PatientInformation_PatientDetails_PatientNumber") ? row["PatientInformation_PatientDetails_PatientNumber"].ToString() : String.Empty; if (accountNumber != String.Empty) { toolTipBuilder.AppendLine("

Patient Number: " + accountNumber + "

"); } //2. Surname, name toolTipBuilder.AppendLine("

Patient: " + usr.surname + ", " + usr.name + "

"); //3. Date of Birth DateTime dt = row.Table.Columns.Contains("PatientInformation_PatientDetails_DateofBirth") ? DateTime.Parse(row["PatientInformation_PatientDetails_DateofBirth"].ToString()) : DateTime.MinValue; if (dt.Year > 1900) { toolTipBuilder.AppendLine("

Date of Birth: " + dt.ToString("dd/MM/yyyy") + "

"); } //4. Contact Number //string contactNumH = row.Table.Columns.Contains("PatientInformation_PatientDetails_TelephoneH") ? row["PatientInformation_PatientDetails_TelephoneH"].ToString() : String.Empty; //if (contactNumH != String.Empty) //{ // toolTipBuilder.AppendLine("

Telephone: " + contactNumH + "

"); //} //5. mobile string mobile = row.Table.Columns.Contains("PatientInformation_PatientDetails_MobileNumber") ? row["PatientInformation_PatientDetails_MobileNumber"].ToString() : String.Empty; if (mobile != String.Empty) { toolTipBuilder.AppendLine("

Mobile: " + mobile + "

"); } toolTipBuilder.AppendLine("
"); //6.medical aid string medAidName = row.Table.Columns.Contains("PatientInformation_MedicalAidifapplicable_MedicalAidSchemeName") ? row["PatientInformation_MedicalAidifapplicable_MedicalAidSchemeName"].ToString() : String.Empty; if (medAidName != String.Empty) { foreach (oMedicalScheme scheme in xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalScheme), "code", medAidName)) { toolTipBuilder.AppendLine("

Medical Aid: " + scheme.name + "

"); break; } } //7.main member string mainMember = row.Table.Columns.Contains("PatientInformation_MedicalAidifapplicable_MainMembersName") ? row["PatientInformation_MedicalAidifapplicable_MainMembersName"].ToString() : String.Empty; if (mainMember != String.Empty) { toolTipBuilder.AppendLine("

Main Member: " + mainMember + "

"); } //8.Main member Contact string mainMemberContact = row.Table.Columns.Contains("PatientInformation_PersonResponsibleforAccountPayment_MobileNumber") ? row["PatientInformation_PersonResponsibleforAccountPayment_MobileNumber"].ToString() : String.Empty; if (mainMemberContact != String.Empty) { toolTipBuilder.AppendLine("

Main Member Contact: " + mainMemberContact + "

"); } break; } } break; case pNums.Module.Users: foreach (oUser usr in users) { toolTipBuilder.AppendLine("

Contact: " + usr.surname + ", " + usr.name + "

"); if (usr.tel != String.Empty) toolTipBuilder.AppendLine("

Mobile: " + usr.tel + "

"); if (usr.email != String.Empty) toolTipBuilder.AppendLine("

Email: " + usr.email + "

"); } break; } } } else//default tooltip detail { foreach (oUser usr in users) { toolTipBuilder.AppendLine("

Contact: " + usr.surname + ", " + usr.name + "

"); if (usr.tel != String.Empty) toolTipBuilder.AppendLine("

Mobile: " + usr.tel + "

"); if (usr.email != String.Empty) toolTipBuilder.AppendLine("

Email: " + usr.email + "

"); } } } else if (evnt.isNewContact) { toolTipBuilder.AppendLine("

New Contact

"); toolTipBuilder.AppendLine("

Contact: " + evnt.newContactSurname + ", " + evnt.newContactName + "

"); if (evnt.newContactTel != String.Empty) toolTipBuilder.AppendLine("

Mobile: " + evnt.newContactTel + "

"); if (evnt.newContactEmail != String.Empty) toolTipBuilder.AppendLine("

Email: " + evnt.newContactEmail + "

"); } } litDetail.Text = toolTipBuilder.ToString(); } protected void Page_Load(object sender, EventArgs e) { } }