Beispiel #1
0
 /// <summary>
 /// 记录操作日志
 /// </summary>
 /// <param name="operationLogModel"></param>
 /// <param name="funNameString"></param>
 private void SetOperationLog(SalePromotionActivityLogModel operationLogModel, string funNameString)
 {
     try
     {
         using (var logClient = new SalePromotionActivityLogClient())
         {
             var logResult = logClient.InsertAcitivityLogAndDetail(operationLogModel);
             if (!(logResult.Success && logResult.Result))
             {
                 Logger.Log(Level.Warning, $"{funNameString}操作日志记录失败ErrorMessage:{logResult.ErrorMessage}");
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Log(Level.Error, $"{funNameString},操作日志记录异常,ex{ex}");
     }
 }
Beispiel #2
0
        public void InsertLogAndDetail()
        {
            var operationLogModel = new SalePromotionActivityLogModel()
            {
                ReferId          = "日志来源id(活动id)",
                ReferType        = "日志来源类型(打折活动)",
                OperationLogType = "操作类型(新增活动)",
                CreateDateTime   = DateTime.Now.ToString(),
                CreateUserName   = "******",
                //日志详情
                LogDetailList = new List <SalePromotionActivityLogDetail>()
                {
                    new SalePromotionActivityLogDetail()
                    {
                        OperationLogType = "新增商品",
                        Property         = "pid",
                        NewValue         = "商品的关键信息",
                    },
                    new SalePromotionActivityLogDetail()
                    {
                        OperationLogType = "修改活动",
                        Property         = "活动描述",
                        OldValue         = "旧的活动描述",
                        NewValue         = "新的活动描述",
                    },
                    new SalePromotionActivityLogDetail()
                    {
                        OperationLogType = "删除商品",
                        Property         = "pid",
                        OldValue         = "商品的关键信息",
                    },
                }
            };

            using (var client = new SalePromotionActivityLogClient())
            {
                var result = client.InsertAcitivityLogAndDetail(operationLogModel).Result;
                Assert.IsTrue(result);
            }
        }