public void SubmitForm()
        {
            var newDate = new DateTime(Booking2Change.BookingTime.Year, Booking2Change.BookingTime.Month, Booking2Change.BookingTime.Day, Time.Hour, Time.Minute, 0);

            Booking2Change.BookingTime = newDate;
            BlazoredModal?.Close(ModalResult.Ok(Booking2Change));
        }
Esempio n. 2
0
 public async void Save()
 {
     Product.UnitQuantity     = NewProductQuantity.UnitQuantityTypeVolume;
     Product.UnitQuantityType = NewProductQuantity.MeasurementType;
     //await ProductService.AddProduct(Product);
     await BlazoredModal.CloseAsync(ModalResult.Ok(Product));
 }
Esempio n. 3
0
        public async Task FormSubmitted()
        {
            var model = Converter.Convert(View);
            await Repository.Insert(model);

            await BlazoredModal.CloseAsync(ModalResult.Ok <TModel>(model));
        }
Esempio n. 4
0
        public async Task CreateNewEmployee()
        {
            var authState = await authenticationStateTask;
            int UserId    = 0;

            if (authState.User.Identity.IsAuthenticated)
            {
                var User = await UserManager.GetUserAsync(authState.User);

                UserId = User.Id;
            }

            var user = new Employee
            {
                FirstName    = Input.FirstName,
                LastName     = Input.LastName,
                Email        = Input.Email,
                PhoneNumber  = Input.PhoneNumber,
                Location     = Input.Location,
                FranchiseeId = UserId,
                StoreId      = Input.StoreId
            };
            IdentityResult result = await UserManager.CreateAsync(user, Input.Password);

            if (result.Succeeded)
            {
                Logger.LogInformation("Franchisee created a new account with password.");

                await EmailManager.SendConfirmationEmailAsync(user);
            }

            await BlazoredModal.Close(ModalResult.Ok(true));
        }
        public void Save()
        {
            var inscriptionController = new BaseController <Inscription>();

            if (Inscription.ChildId == null)
            {
                StateHasChanged();
            }
            else
            {
                Inscription.DayChoose = Inscription.DayChoose.Date.ToUniversalTime();
                if (Edit)
                {
                    inscriptionController.ReplaceOne(Inscription);
                    inscriptionController.UpdateLinkedLists(Inscription);
                }
                else
                {
                    inscriptionController.Insert(Inscription);
                    inscriptionController.UpdateLinkedLists(Inscription);
                }

                BlazoredModal.Close();
            }
        }
Esempio n. 6
0
        protected async Task FormSubmitted()
        {
            var model = Converter.Convert(View);
            await repository.Update(Id, model);

            await BlazoredModal.CloseAsync(ModalResult.Ok <TModel>(model));
        }
Esempio n. 7
0
        public async Task AddToDo()
        {
            if (CallbackAddToDo.HasDelegate)
            {
                await CallbackAddToDo.InvokeAsync(toDo);
            }

            await BlazoredModal.Close();
        }
Esempio n. 8
0
 protected void Submit()
 {
     if (_editContext.Validate())
     {
         UserRepository.Save(MobileSubscription);
         ToastService.ShowSuccess("Abonnement toegevoegd.");
         BlazoredModal.Close(ModalResult.Ok <MobileSubscription>(MobileSubscription));
     }
 }
Esempio n. 9
0
        private async void Finish()
        {
            await JSRuntime.InvokeVoidAsync("stopScanner");

            await BlazoredModal.CloseAsync(ModalResult.Ok(new BarcodeResult
            {
                Barcode = BarcodeValue
            }));
        }
Esempio n. 10
0
        protected async Task Submit()
        {
            var options = new JsonSerializerOptions {
                Converters = { new HardwareConverter() }
            };

            await HttpClient.PutAsJsonAsync("api/hardware", Command, options);

            await BlazoredModal.CloseAsync(ModalResult.Ok(Hardware.Id));
        }
Esempio n. 11
0
        private async Task HandleSubmit()
        {
            var result = await(AuthenticationService as IAuthenticationService).SignIn(LoginModel);

            IsAuthenticateError = !result;
            LoginModel          = new LoginModel();
            if (result)
            {
                await BlazoredModal.Close();
            }
        }
        private Task SubmitVoteAsync(string vote)
        {
            if (string.IsNullOrWhiteSpace(vote))
            {
                return(Task.CompletedTask);
            }

            BlazoredModal.Close(ModalResult.Ok(vote, typeof(string)));

            return(Task.CompletedTask);
        }
