private string CreateRow(ActivityData activityData) { return TR_BGN + TD_BGN + activityData.UserName + TD_END + TD_BGN + activityData.ActivityDate + TD_END + TD_BGN + activityData.ModuleName + TD_END + TD_BGN + activityData.Activity + TD_END + TR_END; }
public override string ToString() { string activityTags = ""; ActivityData activityData = null; for (int counter = 0; counter < array.Count; counter++) { activityData = array[counter]; activityTags = activityTags + activityData.ToString(); } return activityTags; }
public void Add(string userName, string userRole, DateTime activityDate, string moduleName, string activity) { activityData = new ActivityData(); activityData.UserName = userName; activityData.UserRole = userRole; activityData.ActivityDate = activityDate; activityData.ModuleName = moduleName; activityData.Activity = activity; array.Add(activityData); if (array.Count >= 15) { array.RemoveRange(0, array.Count); } }
/// <summary> /// This method is called by all the modules which require User Activity trace. /// </summary> /// <param name="source"></param> /// <param name="moduleName"></param> /// <param name="activity"></param> /// <param name="pageCode"></param> public void RaiseAuditEvent(object source, string moduleName, string activity, int pageCode) { ActivityData activityData = new ActivityData(); activityData.Activity = activity; activityData.ActivityDate = System.DateTime.Now.ToLocalTime(); activityData.ModuleName = moduleName; try { if (source != null) { Page currentPage = source as Page; activityData.UserName = currentPage.User.Identity.Name; UpdateApplicationObject(currentPage, moduleName, activity); } } catch { } string message = string.Format("{0} {1} on {2}.", activityData.UserName, activityData.Activity, String.Format("{0:MMM dd, yyyy hh:mm:ss tt}", activityData.ActivityDate) ); BCCWebAuditEvent bccEvent = new BCCWebAuditEvent(message, source, WebEventCodes.WebExtendedBase + pageCode, activityData); bccEvent.Raise(); }
/// <summary> /// Invoked in case of events identified only by their event code. /// </summary> /// <param name="msg"></param> /// <param name="eventSource"></param> /// <param name="eventCode"></param> /// <param name="activityData"></param> public BCCWebAuditEvent(string msg, object eventSource, int eventCode, ActivityData activityData) : base(msg, eventSource, eventCode) { this.activityData = activityData; }