/// <summary>
        /// 活动表操作历史进行记录
        /// </summary>
        /// <param name="activeID"></param>
        /// <param name="Operation"></param>
        /// <param name="Author"></param>
        /// <param name="HostName"></param>
        /// <param name="IPAddress"></param>
        /// <returns></returns>
        public static int InsertHistoryActions(int activeID, string ObjectType, string AfterValue, string Operation, string Author, string HostName, string IPAddress)
        {
            OprLogManager log = new OprLogManager();

            OprLogModel model = new OprLogModel();

            model.ObjectId   = activeID;
            model.ObjectType = ObjectType;
            model.AfterValue = AfterValue;
            model.Operation  = Operation;
            //model.Author = Author;
            model.Author    = ThreadIdentity.Operator.Name;
            model.HostName  = HostName;
            model.IpAddress = IPAddress;

            int flag = 0;

            using (var client = new OprLogClient())
            {
                var result = client.AddOprLog(model);
                if (result.Result > 0)
                {
                    flag = 1;
                }
            }
            return(flag);
        }
Exemple #2
0
 public static void AddOprLog(string pid, bool isDelete)
 {
     using (var client = new OprLogClient())
     {
         var result = client.AddOprLog(new Service.OprLog.Models.OprLogModel()
         {
             Author         = "Job定时更新",
             ChangeDatetime = DateTime.Now,
             AfterValue     = pid,
             ObjectType     = "StockWhite",
             Operation      = isDelete ? "移除白名单(系统)" : "加入白名单(系统)"
         });
         result.ThrowIfException(true);
     }
 }
        public void Add(OprLog oprLog)
        {
            ParameterChecker.CheckNull(oprLog, "oprLog");

            if (string.IsNullOrEmpty(oprLog.Author))
            {
                oprLog.Author = ThreadIdentity.Operator.Name;
            }
            if (string.IsNullOrEmpty(oprLog.IPAddress))
            {
                oprLog.IPAddress = ThreadIdentity.Operator.IPAddress;
            }

            OprLogModel opl = new OprLogModel();

            opl.ObjectId       = oprLog.ObjectID;
            opl.ObjectType     = oprLog.ObjectType;
            opl.Operation      = oprLog.Operation;
            opl.Author         = oprLog.Author;
            opl.BeforeValue    = oprLog.BeforeValue;
            opl.AfterValue     = oprLog.AfterValue;
            opl.HostName       = oprLog.HostName;
            opl.IpAddress      = oprLog.IPAddress;
            opl.ChangeDatetime = DateTime.Now;

            try
            {
                using (var client = new OprLogClient())
                {
                    var result2 = client.AddOprLog(opl);

                    bool EnablePower = false;
                    if (bool.TryParse(WebConfigurationManager.AppSettings["EnablePower"], out EnablePower) && EnablePower)
                    {
                        result2.ThrowIfException(true);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(Level.Error, ex, "AddOprLog");
                throw ex;
            }
        }
Exemple #4
0
        public static bool InsertOplog(ConfigHistory model)
        {
            //AutoMapper初始化配置文件
            var config = new MapperConfiguration(cfg => cfg.CreateMap <ConfigHistory, OprLogModel>());
            var mapper = config.CreateMapper();
            //集合类型转换
            var  oprLogModel = mapper.Map <OprLogModel>(model);
            bool flag        = false;

            using (var client = new OprLogClient())
            {
                var result = client.AddOprLog(oprLogModel);
                if (result.Result > 0)
                {
                    flag = true;
                }
            }
            return(flag);
        }