public void GetOperationLogList() { using (var client = new SalePromotionActivityLogClient()) { var result = client.GetOperationLogList("6DC14F47", 1, 20).Result; Assert.IsNotNull(result); } }
public void InsertLogDescription() { var model = new SalePromotionActivityLogDescription() { OperationLogType = "UnitTest", OperationLogDescription = "单元测试描述", Remark = "这是单元测试", CreateDateTime = DateTime.Now.ToString(), CreateUserName = "******", }; using (var client = new SalePromotionActivityLogClient()) { var result = client.InsertActivityLogDescriptionAsync(model).Result.Result; Assert.IsTrue(result); } }
/// <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}"); } }
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); } }
/// <summary> /// 获取日志详情 /// </summary> /// <param name="FPKID"></param> /// <returns></returns> public ActionResult GetOperationLogDetailList(string PKID) { var result = new List <SalePromotionActivityLogDetail>(); using (var client = new SalePromotionActivityLogClient()) { var listResult = client.GetOperationLogDetailList(PKID); if (listResult.Success && listResult.Result != null) { result = listResult.Result.ToList(); } if (result?.Count() > 0) { foreach (var item in result) { item.OldValue = item.OldValue == null ? "" : item.OldValue; item.NewValue = item.NewValue == null ? "" : item.NewValue; } } } return(Json(result)); }
/// <summary> /// 获取活动的操作日志列表 /// </summary> /// <param name="activityId"></param> /// <returns></returns> public ActionResult GetOperationLogList(string activityid, int pageIndex = 1, int pageSize = 10) { if (string.IsNullOrEmpty(activityid)) { activityid = Request.QueryString["activityid"]; } ViewBag.activityid = activityid; var result = new PagedModel <SalePromotionActivityLogModel>(); using (var client = new SalePromotionActivityLogClient()) { var listResult = client.GetOperationLogList(activityid, pageIndex, pageSize); if (listResult.Success && listResult.Result != null) { result = listResult.Result; } } ViewBag.pageSize = pageSize; ViewBag.pageIndex = pageIndex; ViewBag.totalRecords = result.Pager.Total; ViewBag.totalPage = result.Pager.Total % pageSize == 0 ? result.Pager.Total / pageSize : (result.Pager.Total / pageSize) + 1; return(View("OperationLogList", result.Source)); }
/// <summary> /// 获取活动的操作日志列表 /// </summary> /// <param name="activityId"></param> /// <returns></returns> public ActionResult ShareBargainLogList(BargainProductRequest request) { if (string.IsNullOrEmpty(request.PID)) { request.PID = Request.QueryString["PKID"]; } ViewBag.request = request; var result = new PagedModel <SalePromotionActivityLogModel>(); using (var client = new SalePromotionActivityLogClient()) { var listResult = client.GetOperationLogList(request.PID, request.PageIndex, request.PageSize); if (listResult.Success && listResult.Result != null) { result = listResult.Result; } } ViewBag.pageSize = request.PageSize; ViewBag.pageIndex = request.PageIndex; ViewBag.totalRecords = result.Pager.Total; ViewBag.totalPage = result.Pager.Total % request.PageSize == 0 ? result.Pager.Total / request.PageSize : (result.Pager.Total / request.PageSize) + 1; return(View(result.Source)); }