示例#1
0
 public void SetEventLogInfoFull(EventFullLog fullEvent, EventLog simpleEvent)
 {
     fullEvent.idUser             = simpleEvent.idUser;
     fullEvent.EventDate          = simpleEvent.EventDate;
     fullEvent.EventActionType    = simpleEvent.EventAction;
     fullEvent.EntityActionID     = simpleEvent.EntityID;
     fullEvent.PersonSessionID    = simpleEvent.SessionId;
     fullEvent.EntityActionName   = simpleEvent.EntityName;
     fullEvent.PersonMakingAction = simpleEvent.PersonName;
     fullEvent.EventMessage       = simpleEvent.EventMessage;
     fullEvent.Page            = simpleEvent.Page;
     fullEvent.SecuritySetting = simpleEvent.SecuritySetting;
 }
示例#2
0
        private void MakeFullDbLog(List <Tuple <EventLog, T> > itemsToLog)
        {
            //to make full db log the Entity needs to be ILoggable
            try
            {
                using (dbContextLog = new UMS_LOGEntities())
                {
                    for (int i = 0; i < itemsToLog.Count; i++)
                    {
                        EventFullLog eventFullLog = new EventFullLog();
                        SetEventLogInfoFull(eventFullLog, itemsToLog[i].Item1);


                        XmlDocument doc = XMLLogHelper.CreateNewXMLDoc(eventFullLog.EntityActionName);
                        SetAllProperties(doc, itemsToLog[i].Item2);
                        eventFullLog.FullLogPropertiesXML = XMLLogHelper.SringValueOf(doc);


                        //make async log in a different database by the simple log and the entity that is being saved
                        if (typeof(ICustomLoggable).IsAssignableFrom(typeof(T)))
                        {
                            ((ICustomLoggable)itemsToLog[i].Item2).CreateMeaningfulEntityLogXML(eventFullLog);
                        }


                        dbContextLog.AddToEventFullLogs(eventFullLog);
                        dbContextLog.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                BaseHelper.Log("Грешка при детайлно създаване на EventLog на entity " + savedEntity.GetType().FullName);
                BaseHelper.Log(e.Message);
            }
        }