private void Up_BT_Click(object sender, EventArgs e) { string UpdateRow = AccGridView.CurrentRow.Cells["Acc_ID"].Value.ToString(); AdminCl admin = new AdminCl(User_TB.Text, Pass_TB.Text, Role_Cb.Text, ID_TB.Text); admin.Update(UpdateRow); if (!IsEmt()) { if (admin.Update(UpdateRow) != 0) { MessageBox.Show("Success"); ClearData(); AccGridView.DataSource = admin.AccountTable(); } else { MessageBox.Show("failed"); User_TB.Focus(); } } else { MessageBox.Show("fill all input box to update oni-chan"); } }
private void Enter_Clicked(object sender, EventArgs e) { var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyDatabase.db"); var db = new SQLiteConnection(dbPath); db.CreateTable <User_TB>(); var item = new User_TB() { Username = EntryUsername.Text, Password = EntryPassword.Text, Name = EntryName.Text, Type_Blood = EntryType_Blood.Text }; db.Insert(item); if ((string.IsNullOrWhiteSpace(EntryUsername.Text)) || (string.IsNullOrEmpty(EntryUsername.Text)) || (string.IsNullOrWhiteSpace(EntryPassword.Text)) || (string.IsNullOrEmpty(EntryPassword.Text)) || (string.IsNullOrWhiteSpace(EntryName.Text)) || (string.IsNullOrEmpty(EntryName.Text)) || (string.IsNullOrWhiteSpace(EntryType_Blood.Text)) || (string.IsNullOrEmpty(EntryType_Blood.Text))) { Device.BeginInvokeOnMainThread(async() => { var result = await this.DisplayAlert("Error", "Please Enter Data", "Cancel", "Yes"); if (result) { await Navigation.PushAsync(new Register()); } else { await Navigation.PushAsync(new Register()); } }); } else { Device.BeginInvokeOnMainThread(async() => { var result = await this.DisplayAlert("Successfull", "Registeration Successful", "Cancel", "Yes"); if (result) { App.Current.MainPage = new Login(); } }); Navigation.PushAsync(new Login()); } }
/// <summary> /// Login Button gives the health care staff access to the system. /// This button can only be used if the system is connected to VPN Cisco AU University /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Login_B_Click(object sender, RoutedEventArgs e) { string userName = User_TB.Text; string password = Password_PWB.Password; //Checks if the user name and password exist in the database if (controller.CheckLogin(userName, password)) { userName_ = userName; this.Close(); main.Show(); } else { //Shows message box is the user name and/or password don't exist in the system MessageBox.Show("Brugernavn eller kode er forkert indtastet!", "Login fejlet!", MessageBoxButton.OK, MessageBoxImage.Warning); User_TB.Clear(); Password_PWB.Clear(); } }
private void Add_BT_Click(object sender, EventArgs e) { AdminCl admin = new AdminCl(User_TB.Text, Pass_TB.Text, Role_Cb.Text, ID_TB.Text); if (!IsEmt()) { if (admin.Add() != 0) { MessageBox.Show("Success"); ClearData(); AccGridView.DataSource = admin.AccountTable(); } else { MessageBox.Show("failed"); User_TB.Focus(); } } else { MessageBox.Show("Fill all input box"); } }