Beispiel #1
0
        protected async Task PlusRegionButtonHandler()
        {
            if (_serviceTypes == null)
            {
                _serviceTypes = await ServiceService.GetAsync(x =>
                                                              x.IsActive, x => x.OrderBy(y => y.ServiceTypeId), "ServiceType");
            }
            var region = new RegionReport();

            ReportVM.ProviderReport.Data.Add(region);

            foreach (var service in _serviceTypes)
            {
                region.Data.Add(new HeadAndValue
                {
                    ServiceTypeId   = service.ServiceTypeId,
                    ServiceTypeName = service.ServiceType.Name,
                    ServiceTypeDate = service.ServiceTypeDate,
                    OutOfContract   = true
                });
            }
            region.IsVisible     = true;
            region.OutOfContract = true;
            ReportVMEditContext  = new EditContext(ReportVM);
            await InvokeAsync(StateHasChanged);
        }
Beispiel #2
0
        protected async Task PlusRegionHandler(ChangeEventArgs args)
        {
            if (!string.IsNullOrEmpty((string)args.Value))
            {
                if (_serviceTypes == null)
                {
                    _serviceTypes = await ServiceService.GetAsync(x =>
                                                                  x.IsActive, x => x.OrderBy(y => y.ServiceTypeId), "ServiceType");
                }

                var regionId = Int32.Parse((string)args.Value);

                var region = ReportVM.ProviderReport.Data
                             .Where(x => x.RegionId == regionId)
                             .FirstOrDefault();

                if (region == null)
                {
                    region = new RegionReport
                    {
                        RegionId   = regionId,
                        RegionName = ReportVM.Regions
                                     .Where(x => x.ValueInt == regionId)
                                     .Select(x => x.Text)
                                     .FirstOrDefault(),
                        OutOfContract = true
                    };
                    ReportVM.ProviderReport.Data.Add(region);
                }

                var attachedServiceTypeIds = region?.Data.Select(x => x.ServiceTypeId).ToList();
                foreach (var service in _serviceTypes)
                {
                    if (attachedServiceTypeIds == null || !attachedServiceTypeIds.Contains(service.ServiceTypeId))
                    {
                        region.Data.Add(new HeadAndValue
                        {
                            ServiceTypeId   = service.ServiceTypeId,
                            ServiceTypeName = service.ServiceType.Name,
                            ServiceTypeDate = service.ServiceTypeDate,
                            OutOfContract   = true
                        });
                    }
                }
                region.IsVisible    = true;
                ReportVMEditContext = new EditContext(ReportVM);
            }

            await JSRuntime.InvokeVoidAsync("setZeroSelectElement", newregion);

            ReportVM.SelectedRegionId = 0;
            await InvokeAsync(StateHasChanged);
        }
Beispiel #3
0
 RenderFragment CreateDinamicFragment(RegionReport regionReport) => builder =>
 {
     builder.OpenComponent(0, typeof(ReportItemFragment));
     builder.AddAttribute(3, "RegionReport", regionReport);
     builder.CloseComponent();
 };