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));
        }
Exemple #2
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();
            }
        }
Exemple #4
0
        public async Task AddToDo()
        {
            if (CallbackAddToDo.HasDelegate)
            {
                await CallbackAddToDo.InvokeAsync(toDo);
            }

            await BlazoredModal.Close();
        }
Exemple #5
0
 protected void Submit()
 {
     if (_editContext.Validate())
     {
         UserRepository.Save(MobileSubscription);
         ToastService.ShowSuccess("Abonnement toegevoegd.");
         BlazoredModal.Close(ModalResult.Ok <MobileSubscription>(MobileSubscription));
     }
 }
Exemple #6
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);
        }
        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);
            }
        }
 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));
     }
 }
Exemple #10
0
        protected async Task LogIn()
        {
            var result = await AccountService.Login(User);

            if (result.Successful)
            {
                BlazoredModal.Close(ModalResult.Ok(true));
            }
            else
            {
                ErrorMessage = result.Error;
            }
        }
Exemple #11
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));
        }
Exemple #12
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);
        }
Exemple #13
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);
        }
        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();
        }
Exemple #15
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.");
     }
 }
Exemple #16
0
        protected async Task CreateAccount()
        {
            ShowErrors = false;
            var result = await AccountService.Register(User);

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

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

                if (Account != null)
                {
                    _selectedAccount = Account.Id;
                    CheckHasSubs();
                }
            }
            catch (Exception ex)
            {
                BlazoredModal.Close();
            }
        }
Exemple #19
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;
            }
        }
Exemple #20
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);
        }
Exemple #21
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);
            }
        }
Exemple #23
0
 protected void Cancel() => BlazoredModal.Close();
 void OkClicked()
 {
     BlazoredModal.Close(ModalResult.Ok <FuzzyModelDescriptionData>(Data));
 }
        protected async Task SaveActivityAsync()
        {
            var isNewActivity = Activity.ActivityId == 0;

            if (isNewActivity)
            {
                Activity.DateCreated = DateTime.UtcNow;
            }
            else
            {
                Activity.DateModified = DateTime.UtcNow;
            }

            if (string.IsNullOrEmpty(Activity.Name))
            {
                PopulateActivityName();
            }

            Activity.Photos = UploadedPhotos.Any() ? UploadedPhotos : null;

            if (SelectedSpecimen != null)
            {
                Activity.Specimen = SelectedSpecimen;
            }

            if (UpdateSpecimen && Activity.Quantity.HasValue)
            {
                var stage = GetSpecimenStage(Activity.ActivityType);

                if (Activity.Quantity == SelectedSpecimen.InventoryItem.Quantity)
                {
                    SelectedSpecimen.SpecimenStage = stage;
                }
                else
                {
                    var newSpecimen = new Specimen
                    {
                        SpecimenStage = stage,
                        Lifeform      = SelectedSpecimen.Lifeform,
                        InventoryItem = new InventoryItem
                        {
                            Name         = SelectedSpecimen.InventoryItem.Name,
                            ItemType     = ItemType.Specimen,
                            Quantity     = Activity.Quantity.Value,
                            Status       = SelectedSpecimen.InventoryItem.Status,
                            Inventory    = SelectedSpecimen.InventoryItem.Inventory,
                            Origin       = SelectedSpecimen.InventoryItem.Origin,
                            DateAcquired = Activity.DateOccurred,
                            DateCreated  = DateTime.UtcNow,
                            CreatedBy    = UserId
                        },
                        ParentSpecimen = SelectedSpecimen,
                        CreatedBy      = UserId,
                        DateCreated    = DateTime.UtcNow
                    };

                    newSpecimen = await ApiClient.PutSpecimenAsync(newSpecimen);

                    Activity.Specimen = newSpecimen;
                    SelectedSpecimen.InventoryItem.Quantity -= Activity.Quantity.Value;
                }

                await ApiClient.PutSpecimenAsync(SelectedSpecimen);
            }

            Activity = await ApiClient.PutActivityAsync(Activity);

            Id = Activity.ActivityId;

            if (BlazoredModal != null)
            {
                await BlazoredModal.Close(ModalResult.Ok(Activity));
            }
            else
            {
                await CancelAsync(isNewActivity);
            }
        }
Exemple #26
0
 void OkClicked()
 {
     BlazoredModal.Close(ModalResult.Ok(true));
 }
 void OkClicked()
 {
     BlazoredModal.Close(ModalResult.Ok <string>(string.IsNullOrEmpty(Value) ? "" : Value));
 }
Exemple #28
0
 protected void JoinTable()
 {
     BlazoredModal.Close(ModalResult.Ok(JoinTableModal.Amount));
 }
 void CancelClicked()
 {
     BlazoredModal.Close(ModalResult.Cancel());
 }
Exemple #30
0
        protected async Task SavePlantInfoAsync()
        {
            var isNewPlantInfo = PlantInfo.PlantInfoId == 0;

            if (isNewPlantInfo)
            {
                PlantInfo.DateCreated = DateTime.UtcNow;
            }
            else
            {
                PlantInfo.DateModified = DateTime.UtcNow;
            }

            PlantInfo.Origin    = SelectedOrigin;
            PlantInfo.Photos    = UploadedPhotos.Any() ? UploadedPhotos : null;
            PlantInfo.Lifeform  = PlantInfo.SelectedLifeform;
            PlantInfo.CreatedBy = UserId;
            PlantInfo.Requirements.StratificationStages = ChosenStratificationStages != null && ChosenStratificationStages.Any() ? ChosenStratificationStages.ToList() : null;
            PlantInfo.WildlifeEffects = ChosenWildlifeEffects != null && ChosenWildlifeEffects.Any() ? ChosenWildlifeEffects.ToList() : null;
            PlantInfo.SoilTypes       = ChosenSoilTypes != null && ChosenSoilTypes.Any() ? ChosenSoilTypes.ToList() : null;

            if (PlantInfo.Height.MinimumHeight.HasValue || PlantInfo.Height.MaximumHeight.HasValue)
            {
                PlantInfo.Height.Unit = DistanceUnit.Feet;
            }
            else
            {
                PlantInfo.Height.Unit = DistanceUnit.Unknown;
            }

            if (PlantInfo.Spread.MinimumSpread.HasValue || PlantInfo.Spread.MaximumSpread.HasValue)
            {
                PlantInfo.Spread.Unit = DistanceUnit.Feet;
            }
            else
            {
                PlantInfo.Spread.Unit = DistanceUnit.Unknown;
            }

            if (MinimumZoneId != PlantInfo.Requirements.ZoneRequirements?.MinimumZone?.Id)
            {
                PlantInfo.Requirements.ZoneRequirements = new ZoneRequirements
                {
                    MinimumZone = Zones.First(z => z.Id == MinimumZoneId)
                };
            }

            if (MaximumZoneId != PlantInfo.Requirements.ZoneRequirements?.MaximumZone?.Id)
            {
                if (PlantInfo.Requirements.ZoneRequirements == null)
                {
                    PlantInfo.Requirements.ZoneRequirements = new ZoneRequirements
                    {
                        MaximumZone = Zones.First(z => z.Id == MaximumZoneId)
                    };
                }
                else
                {
                    PlantInfo.Requirements.ZoneRequirements.MaximumZone = Zones.First(z => z.Id == MaximumZoneId);
                }
            }

            PlantInfo = await ApiClient.PutPlantInfoAsync(PlantInfo);

            if (BlazoredModal != null)
            {
                await BlazoredModal.Close(ModalResult.Ok(PlantInfo));
            }
            else
            {
                await CancelAsync(isNewPlantInfo);
            }
        }