Esempio n. 13
0
        protected async Task SaveOriginAsync()
        {
            var isNewOrigin = Origin.OriginId == 0;

            if (isNewOrigin)
            {
                Origin.DateCreated = DateTime.UtcNow;
            }
            else
            {
                Origin.DateModified = DateTime.UtcNow;
            }

            if (!string.IsNullOrEmpty(OriginUri))
            {
                Origin.Uri = new Uri(OriginUri);
            }

            Origin.ParentOrigin = SelectedParentOrigin;
            Origin.CreatedBy ??= UserId;
            Origin.ModifiedBy = UserId;

            if (Origin.Location != null)
            {
                if (Origin.Location.IsNotEmpty())
                {
                    if (Origin.Location.LocationId == 0)
                    {
                        Origin.Location.DateCreated = DateTime.UtcNow;
                    }
                    else
                    {
                        Origin.Location.DateModified = DateTime.UtcNow;
                    }
                }
                else
                {
                    Origin.Location = null;
                }
            }

            Origin = await ApiClient.PutOriginAsync(Origin);

            if (BlazoredModal != null)
            {
                await BlazoredModal.Close(ModalResult.Ok(Origin));
            }
            else
            {
                await CancelAsync(isNewOrigin);
            }
        }
Esempio n. 14
0
        protected async Task LogIn()
        {
            var result = await AccountService.Login(User);

            if (result.Successful)
            {
                BlazoredModal.Close(ModalResult.Ok(true));
            }
            else
            {
                ErrorMessage = result.Error;
            }
        }
Esempio n. 15
0
        private void ReturnLines(string text)
        {
            var lines = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
            var dto   = new DTOs.ProxiesForImportDto
            {
                Lines           = lines,
                DefaultType     = defaultType,
                DefaultUsername = defaultUsername,
                DefaultPassword = defaultPassword
            };

            BlazoredModal.Close(ModalResult.Ok(dto));
        }
Esempio n. 16
0
        protected async Task SalvarLancamento()
        {
            var titulo   = isEditing ? "Alteração de Lançamento" : "Inclusão de Lançamento";
            var mensagem = isEditing ? "Lançamento alterado com sucesso!!!" : "Lançamento incluído com sucesso!!!";

            await AddOrUpdateLancamento();

            //await MessageBox(titulo, mensagem, "success", "Ok", string.Empty, false);
            ShowToast(titulo, mensagem, MatToastType.Success);
            await BlazoredModal.Close();

            await GoToIndex(true);
        }
Esempio n. 17
0
        protected async Task SalvarEdicao()
        {
            var titulo = isEditing ? "Atualização de  Afiliado" : "Inclusão de Afiliado";

            await AddOrUpdateAfiliado(esteAfiliado);
            await MessageBox(titulo, "Registro Gravado com Sucesso!!!", "success", "Ok", string.Empty, false);

            await BlazoredModal.Close();

            SetNew();
            StateHasChanged();
            OpenPage("/afiliadoindex", true);
        }
 public async void HandleValidSubmit()
 {
     if (Agency.Id == 0 && await _agencyService.AddAgency(Agency))
     {
         _toastService.ShowSuccess("Agence ajoutée avec succès");
         await BlazoredModal.Close(ModalResult.Ok(Agency));
     }
     else if (Agency.Id > 0 && await _agencyService.UpdateAgency(Agency))
     {
         _toastService.ShowSuccess("Agence enregistrée avec succès");
         await BlazoredModal.Close(ModalResult.Ok(Agency));
     }
 }
Esempio n. 19
0
 protected void Submit()
 {
     if (_item != null)
     {
         ParentItem.AddItem(_item);
         Repository.Save(ParentItem);
         BlazoredModal.Close(ModalResult.Ok <Item>(_item));
         ToastService.ShowSuccess("Item inbegrepen");
     }
     else
     {
         ToastService.ShowWarning("Selecteer een item.");
     }
 }
        protected async Task HandleValidSubmit()
        {
            var response = await AirportDataService.AddAirport(Airport);

            if (response != null)
            {
                await BlazoredModal.Close();

                ToastService.ShowSuccess($"New Airport {response.ICAO} was created");
            }

            //await CloseEventCallback.InvokeAsync(true);
            StateHasChanged();
        }
Esempio n. 21
0
        protected async Task CreateAccount()
        {
            ShowErrors = false;
            var result = await AccountService.Register(User);

            if (result.Successful)
            {
                BlazoredModal.Close();
            }
            else
            {
                Errors     = result.Errors;
                ShowErrors = true;
            }
        }
