コード例 #1
0
        public ActionResult ListLogs()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog))
                return AccessDeniedView();

            var activityLogSearchModel = new ActivityLogSearchModel();
            activityLogSearchModel.ActivityLogType.Add(new SelectListItem()
            {
                Value = "0",
                Text = "All"
            });

            foreach (var at in _customerActivityService.GetAllActivityTypes()
                .OrderBy(x=>x.Name)
                .Select(x =>
                {
                    return new SelectListItem()
                    {
                        Value = x.Id.ToString(),
                        Text = x.Name
                    };
                }))
                activityLogSearchModel.ActivityLogType.Add(at);
            return View(activityLogSearchModel);
        }
コード例 #2
0
        public ActionResult ListLogs()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog))
                return AccessDeniedView();

            var activityLogSearchModel = new ActivityLogSearchModel();
            activityLogSearchModel.ActivityLogType.Add(new SelectListItem
            {
                Value = "0",
                Text = "All"
            });


            foreach (var at in _customerActivityService.GetAllActivityTypes())
            {
                activityLogSearchModel.ActivityLogType.Add(new SelectListItem
                {
                    Value = at.ID.ToString(),
                    Text = at.Name
                });
            }
            return View(activityLogSearchModel);
        }
コード例 #3
0
        public ActionResult ListLogs(GridCommand command, ActivityLogSearchModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog))
                return AccessDeniedView();

            DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.CurrentTimeZone);

            DateTime? endDateValue = (model.CreatedOnTo == null) ? null
                            : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1);

            var activityLog = _customerActivityService.GetAllActivities(startDateValue, endDateValue,null, model.ActivityLogTypeId, command.Page - 1, command.PageSize);
            var gridModel = new GridModel<ActivityLogModel>
            {
                Data = activityLog.Select(x =>
                {
                    var m = x.ToModel();
                    m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    return m;

                }),
                Total = activityLog.TotalCount
            };
            return new JsonResult { Data = gridModel};
        }
コード例 #4
0
        public JsonResult ListLogs(GridCommand command, ActivityLogSearchModel model)
        {
            DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.CurrentTimeZone);

            DateTime? endDateValue = (model.CreatedOnTo == null) ? null
                            : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1);

            var activityLogModel = _customerActivityService.GetAllActivities(startDateValue, endDateValue, model.CustomerEmail, null, model.ActivityLogTypeId, command.Page - 1, command.PageSize);
            var gridModel = new GridModel<ActivityLogModel>
            {
                Data = activityLogModel.Select(x =>
                {
                    var m = x.ToModel();
                    m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    return m;

                }),
                Total = activityLogModel.TotalCount
            };
            return new JsonResult { Data = gridModel};;
        }
コード例 #5
0
        public ActionResult ListStats(DataSourceRequest command, ActivityLogSearchModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog))
                return AccessDeniedView();

            DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.CurrentTimeZone);

            DateTime? endDateValue = (model.CreatedOnTo == null) ? null
                            : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1);

            var activityLog = _customerActivityService.GetStatsActivities(startDateValue, endDateValue, model.ActivityLogTypeId, command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = activityLog.Select(x =>
                {
                    var activityLogType = _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId);
                    string _name = "-empty-";
                    if(activityLogType!=null)
                    {
                        IList<string> systemKeywordsCategory = new List<string>();
                        systemKeywordsCategory.Add("PublicStore.ViewCategory");
                        systemKeywordsCategory.Add("EditCategory");
                        systemKeywordsCategory.Add("AddNewCategory");

                        if (systemKeywordsCategory.Contains(activityLogType.SystemKeyword))
                        {
                            var category = _categoryService.GetCategoryById(x.EntityKeyId);
                            if (category != null)
                                _name = category.Name;
                        }

                        IList<string> systemKeywordsManufacturer = new List<string>();
                        systemKeywordsManufacturer.Add("PublicStore.ViewManufacturer");
                        systemKeywordsManufacturer.Add("EditManufacturer");
                        systemKeywordsManufacturer.Add("AddNewManufacturer");

                        if (systemKeywordsManufacturer.Contains(activityLogType.SystemKeyword))
                        {
                            var manufacturer = _manufacturerService.GetManufacturerById(x.EntityKeyId);
                            if (manufacturer != null)
                                _name = manufacturer.Name;
                        }

                        IList<string> systemKeywordsProduct = new List<string>();
                        systemKeywordsProduct.Add("PublicStore.ViewProduct");
                        systemKeywordsProduct.Add("EditProduct");
                        systemKeywordsProduct.Add("AddNewProduct");

                        if (systemKeywordsProduct.Contains(activityLogType.SystemKeyword))
                        {
                            var product = _productService.GetProductById(x.EntityKeyId);
                            if (product != null)
                                _name = product.Name;
                        }

                    }

                    var m = x.ToModel();
                    m.ActivityLogTypeName = activityLogType!=null ? activityLogType.Name : "-empty-";
                    m.Name = _name;
                    return m;

                }),
                Total = activityLog.TotalCount
            };
            return Json(gridModel);
        }