public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate) { var searchDocs = new List<SearchDocument> (); var settings = new DivisionSettingsRepository ().GetSettings (modInfo); using (var modelContext = new UniversityModelContext ()) { var division = modelContext.Get<DivisionInfo> (settings.DivisionID); if (division != null && division.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) { var aboutDivision = division.SearchDocumentText; var sd = new SearchDocument () { PortalId = modInfo.PortalID, AuthorUserId = division.LastModifiedByUserID, Title = division.Title, // Description = HtmlUtils.Shorten (aboutDivision, 255, "..."), Body = aboutDivision, ModifiedTimeUtc = division.LastModifiedOnDate.ToUniversalTime (), UniqueKey = string.Format ("University_Division_{0}", division.DivisionID), Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID), IsActive = division.IsPublished (DateTime.Now) }; searchDocs.Add (sd); } return searchDocs; } }
public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate) { var searchDocs = new List<SearchDocument> (); var settings = new EmployeeSettingsRepository ().GetSettings (modInfo); var employee = default (EmployeeInfo); using (var modelContext = new UniversityModelContext ()) { employee = modelContext.Get<EmployeeInfo> (settings.EmployeeID); } if (employee != null && employee.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) { var aboutEmployee = employee.SearchDocumentText; var sd = new SearchDocument () { PortalId = modInfo.PortalID, AuthorUserId = employee.LastModifiedByUserID, Title = employee.FullName, // Description = HtmlUtils.Shorten (aboutEmployee, 255, "..."), Body = aboutEmployee, ModifiedTimeUtc = employee.LastModifiedOnDate.ToUniversalTime (), UniqueKey = string.Format ("University_Employee_{0}", employee.EmployeeID), Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID), IsActive = employee.IsPublished (DateTime.Now) }; searchDocs.Add (sd); } return searchDocs; }
/// <summary> /// Handles Load event for a control /// </summary> /// <param name="e">Event args.</param> protected override void OnLoad (EventArgs e) { base.OnLoad (e); try { if (!IsPostBack) { var division_id = Request.QueryString ["division_id"]; if (!string.IsNullOrWhiteSpace (division_id)) { var division = default (DivisionInfo); using (var modelContext = new UniversityModelContext ()) { division = modelContext.Get<DivisionInfo> (int.Parse (division_id)); } if (division != null) { var vcard = division.VCard; Response.Clear (); Response.ContentType = "text/x-vcard"; Response.AddHeader ("content-disposition", string.Format ("attachment; filename=\"{0}.vcf\"", division.FileName)); if (Request.Browser.Platform.ToUpperInvariant ().StartsWith ("WIN")) { // HACK: Windows russian version hack // TODO: Need a way to determine language / locale for division description Response.ContentEncoding = Encoding.GetEncoding (1251); vcard.Encoding = Response.ContentEncoding; } else { Response.ContentEncoding = Encoding.UTF8; } Response.Write (vcard.ToString ()); Response.Flush (); Response.Close (); } else { throw new Exception ("No division found with DivisionID=" + division_id); } } else { throw new Exception ("\"division_id\" query parameter should not be empty"); } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException (this, ex); } }