Esempio n. 22
0
        protected async Task CreateTable()
        {
            ShowErrors = false;
            var result = await TableService.Create(PokerTable);

            if (result.Successful)
            {
                BlazoredModal.Close();
            }
            else
            {
                Errors     = result.Errors;
                ShowErrors = true;
            }
        }
Esempio n. 23
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                _accounts = await UserRepository.GetAllMobileAccounts();

                if (Account != null)
                {
                    _selectedAccount = Account.Id;
                    CheckHasSubs();
                }
            }
            catch (Exception ex)
            {
                BlazoredModal.Close();
            }
        }
Esempio n. 24
0
        protected async Task EditNotes()
        {
            ShowErrors = false;
            Console.WriteLine(EditNotesModel.CurrentNote);
            var result = await PlayerNoteService.Create(new CreateNoteModel
                                                        { Description = EditNotesModel.CurrentNote, NotedPlayerName = NotedPlayerName });

            if (result.Successful)
            {
                BlazoredModal.Close();
            }
            else
            {
                Errors     = result.Errors;
                ShowErrors = true;
            }
        }
Esempio n. 25
0
        protected async Task <bool> MessageBoxModal(string titulo, string conteudo, string icone, string textoConfirma = "Confirma", string textoCancela = "Cancela", bool isConfirmed = true, bool isHtml = false)
        {
            _ = BlazoredModal.Close().ConfigureAwait(false);

            bool choice  = false;
            var  myicone = (SweetAlertIcon)icone;

            if (!isConfirmed)
            {
                textoConfirma = "Ok";
            }

            await Swal.FireAsync(new SweetAlertOptions
            {
                Title             = titulo,
                Html              = isHtml ? conteudo : null,
                Text              = conteudo,
                AllowEnterKey     = true,
                Icon              = myicone,
                ShowCancelButton  = isConfirmed,
                ConfirmButtonText = textoConfirma,
                CancelButtonText  = textoCancela,
                CancelButtonColor = "error",
                AllowEscapeKey    = true
            }).ContinueWith(swalTask =>
            {
                SweetAlertResult result = swalTask.Result;

                if (result.Dismiss != DismissReason.Cancel)
                {
                    choice = true;
                }
                else if (result.Dismiss == DismissReason.Cancel)
                {
                    Swal.FireAsync(
                        "Oops!!!!!",
                        "Ação Cancelada!",
                        SweetAlertIcon.Error
                        );
                }
            });

            return(choice);
        }
Esempio n. 26
0
        public async Task CreateNewFranchisee()
        {
            var user = new Franchisee
            {
                FirstName   = Input.FirstName,
                LastName    = Input.LastName,
                Email       = Input.Email,
                PhoneNumber = Input.PhoneNumber,
                Location    = Input.Location
            };
            IdentityResult result = await UserManager.CreateAsync(user, Input.Password);

            if (result.Succeeded)
            {
                Logger.LogInformation("Franchisee created a new account with password.");

                await EmailManager.SendConfirmationEmailAsync(user);
            }

            await BlazoredModal.Close(ModalResult.Ok(true));
        }
        protected async Task SaveSpecimenAsync()
        {
            var isNewSpecimen = Specimen.SpecimenId == 0;

            if (isNewSpecimen)
            {
                Specimen.DateCreated = DateTime.UtcNow;
            }
            else
            {
                Specimen.DateModified = DateTime.UtcNow;
            }

            if (SelectedLifeform != null)
            {
                Specimen.Lifeform = SelectedLifeform.LifeformId > 0 ? SelectedLifeform : null;
            }

            PopulateInventoryItemName();

            Specimen.InventoryItem.Origin   = SelectedOrigin;
            Specimen.InventoryItem.Name     = Specimen.Name;
            Specimen.InventoryItem.Quantity = Specimen.Quantity;
            Specimen.Photos = UploadedPhotos.Any() ? UploadedPhotos : null;

            Specimen = await ApiClient.PutSpecimenAsync(Specimen);

            if (BlazoredModal != null)
            {
                await BlazoredModal.Close(ModalResult.Ok(Specimen));
            }
            else
            {
                await CancelAsync(isNewSpecimen);
            }
        }
Esempio n. 28
0
 protected void Cancel() => BlazoredModal.Close();
Esempio n. 29
0
        private async Task Submit()
        {
            var hardwareId = await HttpClient.PostJsonAsync <int>("api/hardware", Command);

            await BlazoredModal.CloseAsync(ModalResult.Ok(hardwareId));
        }
 void CancelClicked()
 {
     BlazoredModal.Cancel();
 }