public string DisplayRecord(VolunteerTracker.ActiveRecord record) { string type = record.GetType().Name; string modifiedDate = record.GetTimeSinceModification(); string createdDate = record.GetTimeSinceCreation(); long userId = VolunteerTracker.Database.GetUserId(); VolunteerTracker.Database.SetUserId(VolunteerTracker.AccessControlList.ROOT_USERID); string modifiedBy = new VolunteerTracker.User(record.ModifiedBy).Email; VolunteerTracker.Database.SetUserId(userId); string linkUrl = ""; string linkText = ""; if (record is VolunteerTracker.Person) { //linkUrl = QuickPMWebsite.AppCode.Link.LinkTo((VolunteerTracker.Person)record, Page); return ""; } if (record is VolunteerTracker.Volunteer) { linkUrl = "Volunteer/Volunteer.aspx?Id=" + record.Id; linkText = ((VolunteerTracker.Volunteer)(record)).FirstName; } if (record is VolunteerTracker.Event) { linkUrl = "Event/Event.aspx?Id=" + record.Id; linkText = ((VolunteerTracker.Event)(record)).Name; } string link = "<a href=\"" + linkUrl + "\">" + linkText + "</a>"; return "<td>" + type + "</td><td>" + link + "</td><td style=\"background-color:#D8D8D8 \">" + modifiedDate + "</td><td style=\"background-color:#D8D8D8 \">" + createdDate + "</td>" + "</td><td style=\"background-color:#D8D8D8 \">" + modifiedBy + "</td>"; }
protected string GetPeriodQuery(VolunteerTracker.Period period) { string queryString = ""; bool hasMonth = false; bool hasYear = false; foreach (string query in Request.QueryString.Keys) { if (query.ToLower() == "month") { queryString += "month=" + period.Month + "&"; hasMonth = true; } else if (query.ToLower() == "year") { queryString += "year=" + period.Year + "&"; hasYear = true; } else { queryString += query + "=" + Request.QueryString[query] + "&"; } } if (!hasMonth) { queryString += "month=" + period.Month + "&"; } if (!hasYear) { queryString += "year=" + period.Year + "&"; } queryString = queryString.Trim(new char[] { '&' }); return queryString; }
/// <summary> /// Please note that the database connection must be properly set up before calling this function /// </summary> /// <param name="PropertyId"></param> /// <returns></returns> public static string DisplayContacts(VolunteerTracker.ActiveRecord obj, System.Web.UI.Page page) { List<VolunteerTracker.Person> contacts = VolunteerTracker.Person.GetContacts(obj); string html = ""; foreach (VolunteerTracker.Person contact in contacts) { html += DisplayContact(contact.Id, page); html += "<br/>"; } return html; }