public void LoadHistory(bool onlyThisSesion, E_EntityTypes eType, int LoadForID = 1) { IOrderedQueryable <Cl_Log> logs = null; if (onlyThisSesion) { if (eType == E_EntityTypes.RecordsPatterns) { logs = Cl_App.m_DataContext.p_Logs.Where(l => l.p_SessionID == Cl_SessionFacade.f_GetInstance().p_SessionID&& l.p_EntityType == eType).OrderByDescending(d => d.p_ChangeTime); } else { logs = Cl_App.m_DataContext.p_Logs.Where(l => l.p_SessionID == Cl_SessionFacade.f_GetInstance().p_SessionID&& l.p_ElementID == LoadForID && l.p_EntityType == eType).OrderByDescending(d => d.p_ChangeTime); } } else { if (eType == E_EntityTypes.RecordsPatterns) { logs = Cl_App.m_DataContext.p_Logs.Where(l => l.p_EntityType == eType).OrderByDescending(d => d.p_ChangeTime); } else { logs = Cl_App.m_DataContext.p_Logs.Where(l => l.p_ElementID == LoadForID && l.p_EntityType == eType).OrderByDescending(d => d.p_ChangeTime); } } f_FillLogs(logs); }
/// <summary> /// Установка первоначального объекта /// </summary> /// <param name="obj"></param> public void f_SetEntity(I_ELog obj) { if (logObject != null || obj == null) { return; } Cl_ELogClassAttribute classAtr = Cl_EntityLog.f_GetClassAttribute <Cl_ELogClassAttribute>(obj); if (classAtr == null) { return; } this.logObject = obj; this.entityLogType = classAtr.p_EntityType; lastValues = f_GetValues(logObject); }
/// <summary> /// Записывает индивидуальное сообщение лога для переданного объекта /// </summary> /// <param name="obj">Объект логирования</param> /// <param name="message">Сообщение лога</param> public static void f_CustomMessageLog(E_EntityTypes entityType, string message, int id = 1, int version = 0) { if (Cl_App.m_DataContext == null) { return; } Cl_Log outEvent = new Cl_Log { p_SessionID = Cl_SessionFacade.f_GetInstance().p_SessionID, p_ElementID = id, p_Version = version, p_EntityType = entityType, p_ChangeTime = DateTime.Now, p_Event = message, p_UserName = Cl_SessionFacade.f_GetInstance().p_Doctor.p_FIO }; Cl_App.m_DataContext.p_Logs.Add(outEvent); Cl_App.m_DataContext.SaveChanges(); }
public Cl_ELogClassAttribute(E_EntityTypes type) { this.p_EntityType = type; }