Example #1
0
        public async Task SaveUserDataRule(Guid userId, [FromForm] List <SaveUserDataRuleViewModel> models)
        {
            if (models == null || models.Count == 0)
            {
                _logger.LogDebug("没有接到任何要保存的数据,默认为清除所有的数据规则授权");
            }
            else
            {
                _logger.LogDebug($"接到要保存的数据条数为:{models.Count}");
                _logger.LogDebug($"接到要保存的数据内容:{JsonSerializer.Serialize(models)}");
            }
            //
            // models.Clear();
            // userId = Guid.Parse("08d972d1-0e5f-424b-88be-d9768f229058");
            // models.Add(new SaveUserDataRuleViewModel()
            // {
            //     EntityDesc = "机构管理",
            //     EntityTypeName= "ZhuoFan.Wb.OrganizationService.Domain.Models.OrganizationEntity",
            //     UserType= UserType.GeneralUser,
            //     FieldName = "OrganizationId",
            //     FieldDesc = "机构",
            //     FieldType = "System.Guid",
            //     FieldValue = "08d97724-07fa-42f6-8a63-fe4dba762a92",
            //     FieldValueText = "string",
            //     ExpressionType = ExpressionType.Equal
            // });

            var userRules = models.Select(dataRuleFieldModel => new UserRule()
            {
                EntityTypeName = dataRuleFieldModel.EntityTypeName,
                EntityDesc     = dataRuleFieldModel.EntityDesc,
                FieldName      = dataRuleFieldModel.FieldName,
                FieldDesc      = dataRuleFieldModel.FieldDesc,
                FieldType      = dataRuleFieldModel.FieldType,
                FieldValue     = dataRuleFieldModel.FieldValue,
                FieldValueText = dataRuleFieldModel.FieldValueText,
                ExpressionType = dataRuleFieldModel.ExpressionType
            })
                            .ToList();

            var command = new UpdateUserRuleCommand(userId, userRules);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = _notifications.GetNotificationMessage();
                throw new GirvsException(StatusCodes.Status400BadRequest, errorMessage);
            }
        }
Example #2
0
        public IActionResult Microsoft()
        {
            _microsoftLogger.LogTrace("Microsoft Trace");
            _microsoftLogger.LogDebug("Microsoft Debug");
            _microsoftLogger.LogInformation("Microsoft Information");
            _microsoftLogger.LogWarning("Microsoft Warning");
            _microsoftLogger.LogError("Microsoft Error");
            _microsoftLogger.LogCritical("Microsoft Critical");

            return(Ok());
        }