public override void ItemUpdated(SPItemEventProperties properties) { try { SocialEngineEvents.ItemUpdated(properties); } catch { } try { //Initialize global variables if (Initialize(true, properties)) { //UpdateItem UpdateItem(properties); } //Dispose of DAO _DAO.Dispose(); } catch (Exception ex) { SPSecurity.RunWithElevatedPrivileges(delegate { if (!EventLog.SourceExists("EPMLive Reporting Item Updated")) { EventLog.CreateEventSource("EPMLive Reporting Item Updated", "EPM Live"); } using (var myLog = new EventLog("EPM Live", ".", "EPMLive Reporting Item Updated")) { myLog.MaximumKilobytes = 32768; myLog.WriteEntry( string.Format( "Name: {0} Url: {1} ID: {2} : {3}{4}", _SiteName, _SiteUrl, _SiteID, ex.Message, ex.StackTrace), EventLogEntryType.Error, 2002); } }); } finally { ClearResourceGridCache(properties); } }
public override void ItemDeleting(SPItemEventProperties properties) { try { SocialEngineEvents.ItemDeleting(properties); } catch { } try { if (Initialize(true, properties)) { //DeleteItem if (DeleteItem()) { //EPMLCID-6274: Delete RPTITEMGROUPS Security Groups Of Deleted Item. SPSecurity.RunWithElevatedPrivileges(delegate { using (var sqlCommand = new SqlCommand("DELETE RPTITEMGROUPS where siteid=@siteid and listid=@listid and itemid=@itemid", _DAO.GetClientReportingConnection())) { sqlCommand.Parameters.AddWithValue("@siteid", properties.SiteId); sqlCommand.Parameters.AddWithValue("@listid", properties.ListId); sqlCommand.Parameters.AddWithValue("@itemid", properties.ListItemId); sqlCommand.ExecuteNonQuery(); } }); } ////Check IF list reports work //if (_DAO.ListReportsWork(_TableName)) //{ // _DAO.DeleteWork(_ListID, _properties.ListItemId); //} } //Dispose of DAO _DAO.Dispose(); } catch (Exception ex) { SPSecurity.RunWithElevatedPrivileges(delegate { if (!EventLog.SourceExists("EPMLive Reporting Item Deleting")) { EventLog.CreateEventSource("EPMLive Reporting Item Deleting", "EPM Live"); } using (var myLog = new EventLog("EPM Live", ".", "EPMLive Reporting Item Deleting")) { myLog.MaximumKilobytes = 32768; myLog.WriteEntry( string.Format( "Name: {0} Url: {1} ID: {2} : {3}{4}", _SiteName, _SiteUrl, _SiteID, ex.Message, ex.StackTrace), EventLogEntryType.Error, 2003); } }); } finally { ClearResourceGridCache(properties); } }