Exemplo n.º 1
0
        protected async Task AddSubscription()
        {
            var parameters = new ModalParameters();

            parameters.Add("ADUser", _user);

            var modal = ModalService.Show <AddSubscription>("Nieuw abonnement", parameters);
            var res   = await modal.Result;

            if (!res.Cancelled)
            {
                _user.AddSubscription((MobileSubscription)res.Data);
            }
        }
Exemplo n.º 2
0
        public async Task ShowAddStaircaseModal(Guid BuildingId)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(AddStaircaseModal.BuildingId), BuildingId);

            var StaircaseModal = Modal.Show <AddStaircaseModal>("Add A New Staircase", parameters);
            var result         = await StaircaseModal.Result;

            if (!result.Cancelled)
            {
                await Refresh();
            }
        }
Exemplo n.º 3
0
        public async Task Delete(string id)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(DetailChild.ChildId), id);

            var modalForm = Modal.Show <DeleteChild>("Remove this Child", parameters);
            var result    = await modalForm.Result;

            if (!result.Cancelled)
            {
                OnInitialized();
            }
        }
Exemplo n.º 4
0
        private async Task AddHardware()
        {
            var parameters = new ModalParameters();

            parameters.Add("ContractId", Id);

            var modalForm = Modal.Show <AddHardwareModal>("Новое оборудование", parameters);
            var result    = await modalForm.Result;

            if (!result.Cancelled)
            {
                Contract = await HttpClient.GetFromJsonAsync <ContractDetailVm>($"api/contract/{Id}");
            }
        }
        public async Task <bool> Confirm(string title, string message)
        {
            var parameters = new ModalParameters();

            parameters.Add("Message", message);
            var options = new ModalOptions
            {
                HideCloseButton = true
            };
            var modal  = modalService.Show <YesNoModal>(title, parameters, options);
            var result = await modal.Result;

            return(result.DataType == typeof(int) && (int)result.Data == (int)ConfirmDisplayerResult.Yes);
        }
Exemplo n.º 6
0
        public async Task ShowEditInstallerModal()
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(EditInstallerModal.EditInstaller), Installer);

            var ShowEditInstallerModal = Modal.Show <EditInstallerModal>("Edit", parameters);
            var result = await ShowEditInstallerModal.Result;

            if (!result.Cancelled)
            {
                await Refresh();
            }
        }
Exemplo n.º 7
0
        public async Task ShowInstallerAsync(Guid InstallerId)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(OneInstallerModal.InstallerId), InstallerId);

            var InstallerListModal = Modal.Show <OneInstallerModal>("Installer", parameters);
            var result             = await InstallerListModal.Result;

            if (!result.Cancelled)
            {
                await Refresh();
            }
        }
Exemplo n.º 8
0
        protected async Task DeleteConfirm()
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(Table), Table);

            var resultModal = ModalService.Show <TableDeletionConfirm>("Confirm", parameters);
            var result      = await resultModal.Result;

            if (!result.Cancelled)
            {
                await OnChange.InvokeAsync("List was changed");
            }
        }
Exemplo n.º 9
0
        public async Task Edit(string id)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(DetailParent.ParentId), id);

            var modalForm = Modal.Show <EditParent>("Edit this Parent", parameters);
            var result    = await modalForm.Result;

            if (!result.Cancelled)
            {
                OnInitialized();
            }
        }
Exemplo n.º 10
0
        public void ModalDisplaysCorrectContentWhenUsingModalParameters()
        {
            var testTitle  = "Testing Components";
            var parameters = new ModalParameters();

            parameters.Add("Title", testTitle);

            var component = _host.AddComponent <BlazoredModal>();

            _modalService.Show <TestComponent>("", parameters);

            var content = component.Find("h1");

            Assert.Equal(content.InnerText, testTitle);
        }
        public async Task ShowMessageAsync(string Title, string Message, int Duration = 0)
        {
            ModalParameters modalParameters = new ModalParameters();

            modalParameters.Add("Message", Message);

            var modalRef = modalService.Show <ShowMessagePopupComponent>(Title);

            if (Duration > 0)
            {
                await Task.Delay(Duration);

                modalRef.Close();
            }
        }
