public Task <int> SaveItemAsyncUser(TodoItemUser user) { if (user.ID != 0) { return(database.UpdateAsync(user)); } else { return(database.InsertAsync(user)); } }
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; } }
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"; } } }
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; }
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."; } } }
public Task <int> DeleteItemAsyncUser(TodoItemUser user) { return(database.DeleteAsync(user)); }
public LoginPage(TodoItemUser currentUser) { InitializeComponent(); currentUserLogin = currentUser; }