public IActionResult ListActivityLog(DataSourceRequest command, string manufacturerId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
            {
                return(Content(""));
            }

            var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, command.Page - 1, command.PageSize);
            var gridModel   = new DataSourceResult
            {
                Data = activityLog.Select(x =>
                {
                    var customer = _customerService.GetCustomerById(x.CustomerId);
                    var m        = new ManufacturerModel.ActivityLogModel
                    {
                        Id = x.Id,
                        ActivityLogTypeName = _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId)?.Name,
                        Comment             = x.Comment,
                        CreatedOn           = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                        CustomerId          = x.CustomerId,
                        CustomerEmail       = customer != null ? customer.Email : "null"
                    };
                    return(m);
                }),
                Total = activityLog.TotalCount
            };

            return(Json(gridModel));
        }
示例#2
0
        public virtual (IEnumerable <ManufacturerModel.ActivityLogModel> activityLogModels, int totalCount) PrepareActivityLogModel(string manufacturerId, int pageIndex, int pageSize)
        {
            var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, pageIndex - 1, pageSize);

            return(activityLog.Select(x =>
            {
                var customer = _customerService.GetCustomerById(x.CustomerId);
                var m = new ManufacturerModel.ActivityLogModel
                {
                    Id = x.Id,
                    ActivityLogTypeName = _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId)?.Name,
                    Comment = x.Comment,
                    CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                    CustomerId = x.CustomerId,
                    CustomerEmail = customer != null ? customer.Email : "null"
                };
                return m;
            }), activityLog.TotalCount);
        }
示例#3
0
        public virtual async Task <(IEnumerable <ManufacturerModel.ActivityLogModel> activityLogModels, int totalCount)> PrepareActivityLogModel(string manufacturerId, int pageIndex, int pageSize)
        {
            var activityLog = await _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, pageIndex - 1, pageSize);

            var items = new List <ManufacturerModel.ActivityLogModel>();

            foreach (var x in activityLog)
            {
                var customer = await _customerService.GetCustomerById(x.CustomerId);

                var m = new ManufacturerModel.ActivityLogModel
                {
                    Id = x.Id,
                    ActivityLogTypeName = (await _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId))?.Name,
                    Comment             = x.Comment,
                    CreatedOn           = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                    CustomerId          = x.CustomerId,
                    CustomerEmail       = customer != null ? customer.Email : "null"
                };
                items.Add(m);
            }
            return(items, activityLog.TotalCount);
        }
        public ActionResult ListActivityLog(DataSourceRequest command, int manufacturerId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers))
                return Content("");

            var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = activityLog.Select(x =>
                {
                    var customer = _customerService.GetCustomerById(x.CustomerId);
                    var m = new ManufacturerModel.ActivityLogModel
                    {
                        Id = x.Id,
                        ActivityLogTypeName = x.ActivityLogType.Name,
                        Comment = x.Comment,
                        CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc),
                        CustomerId = x.CustomerId,
                        CustomerEmail = customer != null ? customer.Email : "null"
                    };
                    return m;

                }),
                Total = activityLog.TotalCount
            };

            return Json(gridModel);
        }