Ejemplo n.º 1
0
        public async Task CmdChangePassword()
        {
            IsButtonDisabled = true;
            StateHasChanged();

            Validate();


            if (LocalFunctions.HasError())
            {
                LocalFunctions.DisplayErrors();
            }
            else
            {
                TSUser tsUser = new TSUser()
                {
                    Email       = LocalData.CurrTSUser.Email,
                    Password    = NewPassword,
                    EmailedCode = EmailedCode,
                };



                await WebApi.CmdUserChangePassword(tsUser);
            }


            IsButtonDisabled = false;
        }
        public async Task CmdAddUser()
        {
            IsButtonDisabled = true;
            StateHasChanged();


            LocalFunctions.Validate(tsUser, false);

            Validate();


            if (LocalFunctions.HasError())
            {
                LocalFunctions.DisplayErrors();
            }
            else
            {
                if (await WebApi.CmdCheckUserNameNotExists(tsUser.UserName.Trim()))
                {
                    await WebApi.CmdRegisterUser(tsUser);
                }
            }


            IsButtonDisabled = false;
        }
        public async Task CmdAddOrUpdateTodo()
        {
            IsButtonDisabled = true;
            StateHasChanged();

            if (LocalData.CurrTodo.HasDueDate)
            {
                if (LocalData.CurrTodo.DueDate <= LocalFunctions.ToLocalDate(DateTime.Now).AddMinutes(3))
                {
                    LocalFunctions.AddError("Due date should be minimum after 3 minute from now", MethodBase.GetCurrentMethod(), false, false);
                }
            }


            LocalFunctions.Validate(LocalData.CurrTodo);


            if (LocalFunctions.HasError())
            {
                LocalFunctions.DisplayErrors();
            }
            else
            {
                string a = string.Empty;

                if (LocalData.AddOrUpdateMode)
                {
                    LocalData.CurrTodo.UserID = LocalData.CurrTSUser.ID;
                    a = await WebApiFunctions.CmdAddTodo(LocalData.CurrTodo);
                }
                else
                {
                    if (!GlobalFunctions.AreEqualTwoObjects(LocalData.CurrTodo, LocalData.BeforeUpdateTodo))
                    {
                        a = await WebApiFunctions.CmdUpdateTodo(LocalData.CurrTodo);
                    }
                    else
                    {
                        LocalFunctions.AddMessage("Todo properties not updated", true, false);
                        return;
                    }
                }

                if (a.Equals("OK"))
                {
                    LocalData.TsTodosList = new List <TSTodoEx>();

                    LocalData.btModal.Close();

                    LocalData.EventConsumerName = "TodosPage";
                    LocalData.componentBridge.InvokeRefresh();
                }
                else
                {
                    LocalFunctions.AddError(a, MethodBase.GetCurrentMethod(), true, false);
                }
            }

            IsButtonDisabled = false;
        }
Ejemplo n.º 4
0
        public void CmdRecoverPass()
        {
            ValidateUserName();

            if (LocalFunctions.HasError())
            {
                LocalFunctions.DisplayErrors();
            }
            else
            {
                LocalFunctions.DisplayConfirm("LoginDialog", "Are you sure to recover password?");
            }
        }
Ejemplo n.º 5
0
        protected void CmdAuthorize()
        {
            IsButtonDisabled      = true;
            IsRecoveryIconVisible = false;
            StateHasChanged();


            ValidateFull();

            if (LocalFunctions.HasError())
            {
                LocalFunctions.DisplayErrors();
            }
            else
            {
                LocalFunctions.Authorize(UserName.Trim(), UserPassword.Trim());
            }

            IsButtonDisabled      = false;
            IsRecoveryIconVisible = true;
            StateHasChanged();
        }