Exemplo n.º 12
0
        public async Task EditTaskItem()
        {
            var modalParameters = new ModalParameters();

            modalParameters.Add("TaskItem", TaskItem);

            var modal = Modal.Show <AddTaskItem>("Edit task", modalParameters);

            var result = await modal.Result;

            if (!result.Cancelled)
            {
                await RefreshTaskList.InvokeAsync();
            }
        }
Exemplo n.º 13
0
        public async Task ShowMessageAsync(string title, string message, int duration = 0)
        {
            ModalParameters mParams = new ModalParameters();

            mParams.Add("Message", message);
            var modalRef = _modalService.Show <ShowMessagePupupComponent>(title, mParams);

            if (duration > 0)
            {
                await Task.Delay(duration);

                modalRef.Close();
            }
            //await modalRef.Result;
        }
Exemplo n.º 14
0
        private void OpenAddSeriesDialog()
        {
            var parameters = new ModalParameters();

            parameters.Add("FormId", 1);

            var options = new ModalOptions
            {
                ButtonOptions = { ConfirmButtonType = ConfirmButton.Save, ShowConfirmButton = true }
            };

            this.Modal.OnClose += this.AddSeriesDialogClosed;

            this.Modal.Show <SeriesDialog>("Create Series", parameters, options);
        }
Exemplo n.º 15
0
        protected void OpenAddTaskModal()
        {
            var parameters = new ModalParameters();

            parameters.Add("FormId", 1);

            var options = new ModalOptions
            {
                ButtonOptions = { ConfirmButtonType = ConfirmButton.Save, ShowConfirmButton = true }
            };

            this.Modal.OnClose += this.TaskModalClosed;

            this.Modal.Show <TaskDialog>("Create Task", parameters, options);
        }
Exemplo n.º 16
0
        private void OpenEditReadBooksDialog()
        {
            var parameters = new ModalParameters();

            parameters.Add("FormId", 1);

            var options = new ModalOptions
            {
                ButtonOptions = { ConfirmButtonType = ConfirmButton.Save, ShowConfirmButton = true }
            };

            this.Modal.OnClose += this.EditReadBooksModalClosed;

            this.Modal.Show <BookReadSelectorDialog>("Edit Read Books", parameters, options);
        }
        private async void ShowAddProductQuantityModal()
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(NewEditProductQuantityComponent.Product), Product);

            var adddQuantityModal = Modal.Show <NewEditProductQuantityComponent>("Add product quantity", parameters);

            var result = await adddQuantityModal.Result;

            if (!result.Cancelled)
            {
                Refresh();
                StateHasChanged();
            }
        }
Exemplo n.º 18
0
        private async Task EditContract(int id)
        {
            var contract = await HttpClient.GetFromJsonAsync <ContractDetailVm>($"api/contract/{id}");

            var parameters = new ModalParameters();

            parameters.Add("Contract", contract);

            var modalWindow = Modal.Show <UpdateContractModal>("Редактирование договора", parameters);

            var result = await modalWindow.Result;

            if (!result.Cancelled)
            {
                ContractsList = await HttpClient.GetFromJsonAsync <ContractsListVm>("api/contract");
            }
        }
Exemplo n.º 19
0
        private async Task EditSoftware(int id)
        {
            var software = await HttpClient.GetFromJsonAsync <SoftwareDto>($"api/software/{id}");

            var parameters = new ModalParameters();

            parameters.Add("Software", software);

            var modalWindow = Modal.Show <UpdateSoftwareModal>("Редактирование ПО", parameters);

            var result = await modalWindow.Result;

            if (!result.Cancelled)
            {
                Contract = await HttpClient.GetFromJsonAsync <ContractDetailVm>($"api/contract/{Id}");
            }
        }
Exemplo n.º 20
0
        public async Task <PropertyAssignData> AddPropertyProviderAttribute(IEnumerable <int> availableAttributes)
        {
            var parameters = new ModalParameters();

            parameters.Add("Attributes", availableAttributes);
            var modal  = instance.Show <AddModelAttribute>("Add attribute", parameters);
            var result = await modal.Result;

            if (result.Data is PropertyAssignData data)
            {
                return(data);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 21
0
        public async Task AddTaskItem()
        {
            var modalParameters = new ModalParameters();

            modalParameters.Add("TaskListId", TaskList.TaskList.Id);

            var modal = Modal.Show <AddTaskItem>("Add new task", modalParameters);

            var result = await modal.Result;

            if (!result.Cancelled)
            {
                await GetTaskItems();

                TaskList.IsExpanded = true;
            }
        }
Exemplo n.º 22
0
        public async Task <string> Show()
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(DisplayMessage.Message), Text);
            var DisplayMessageModal = Modal.Show <DisplayMessage>(Caption, parameters);
            var result = await DisplayMessageModal.Result;

            if (result.Cancelled)
            {
                return("");
            }
            else
            {
                return("OK");
            }
        }
