private void Page_Load(object sender, EventArgs e) { var iDaysBefore = 0; var iDaysAfter = 0; var iMax = 0; var iOwnerID = 0; var iLocationID = 0; var iImportance = 0; var categoryIDs = new ArrayList(); var locationIDs = new ArrayList(); var iGroupId = -1; var iUserId = -1; var iCategoryName = ""; var iLocationName = ""; var iOwnerName = ""; var txtPriority = ""; if (!(HttpContext.Current.Request.QueryString["Mid"] == "")) { this._moduleID = Convert.ToInt32(HttpContext.Current.Request.QueryString["mid"]); } else { this.Response.Redirect(Globals.NavigateURL(), true); } if (!(HttpContext.Current.Request.QueryString["tabid"] == "")) { this._tabID = Convert.ToInt32(HttpContext.Current.Request.QueryString["tabid"]); } else { this.Response.Redirect(Globals.NavigateURL(), true); } var localResourceFile = this.TemplateSourceDirectory + "/" + Localization.LocalResourceDirectory + "/EventRSS.aspx.resx"; if (!(HttpContext.Current.Request.QueryString["CategoryName"] == "")) { iCategoryName = HttpContext.Current.Request.QueryString["CategoryName"]; var objSecurity = new PortalSecurity(); iCategoryName = objSecurity.InputFilter(iCategoryName, PortalSecurity.FilterFlag.NoSQL); } if (!(HttpContext.Current.Request.QueryString["CategoryID"] == "")) { categoryIDs.Add(Convert.ToInt32(HttpContext.Current.Request.QueryString["CategoryID"])); } if (!(HttpContext.Current.Request.QueryString["LocationName"] == "")) { iLocationName = HttpContext.Current.Request.QueryString["LocationName"]; var objSecurity = new PortalSecurity(); iLocationName = objSecurity.InputFilter(iLocationName, PortalSecurity.FilterFlag.NoSQL); } if (!(HttpContext.Current.Request.QueryString["LocationID"] == "")) { locationIDs.Add(Convert.ToInt32(HttpContext.Current.Request.QueryString["LocationID"])); } if (!(HttpContext.Current.Request.QueryString["groupid"] == "")) { iGroupId = Convert.ToInt32(HttpContext.Current.Request.QueryString["groupid"]); } if (!(HttpContext.Current.Request.QueryString["DaysBefore"] == "")) { iDaysBefore = Convert.ToInt32(HttpContext.Current.Request.QueryString["DaysBefore"]); } if (!(HttpContext.Current.Request.QueryString["DaysAfter"] == "")) { iDaysAfter = Convert.ToInt32(HttpContext.Current.Request.QueryString["DaysAfter"]); } if (!(HttpContext.Current.Request.QueryString["MaxNumber"] == "")) { iMax = Convert.ToInt32(HttpContext.Current.Request.QueryString["MaxNumber"]); } if (!(HttpContext.Current.Request.QueryString["OwnerName"] == "")) { iOwnerName = HttpContext.Current.Request.QueryString["OwnerName"]; } if (!(HttpContext.Current.Request.QueryString["OwnerID"] == "")) { iOwnerID = Convert.ToInt32(HttpContext.Current.Request.QueryString["OwnerID"]); } if (!(HttpContext.Current.Request.QueryString["LocationName"] == "")) { iLocationName = HttpContext.Current.Request.QueryString["LocationName"]; } if (!(HttpContext.Current.Request.QueryString["LocationID"] == "")) { iLocationID = Convert.ToInt32(HttpContext.Current.Request.QueryString["LocationID"]); } if (!(HttpContext.Current.Request.QueryString["Priority"] == "")) { var iPriority = ""; iPriority = HttpContext.Current.Request.QueryString["Priority"]; var lHigh = ""; var lMedium = ""; var lLow = ""; lHigh = Localization.GetString("High", localResourceFile); lMedium = Localization.GetString("Normal", localResourceFile); lLow = Localization.GetString("Low", localResourceFile); txtPriority = "Medium"; if (iPriority == lHigh) { txtPriority = "High"; } else if (iPriority == lMedium) { txtPriority = "Medium"; } else if (iPriority == lLow) { txtPriority = "Low"; } else if (iPriority == "High") { txtPriority = "High"; } else if (iPriority == "Normal") { txtPriority = "Medium"; } else if (iPriority == "Low") { txtPriority = "Low"; } } if (!(HttpContext.Current.Request.QueryString["Importance"] == "")) { iImportance = Convert.ToInt32(HttpContext.Current.Request.QueryString["Importance"]); } var portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"]; this._portalID = portalSettings.PortalId; this._userinfo = (UserInfo)HttpContext.Current.Items["UserInfo"]; if (portalSettings.DefaultLanguage != "") { var userculture = new CultureInfo(portalSettings.DefaultLanguage, false); Thread.CurrentThread.CurrentCulture = userculture; } if (this._userinfo.UserID > 0) { if (this._userinfo.Profile.PreferredLocale != "") { var userculture = new CultureInfo(this._userinfo.Profile.PreferredLocale, false); Thread.CurrentThread.CurrentCulture = userculture; } } this._settings = EventModuleSettings.GetEventModuleSettings(this._moduleID, localResourceFile); if (this._settings.Enablecategories == EventModuleSettings.DisplayCategories.DoNotDisplay) { categoryIDs = this._settings.ModuleCategoryIDs; iCategoryName = ""; } if (!string.IsNullOrEmpty(iCategoryName)) { var oCntrlEventCategory = new EventCategoryController(); var oEventCategory = oCntrlEventCategory.EventCategoryGetByName(iCategoryName, this._portalID); if (!ReferenceEquals(oEventCategory, null)) { categoryIDs.Add(oEventCategory.Category); } } if (this._settings.Enablelocations == EventModuleSettings.DisplayLocations.DoNotDisplay) { locationIDs = this._settings.ModuleLocationIDs; iLocationName = ""; } if (!string.IsNullOrEmpty(iLocationName)) { var oCntrlEventLocation = new EventLocationController(); var oEventLocation = oCntrlEventLocation.EventsLocationGetByName(iLocationName, this._portalID); if (!ReferenceEquals(oEventLocation, null)) { locationIDs.Add(oEventLocation.Location); } } if (!this._settings.RSSEnable) { this.Response.Redirect(Globals.NavigateURL(), true); } if (this._settings.SocialGroupModule == EventModuleSettings.SocialModule.UserProfile) { iUserId = this._userinfo.UserID; } var getSubEvents = this._settings.MasterEvent; var dtEndDate = default(DateTime); if (HttpContext.Current.Request.QueryString["DaysAfter"] == "" && HttpContext.Current.Request.QueryString["DaysBefore"] == "") { iDaysAfter = this._settings.RSSDays; } var objEventTimeZoneUtilities = new EventTimeZoneUtilities(); var currDate = objEventTimeZoneUtilities.ConvertFromUTCToModuleTimeZone(DateTime.UtcNow, this._settings.TimeZoneId); dtEndDate = DateAndTime.DateAdd(DateInterval.Day, iDaysAfter, currDate).Date; var dtStartDate = default(DateTime); dtStartDate = DateAndTime.DateAdd(DateInterval.Day, Convert.ToDouble(-iDaysBefore), currDate).Date; var txtFeedRootTitle = ""; var txtFeedRootDescription = ""; var txtRSSDateField = ""; txtFeedRootTitle = this._settings.RSSTitle; txtFeedRootDescription = this._settings.RSSDesc; txtRSSDateField = this._settings.RSSDateField; this.Response.ContentType = "text/xml"; this.Response.ContentEncoding = Encoding.UTF8; using (var sw = new StringWriter()) { using (var writer = new XmlTextWriter(sw)) { // Dim writer As XmlTextWriter = New XmlTextWriter(sw) writer.Formatting = Formatting.Indented; writer.Indentation = 4; writer.WriteStartElement("rss"); writer.WriteAttributeString("version", "2.0"); writer.WriteAttributeString("xmlns:wfw", "http://wellformedweb.org/CommentAPI/"); writer.WriteAttributeString("xmlns:slash", "http://purl.org/rss/1.0/modules/slash/"); writer.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/"); writer.WriteAttributeString("xmlns:trackback", "http://madskills.com/public/xml/rss/module/trackback/"); writer.WriteAttributeString("xmlns:atom", "http://www.w3.org/2005/Atom"); writer.WriteAttributeString("xmlns", NsPre, null, NsFull); writer.WriteStartElement("channel"); writer.WriteStartElement("atom:link"); writer.WriteAttributeString("href", HttpContext.Current.Request.Url.AbsoluteUri); writer.WriteAttributeString("rel", "self"); writer.WriteAttributeString("type", "application/rss+xml"); writer.WriteEndElement(); writer.WriteElementString("title", portalSettings.PortalName + " - " + txtFeedRootTitle); if (portalSettings.PortalAlias.HTTPAlias.IndexOf("http://", StringComparison.Ordinal) == -1 && portalSettings.PortalAlias.HTTPAlias.IndexOf("https://", StringComparison.Ordinal) == -1) { writer.WriteElementString("link", Globals.AddHTTP(portalSettings.PortalAlias.HTTPAlias)); } else { writer.WriteElementString("link", portalSettings.PortalAlias.HTTPAlias); } writer.WriteElementString("description", txtFeedRootDescription); writer.WriteElementString("ttl", "60"); var objEventInfoHelper = new EventInfoHelper(this._moduleID, this._tabID, this._portalID, this._settings); var lstEvents = default(ArrayList); var tcc = new TokenReplaceControllerClass(this._moduleID, localResourceFile); var tmpTitle = this._settings.Templates.txtRSSTitle; var tmpDescription = this._settings.Templates.txtRSSDescription; if (categoryIDs.Count == 0) { categoryIDs.Add("-1"); } if (locationIDs.Count == 0) { locationIDs.Add("-1"); } lstEvents = objEventInfoHelper.GetEvents(dtStartDate, dtEndDate, getSubEvents, categoryIDs, locationIDs, iGroupId, iUserId); var objEventBase = new EventBase(); var displayTimeZoneId = objEventBase.GetDisplayTimeZoneId(this._settings, this._portalID); var rssCount = 0; foreach (EventInfo eventInfo in lstEvents) { var objEvent = eventInfo; if ((Convert.ToInt32(categoryIDs[0]) == 0) & (objEvent.Category != Convert.ToInt32(categoryIDs[0]))) { continue; } if ((Convert.ToInt32(locationIDs[0]) == 0) & (objEvent.Location != Convert.ToInt32(locationIDs[0]))) { continue; } if ((iOwnerID > 0) & (objEvent.OwnerID != iOwnerID)) { continue; } if (!string.IsNullOrEmpty(iOwnerName) && objEvent.OwnerName != iOwnerName) { continue; } if ((iLocationID > 0) & (objEvent.Location != iLocationID)) { continue; } if (!string.IsNullOrEmpty(iLocationName) && objEvent.LocationName != iLocationName) { continue; } if (iImportance > 0 && (int)objEvent.Importance != iImportance) { continue; } if (!string.IsNullOrEmpty(txtPriority) && objEvent.Importance.ToString() != txtPriority) { continue; } // If full enrollments should be hidden, ignore if (this.HideFullEvent(objEvent)) { continue; } var pubDate = default(DateTime); var pubTimeZoneId = ""; switch (txtRSSDateField) { case "UPDATEDDATE": pubDate = objEvent.LastUpdatedAt; pubTimeZoneId = objEvent.OtherTimeZoneId; break; case "CREATIONDATE": pubDate = objEvent.CreatedDate; pubTimeZoneId = objEvent.OtherTimeZoneId; break; case "EVENTDATE": pubDate = objEvent.EventTimeBegin; pubTimeZoneId = objEvent.EventTimeZoneId; break; } objEvent = objEventInfoHelper.ConvertEventToDisplayTimeZone(objEvent, displayTimeZoneId); writer.WriteStartElement("item"); var eventTitle = tcc.TokenReplaceEvent(objEvent, tmpTitle); writer.WriteElementString("title", eventTitle); var eventDescription = tcc.TokenReplaceEvent(objEvent, tmpDescription); var txtDescription = HttpUtility.HtmlDecode(eventDescription); writer.WriteElementString("description", txtDescription); var txtURL = objEventInfoHelper.DetailPageURL(objEvent); writer.WriteElementString("link", txtURL); writer.WriteElementString("guid", txtURL); writer.WriteElementString("pubDate", GetRFC822Date(pubDate, pubTimeZoneId)); writer.WriteElementString("dc:creator", objEvent.OwnerName); if (objEvent.Category > 0) { writer.WriteElementString("category", objEvent.CategoryName); } if (objEvent.Location > 0) { writer.WriteElementString("category", objEvent.LocationName); } if ((int)objEvent.Importance != 2) { var strImportance = Localization.GetString(objEvent.Importance + "Prio", localResourceFile); writer.WriteElementString("category", strImportance); } // specific event data writer.WriteElementString(NsPre, "AllDayEvent", null, objEvent.AllDayEvent.ToString()); writer.WriteElementString(NsPre, "Approved", null, objEvent.Approved.ToString()); writer.WriteElementString(NsPre, "Cancelled", null, objEvent.Cancelled.ToString()); writer.WriteElementString(NsPre, "Category", null, objEvent.CategoryName); //writer.WriteElementString(NsPre, "Location", Nothing, objEvent.LocationName) writer.WriteElementString(NsPre, "DetailURL", null, objEvent.DetailURL); writer.WriteElementString(NsPre, "EventTimeBegin", null, objEvent.EventTimeBegin.ToString("yyyy-MM-dd HH:mm:ss")); writer.WriteElementString(NsPre, "EventTimeZoneId", null, objEvent.EventTimeZoneId); writer.WriteElementString(NsPre, "Duration", null, objEvent.Duration.ToString()); writer.WriteElementString(NsPre, "ImageURL", null, objEvent.ImageURL); writer.WriteElementString(NsPre, "LocationName", null, objEvent.LocationName); writer.WriteElementString(NsPre, "OriginalDateBegin", null, objEvent.OriginalDateBegin.ToString("yyyy-MM-dd HH:mm:ss")); writer.WriteElementString(NsPre, "Signups", null, objEvent.Signups.ToString()); writer.WriteElementString(NsPre, "OtherTimeZoneId", null, objEvent.OtherTimeZoneId); writer.WriteEndElement(); rssCount++; if ((iMax > 0) & (rssCount == iMax)) { break; } } writer.WriteEndElement(); writer.WriteEndElement(); this.Response.Write(sw.ToString()); } } }
public override List <SitemapUrl> GetUrls(int portalID, PortalSettings ps, string version) { var sitemapUrls = new List <SitemapUrl>(); var objDesktopModule = default(DesktopModuleInfo); objDesktopModule = DesktopModuleController.GetDesktopModuleByModuleName("DNN_Events", portalID); var objModules = new ModuleController(); var objModule = default(ModuleInfo); var lstModules = objModules.GetModulesByDefinition(portalID, objDesktopModule.FriendlyName); var moduleIds = new ArrayList(); var visibleModuleIds = new ArrayList(); var visibleTabModuleIds = new ArrayList(); foreach (ModuleInfo tempLoopVar_objModule in lstModules) { objModule = tempLoopVar_objModule; var objTabPermissions = TabPermissionController.GetTabPermissions(objModule.TabID, portalID); var objTabPermission = default(TabPermissionInfo); foreach (TabPermissionInfo tempLoopVar_objTabPermission in objTabPermissions) { objTabPermission = tempLoopVar_objTabPermission; if (objTabPermission.PermissionKey == "VIEW" && objTabPermission.RoleName != "" && objTabPermission.AllowAccess && (objTabPermission.RoleID == -1) | (objTabPermission.RoleID == -3)) { if (objModule.InheritViewPermissions) { visibleTabModuleIds.Add("Tab" + objModule.TabID + "Mod" + objModule.ModuleID); visibleModuleIds.Add(objModule.ModuleID); break; } var objModulePermission = default(ModulePermissionInfo); // ReSharper disable LoopCanBeConvertedToQuery foreach (ModulePermissionInfo tempLoopVar_objModulePermission in objModule.ModulePermissions) { objModulePermission = tempLoopVar_objModulePermission; // ReSharper restore LoopCanBeConvertedToQuery if (objModulePermission.PermissionKey == "VIEW" && objModulePermission.RoleName != "" && objModulePermission.AllowAccess && (objModulePermission.RoleID == -1) | (objModulePermission.RoleID == -3)) { visibleTabModuleIds.Add("Tab" + objModule.TabID + "Mod" + objModule.ModuleID); visibleModuleIds.Add(objModule.ModuleID); break; } } } } } foreach (ModuleInfo tempLoopVar_objModule in lstModules) { objModule = tempLoopVar_objModule; // This check for objModule = Nothing because of error in DNN 5.0.0 in GetModulesByDefinition if (ReferenceEquals(objModule, null)) { continue; } if (objModule.IsDeleted) { continue; } if (moduleIds.Contains(objModule.ModuleID)) { continue; } if (!visibleTabModuleIds.Contains("Tab" + objModule.TabID + "Mod" + objModule.ModuleID)) { continue; } moduleIds.Add(objModule.ModuleID); var settings = EventModuleSettings.GetEventModuleSettings(objModule.ModuleID, null); if (!settings.EnableSitemap) { continue; } if (settings.SocialGroupModule == EventModuleSettings.SocialModule.UserProfile) { continue; } var iCategoryIDs = new ArrayList(); if (settings.Enablecategories == EventModuleSettings.DisplayCategories.DoNotDisplay) { iCategoryIDs = settings.ModuleCategoryIDs; } else { iCategoryIDs.Add("-1"); } var ilocationIDs = new ArrayList(); if (settings.Enablelocations == EventModuleSettings.DisplayLocations.DoNotDisplay) { ilocationIDs = settings.ModuleLocationIDs; } else { ilocationIDs.Add("-1"); } var objEventTimeZoneUtilities = new EventTimeZoneUtilities(); var currDate = objEventTimeZoneUtilities.ConvertFromUTCToModuleTimeZone(DateTime.UtcNow, settings.TimeZoneId); var dtStartDate = DateAndTime.DateAdd(DateInterval.Day, Convert.ToDouble(-settings.SiteMapDaysBefore), currDate); var dtEndDate = DateAndTime.DateAdd(DateInterval.Day, settings.SiteMapDaysAfter, currDate); var objEventInfoHelper = new EventInfoHelper(objModule.ModuleID, objModule.TabID, portalID, settings); var lstevents = default(ArrayList); lstevents = objEventInfoHelper.GetEvents(dtStartDate, dtEndDate, settings.MasterEvent, iCategoryIDs, ilocationIDs, -1, -1); var objEvent = default(EventInfo); foreach (EventInfo tempLoopVar_objEvent in lstevents) { objEvent = tempLoopVar_objEvent; if (settings.Enforcesubcalperms && !visibleModuleIds.Contains(objEvent.ModuleID)) { continue; } var pageUrl = new SitemapUrl(); pageUrl.Url = objEventInfoHelper.DetailPageURL(objEvent, false); pageUrl.Priority = settings.SiteMapPriority; pageUrl.LastModified = objEvent.LastUpdatedAt; pageUrl.ChangeFrequency = SitemapChangeFrequency.Daily; sitemapUrls.Add(pageUrl); } } return(sitemapUrls); }
private void BindData() { var objEventInfoHelper = new EventInfoHelper(ModuleId, TabId, PortalId, Settings); var objEventTimeZoneUtilities = new EventTimeZoneUtilities(); _eventModeration = new ArrayList(); switch (rbModerate.SelectedValue) { case "Events": _eventModeration = objEventInfoHelper.ConvertEventListToDisplayTimeZone( _objCtlEvent.EventsModerateEvents(ModuleId, GetUrlGroupId()), GetDisplayTimeZoneId()); _eventRecurModeration = new ArrayList(); _eventRecurModeration = _objCtlEventRecurMaster.EventsRecurMasterModerate(ModuleId, GetUrlGroupId()); foreach (EventRecurMasterInfo objRecurMaster in _eventRecurModeration) { objRecurMaster.Dtstart = objEventTimeZoneUtilities .ConvertToDisplayTimeZone(objRecurMaster.Dtstart, objRecurMaster.EventTimeZoneId, PortalId, GetDisplayTimeZoneId()).EventDate; } //Get data for selected date and fill grid grdEvents.DataSource = _eventModeration; grdEvents.DataBind(); if (_eventRecurModeration.Count > 0) { grdRecurEvents.DataSource = _eventRecurModeration; grdRecurEvents.DataBind(); grdRecurEvents.Visible = true; } grdEvents.Visible = true; grdEnrollment.Visible = false; break; case "Enrollment": _eventModeration = _objCtlEventSignups.EventsModerateSignups(ModuleId, GetUrlGroupId()); var objSignup = default(EventSignupsInfo); foreach (EventSignupsInfo tempLoopVar_objSignup in _eventModeration) { objSignup = tempLoopVar_objSignup; if (objSignup.UserID != -1) { objSignup.UserName = objEventInfoHelper .UserDisplayNameProfile(objSignup.UserID, objSignup.UserName, LocalResourceFile) .DisplayNameURL; } else { objSignup.UserName = objSignup.AnonName; objSignup.Email = objSignup.AnonEmail; } objSignup.EmailVisible = objSignup.Email != string.Empty; objSignup.EventTimeBegin = objEventTimeZoneUtilities .ConvertToDisplayTimeZone(objSignup.EventTimeBegin, objSignup.EventTimeZoneId, PortalId, GetDisplayTimeZoneId()).EventDate; } //Get data for selected date and fill grid grdEnrollment.DataSource = _eventModeration; grdEnrollment.DataBind(); //Add Remove Popup to grid var i = 0; if (grdEnrollment.Items.Count > 0) { for (i = 0; i <= grdEnrollment.Items.Count - 1; i++) { //Are You Sure You Wish To Email the User?' ((ImageButton)grdEnrollment.Items[i].FindControl("btnUserEmail")).Attributes.Add( "onclick", "javascript:return confirm('" + Localization .GetString( "ConfirmModerateSendMailToUser", LocalResourceFile) + "');"); ((ImageButton)grdEnrollment.Items[i].FindControl("btnUserEmail")).AlternateText = Localization.GetString("EmailUser", LocalResourceFile); ((ImageButton)grdEnrollment.Items[i].FindControl("btnUserEmail")).ToolTip = Localization.GetString("EmailUser", LocalResourceFile); } grdEvents.Visible = false; grdRecurEvents.Visible = false; grdEnrollment.Visible = true; } break; } if (_eventModeration.Count < 1) { //"No New Events/Enrollments to Moderate..." lblMessage.Text = Localization.GetString("MsgModerateNothingToModerate", LocalResourceFile); ShowButtonsGrid(false); } else { //Deny option will delete Event/Enrollment Entries from the Database!" lblMessage.Text = Localization.GetString("MsgModerateNoteDenyOption", LocalResourceFile); ShowButtonsGrid(true); } }
private string CleanupExpired() { var returnStr = "Event Cleanup completed."; var noDeletedEvents = 0; Status = "Performing Event Cleanup"; var objDesktopModule = default(DesktopModuleInfo); objDesktopModule = DesktopModuleController.GetDesktopModuleByModuleName("DNN_Events", 0); if (ReferenceEquals(objDesktopModule, null)) { return("Module Definition 'DNN_Events' not found. Cleanup cannot be performed."); } Status = "Performing Event Cleanup: Dummy"; Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName; var objPortals = new PortalController(); var objPortal = default(PortalInfo); var objModules = new ModuleController(); var objModule = default(ModuleInfo); var lstportals = objPortals.GetPortals(); foreach (PortalInfo tempLoopVar_objPortal in lstportals) { objPortal = tempLoopVar_objPortal; Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName + " PortalID: Dummy"; Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName + " PortalID:" + objPortal.PortalID; var lstModules = objModules.GetModulesByDefinition(objPortal.PortalID, objDesktopModule.FriendlyName); foreach (ModuleInfo tempLoopVar_objModule in lstModules) { objModule = tempLoopVar_objModule; // This check for objModule = Nothing because of error in DNN 5.0.0 in GetModulesByDefinition if (ReferenceEquals(objModule, null)) { continue; } Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName + " PortalID:" + objPortal.PortalID + " ModuleID: Dummy"; Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName + " PortalID:" + objPortal.PortalID + " ModuleID:" + objModule.ModuleID; var settings = EventModuleSettings.GetEventModuleSettings(objModule.ModuleID, null); if (settings.Expireevents != "") { Status = "Performing Event Cleanup:" + objDesktopModule.FriendlyName + " PortalID:" + objPortal.PortalID + " ModuleID:" + objModule.ModuleID + " IN PROGRESS"; var objEventCtl = new EventController(); var expireDate = DateAndTime.DateAdd(DateInterval.Day, -Convert.ToInt32(settings.Expireevents), DateTime.UtcNow); var startdate = expireDate.AddYears(-10); var endDate = expireDate.AddDays(1); var objEventInfoHelper = new EventInfoHelper(objModule.ModuleID, settings); var categoryIDs = new ArrayList(); categoryIDs.Add("-1"); var locationIDs = new ArrayList(); locationIDs.Add("-1"); var lstEvents = objEventInfoHelper.GetEvents(startdate, endDate, false, categoryIDs, locationIDs, -1, -1); var objEventTimeZoneUtilities = new EventTimeZoneUtilities(); foreach (EventInfo objEvent in lstEvents) { var eventTime = objEventTimeZoneUtilities.ConvertToUTCTimeZone( objEvent.EventTimeEnd, objEvent.EventTimeZoneId); if (eventTime < expireDate) { objEvent.Cancelled = true; objEventCtl.EventsSave(objEvent, true, 0, true); noDeletedEvents++; returnStr = "Event Cleanup completed. " + noDeletedEvents + " Events deleted."; } } objEventCtl.EventsCleanupExpired(objModule.PortalID, objModule.ModuleID); } } } Status = "Cleanup complete"; return(returnStr); }