Ejemplo n.º 1
0
        private async Task ValidatorByAlias(EditContext editContext)
        {
            producerEntity.Alias = producerEntity.Alias.Trim();

            if (StringUtils.IsEqual(producerEntity.Alias, "."))
            {
                // producerEntity.Alias = ".";
                return;
            }

            if (StringUtils.IsEqual(producerEntity.Name, producerEntity.Alias))
            {
                messageStore.Add(editContext.Field("Alias"), "映射别名不能与名称相等");
                return;
            }

            if (StringUtils.IsNotEqual(producerEntity.Alias, "."))
            {
                BProducerEntity other = await this.producerService.FindByNameAsync(producerEntity.Alias);

                // 如果映射的数据不存在,或不合法,或不是主数据
                if (other == null || !other.Valid || StringUtils.IsNotEqual(other.Alias, "."))
                {
                    messageStore.Add(editContext.Field("Alias"), "映射别名未找到主数据、或匹配的主数据不合法");
                }
            }
        }
Ejemplo n.º 2
0
        protected override async Task OnInitializedAsync()
        {
            tagId = base.Options;

            producerEntity = await producerService.FindAsync(tagId);

            await base.OnInitializedAsync();
        }
Ejemplo n.º 3
0
        private async Task ValidatorByName(EditContext editContext)
        {
            BProducerEntity other = await this.producerService.FindByNameAsync(producerEntity.Name);

            if (other != null && StringUtils.IsNotEqual(producerEntity.Id, other.Id))
            {
                messageStore.Add(editContext.Field("Name"), "名字重复了");
            }
        }
Ejemplo n.º 4
0
        protected override async Task OnInitializedAsync()
        {
            producerId = base.Options ?? null;

            if (StringUtils.IsBlank(producerId))
            {
                producerEntity = new BProducerEntity();
            }
            else
            {
                producerEntity = await producerService.FindCloneAsync(producerId);
            }

            await base.OnInitializedAsync();
        }