Пример #1
0
        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();
        }
Пример #2
0
        public int DeleteApplication(int applicationID)
        {
            WTF.Logging.Entity.loger_application _application = this.loger_application.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ApplicationID == applicationID);
            string     iDPath = _application.IDPath;
            List <int> list   = (from s in this.loger_application.Where("it.IDPath like '" + iDPath + "%'", new ObjectParameter[0]) select s.ApplicationID).ToList <int>();

            this.loger_loging.DeleteDataSql <WTF.Logging.Entity.loger_loging>("ApplicationID in (" + list.ConvertListToString <int>() + ")", new object[0]);
            this.loger_application.DeleteDataSql <WTF.Logging.Entity.loger_application>("IDPath like '" + iDPath + "%'", new object[0]);
            return(_application.ParentID);
        }
Пример #3
0
 public void UpdateApplication(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.ApplicationID != objloger_application.ApplicationID) && (s.ApplicationCode == objloger_application.ApplicationCode)))
     {
         SysAssert.ArgumentAssert <LogModuleType>("输入的程序代码已经存在", LogModuleType.LogManager);
     }
     this.CurrentEntities.SaveChanges();
 }
Пример #4
0
        public string GetApplicationMoveTreexXml(int ApplicationID)
        {
            List <WTF.Logging.Entity.loger_application> source = this.CurrentEntities.loger_application.ToList <WTF.Logging.Entity.loger_application>();

            WTF.Logging.Entity.loger_application _application = source.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ParentID == 0);
            XmlDocument xmlDocSource = new XmlDocument();
            XmlElement  newChild     = xmlDocSource.CreateElement("TreeNodeMember");

            newChild.SetAttribute("TreeNodeID", _application.ApplicationID.ToString());
            newChild.SetAttribute("TreeNodeName", _application.ApplicationName);
            xmlDocSource.AppendChild(newChild);
            WTF.Logging.Entity.loger_application objMoveloger_application = source.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ApplicationID == ApplicationID);
            source = (from s in source
                      where !s.IDPath.StartsWith(objMoveloger_application.IDPath)
                      select s).ToList <WTF.Logging.Entity.loger_application>();
            this.CreateChildApplicationXmlElement(xmlDocSource, _application.ApplicationID, newChild, source, "");
            return(xmlDocSource.InnerXml);
        }
Пример #5
0
        public void ApplicationMove(int ApplicationID, int tagApplicationID)
        {
            string iDPath = this.CurrentEntities.loger_application.First <WTF.Logging.Entity.loger_application>(s => (s.ApplicationID == ApplicationID)).IDPath;
            ObjectQuery <WTF.Logging.Entity.loger_application> query = this.CurrentEntities.loger_application.Where("it.IDPath like '" + iDPath + "%'", new ObjectParameter[0]);

            WTF.Logging.Entity.loger_application _application2 = this.CurrentEntities.loger_application.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ApplicationID == tagApplicationID);
            string newValue = (_application2 == null) ? ("," + iDPath.ToString() + ",") : (_application2.IDPath + ApplicationID.ToString() + ",");

            foreach (WTF.Logging.Entity.loger_application _application3 in query)
            {
                _application3.IDPath = _application3.IDPath.Replace(iDPath, newValue);
                if (_application3.ApplicationID == ApplicationID)
                {
                    _application3.ParentID = tagApplicationID;
                }
            }
            this.SaveChanges();
        }
Пример #6
0
        public WTF.Logging.Entity.loger_application GetCacheApplication(string ApplicationCode)
        {
            string childKey = "Log" + ApplicationCode;

            WTF.Logging.Entity.loger_application fromCache = CacheHelper.GetFromCache <WTF.Logging.Entity.loger_application>(WTF.Framework.CacheType.Logging.ToString(), childKey);
            if (fromCache == null)
            {
                this.CurrentEntities.loger_application.MergeOption = MergeOption.NoTracking;
                fromCache = this.loger_application.Where("it.ApplicationCode='" + ApplicationCode + "'", new ObjectParameter[0]).Include("loger_category").FirstOrDefault <WTF.Logging.Entity.loger_application>();
                if (fromCache == null)
                {
                    return(null);
                }
                fromCache.AddToCache(WTF.Framework.CacheType.Logging.ToString(), childKey, ConfigHelper.GetIntValue("LogCacheTime", 10));
                return(fromCache);
            }
            return(fromCache);
        }
Пример #7
0
        public string GetApplicationXmlText(string url)
        {
            if (url.IndexOf('?') < 0)
            {
                url = url + "?";
            }
            else
            {
                url = url + "&";
            }
            List <WTF.Logging.Entity.loger_application> source = this.CurrentEntities.loger_application.ToList <WTF.Logging.Entity.loger_application>();

            WTF.Logging.Entity.loger_application _application = source.FirstOrDefault <WTF.Logging.Entity.loger_application>(s => s.ParentID == 0);
            XmlDocument xmlDocSource = new XmlDocument();
            XmlElement  newChild     = xmlDocSource.CreateElement("TreeNodeMember");

            newChild.SetAttribute("TreeNodeID", _application.ApplicationID.ToString());
            newChild.SetAttribute("TreeNodeName", _application.ApplicationName);
            newChild.SetAttribute("NavigateUrl", string.Format(url + "ApplicationID={0}", _application.ApplicationID.ToString()).EncryptModuleQuery());
            xmlDocSource.AppendChild(newChild);
            this.CreateChildApplicationXmlElement(xmlDocSource, _application.ApplicationID, newChild, source, url);
            return(xmlDocSource.InnerXml);
        }
Пример #8
0
 public void AddTologer_application(loger_application loger_application)
 {
     base.AddObject("loger_application", loger_application);
 }