コード例 #1
0
 public Task <int> SaveItemAsyncUser(TodoItemUser user)
 {
     if (user.ID != 0)
     {
         return(database.UpdateAsync(user));
     }
     else
     {
         return(database.InsertAsync(user));
     }
 }
コード例 #2
0
        public void User()
        {
            user = new TodoItemUser();
            string admin = "admin";

            user.Username = inputName.Text;
            user.Password = inputPassword.Text;

            if (user.Username == admin)
            {
                user.Level = 1;
            }
            else
            {
                user.Level = 0;
            }
        }
コード例 #3
0
        public async void checkUser()
        {
            var result = await App.Database.GetItemsNotDoneAsyncUser();

            foreach (TodoItemUser todoItemUser in result)
            {
                if (user.Username != todoItemUser.Username)
                {
                    echo.Text = "Registration succesful";
                    await App.Database.SaveItemAsyncUser(user);

                    currentUser = new TodoItemUser();
                    currentUser = user;
                }
                else
                {
                    echo.Text = "user already exists";
                }
            }
        }
コード例 #4
0
        public MainWindow(TodoItemUser currentUserMain)
        {
            InitializeComponent();
            currentUserMainW = currentUserMain;
            Display();

            buttonCart.IsEnabled   = false;
            buttonRemove.IsEnabled = false;
            buttonBuy.IsEnabled    = false;
            buttonAdd.IsEnabled    = false;
            buttonDelete.IsEnabled = false;

            string admin = "admin";

            if (currentUserMainW.Username == admin)
            {
                currentUserMainW.Level = 1;
                buttonAdd.IsEnabled    = true;
                buttonDelete.IsEnabled = true;
            }
            logged.Text = "You are logged as: " + currentUserMainW.Username;
        }
コード例 #5
0
        public async void checkUser()
        {
            currentUserLogin = new TodoItemUser();

            currentUserLogin.Username = inputName.Text;
            currentUserLogin.Password = inputPassword.Text;
            var result = await App.Database.GetItemsNotDoneAsyncUser();

            foreach (TodoItemUser todoItemUser in result)
            {
                if (currentUserLogin.Password == todoItemUser.Password)
                {
                    currentUserMain = new TodoItemUser();
                    currentUserMain = currentUserLogin;
                    MainWindow main = new MainWindow(currentUserMain);
                    main.Show();
                }
                else
                {
                    // echo.Text = "Wrong username or password.";
                }
            }
        }
コード例 #6
0
 public Task <int> DeleteItemAsyncUser(TodoItemUser user)
 {
     return(database.DeleteAsync(user));
 }
コード例 #7
0
 public LoginPage(TodoItemUser currentUser)
 {
     InitializeComponent();
     currentUserLogin = currentUser;
 }