Exemplo n.º 23
0
        public async Task <PropertyAssignData> AddPropertyProviderRelation(IEnumerable <int> availableRelations)
        {
            var parameters = new ModalParameters();

            parameters.Add("Relations", availableRelations);
            var modal  = instance.Show <AddModelRelation>("Add relation", parameters);
            var result = await modal.Result;

            if (result.Data is PropertyAssignData data)
            {
                return(data);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 24
0
        public async Task Edit(int id)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(AgencyEdit.AgencyId), id);
            var editModal = Modal.Show <AgencyEdit>("Agence détail", parameters, new ModalOptions
            {
                Animation = ModalAnimation.FadeIn(1)
            });

            var result = await editModal.Result;

            if (!result.Cancelled)
            {
                await RefreshList();
            }
        }
Exemplo n.º 25
0
        private async Task OnEditCategory(CategoryDto category)
        {
            var categoryParam = new ModalParameters();

            categoryParam.Add(nameof(CategoryForm.Category), category);

            var categoryForm = ModalService.Show <CategoryForm>("ویرایش دسته", categoryParam);

            var result = await categoryForm.Result;

            if (!result.Cancelled)
            {
                ToastService.ShowSuccess("ویرایش دسته با موفقیت انجام شد");

                await LoadTableData();
            }
        }
Exemplo n.º 26
0
        public async Task ShowAddPurchaseItemModal(Guid id)
        {
            var parameters = new ModalParameters();

            parameters.Add(nameof(AddEditPurchaseItem.PurchaseId), id);

            var formModal = Modal.Show <AddEditPurchaseItem>("Add New Item", parameters);
            var result    = await formModal.Result;

            if (result.Cancelled)
            {
            }
            else
            {
                await Refresh();
            }
        }
Exemplo n.º 27
0
        public async Task <EventAssignData> AddPropertyProviderEvent(IEnumerable <int> unavailableProperties)
        {
            var parameters = new ModalParameters();

            parameters.Add("Values", unavailableProperties);
            var modal  = instance.Show <AddModelEvent>("Add event", parameters);
            var result = await modal.Result;

            if (result.Data is EventAssignData data)
            {
                return(data);
            }
            else
            {
                return(null);
            }
        }
        //protected override async Task OnInitializedAsync()
        //{
        //    await loadData();
        //}

        public async Task Edit(TimeBooking bTime)
        {
            var param = new ModalParameters();

            param.Add(nameof(BookTime.Booking2Change), bTime);
            var ret    = Modal.Show <BookTime>("Zeit ändern", param);
            var result = await ret.Result;

            if (!result.Cancelled)
            {
                var changed = (TimeBooking)result.Data;
                //Context.Update(changed);
                //await Context.SaveChangesAsync();
                await BookingsService.UpdateBookingAsync(changed);

                await AppState.RegisteredAsync(changed);
            }
        }
Exemplo n.º 29
0
        public void ModalDisplaysCorrectContentWhenUsingModalParameters()
        {
            var testTitle = "Testing Components";

            // Arrange
            var modalService = Services.GetService <IModalService>();

            var parameters = new ModalParameters();

            parameters.Add("Title", testTitle);
            var cut = RenderComponent <BlazoredModal>();

            // Act
            modalService.Show <TestComponent>("", parameters);

            // Assert
            Assert.Equal(testTitle, cut.Find(".test-component h1").InnerHtml);
        }
Exemplo n.º 30
0
        public async Task <string> AddAttributeValue(int attributeID)
        {
            var parameters = new ModalParameters();

            parameters.Add("ID", attributeID);

            var modal  = instance.Show <AddAttributeValue>("Add attribute value", parameters);
            var result = await modal.Result;

            if (!result.Cancelled && result.Data is string strResult)
            {
                return(strResult);
            }
            else
            {
                return(null);
            }
        }