public void UpdateApplicationCategory(int applicationID) { List <EnumParameter> enumMembers = typeof(LogCategory).GetEnumMembers(); string iDPath = this.CurrentEntities.loger_application.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => (s.ApplicationID == applicationID)).IDPath; using (List <int> .Enumerator enumerator = (from s in this.CurrentEntities.loger_application.Where("it.IDPath like '" + iDPath + "%'", new ObjectParameter[0]) select s.ApplicationID).ToList <int>().GetEnumerator()) { while (enumerator.MoveNext()) { int ApplicationIDItem = enumerator.Current; List <string> list2 = (from s in this.CurrentEntities.loger_category where s.ApplicationID == ApplicationIDItem select s.CategoryTypeCode).ToList <string>(); foreach (EnumParameter parameter in enumMembers) { if (!list2.Contains(parameter.Key)) { WTF.Logging.Entity.loger_category _category = new WTF.Logging.Entity.loger_category { CategoryTypeCode = parameter.Key, CategoryName = parameter.Description, ApplicationID = ApplicationIDItem, LogWriteType = "1" }; this.CurrentEntities.AddTologer_category(_category); } } this.CurrentEntities.SaveChanges(); } } }
public void InsertApplication(WTF.Logging.Entity.loger_application objloger_application) { objloger_application.ApplicationName.CheckIsNull("请输入程序名称", LogModuleType.LogManager); objloger_application.ApplicationCode.CheckIsNull("请输入程序代码", LogModuleType.LogManager); if (this.loger_application.Any <WTF.Logging.Entity.loger_application>(s => s.ApplicationCode == objloger_application.ApplicationCode)) { SysAssert.InfoHintAssert("输入的程序代码已经存在"); } objloger_application.SortIndex = 0; objloger_application.IDPath = ""; objloger_application.CreateDate = DateTime.Now; this.CurrentEntities.AddTologer_application(objloger_application); this.CurrentEntities.SaveChanges(); WTF.Logging.Entity.loger_application _application = this.loger_application.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ApplicationID == objloger_application.ParentID); objloger_application.SortIndex = objloger_application.ApplicationID; objloger_application.IDPath = _application.IDPath + objloger_application.ApplicationID + ","; List <EnumParameter> enumMembers = typeof(LogCategory).GetEnumMembers(); foreach (EnumParameter parameter in enumMembers) { WTF.Logging.Entity.loger_category _category = new WTF.Logging.Entity.loger_category { ApplicationID = objloger_application.ApplicationID, CategoryTypeCode = parameter.Key, CategoryName = parameter.Description, LogWriteType = "1" }; this.CurrentEntities.AddTologer_category(_category); } this.CurrentEntities.SaveChanges(); }
public void InsertCategory(WTF.Logging.Entity.loger_category objloger_category) { objloger_category.CategoryTypeCode.CheckIsNull("请输入日志类型代码", LogModuleType.LogManager); objloger_category.CategoryName.CheckIsNull("请输入日志类型名称", LogModuleType.LogManager); if (this.loger_category.Any <WTF.Logging.Entity.loger_category>(s => (s.ApplicationID == objloger_category.ApplicationID) && (s.CategoryTypeCode == objloger_category.CategoryTypeCode))) { SysAssert.ArgumentAssert <LogModuleType>("输入的日志类型代码已经存在", LogModuleType.LogManager); } this.CurrentEntities.AddTologer_category(objloger_category); this.CurrentEntities.SaveChanges(); }
public void AddTologer_category(loger_category loger_category) { base.AddObject("loger_category", loger_category); }