private void btnGuest_Click(object sender, EventArgs e) { DBFactoryEnums db = (DBFactoryEnums)cboDbOption.SelectedIndex + 1; LibraryProxy library = LibraryProxy.GetInstance(db); library.GuestAccount(); GoToMain(); }
private void frmBorrowReprot_Load(object sender, EventArgs e) { ReportDataSource rds = new ReportDataSource("DataSet1", LibraryProxy.GetInstance().GetReport()); reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.RefreshReport(); }
public static LibraryProxy GetInstance(DBFactoryEnums db) { if (libraryProxy == null || DbFactory != db) { DbFactory = db; libraryProxy = new LibraryProxy(db); } return(libraryProxy); }
private void btnLogIn_Click(object sender, EventArgs e) { DBFactoryEnums db = (DBFactoryEnums)cboDbOption.SelectedIndex + 1; LibraryProxy library = LibraryProxy.GetInstance(db); if (!library.Login(txtUsername.Text.Trim(), txtPassword.Text)) { MessageBox.Show("Please Insert Username and Password"); } if (library.account.AccountLevel >= AccountLevelEnums.Patron) { MessageBox.Show("Login success."); GoToMain(); } }
public void LoadLevel() { switch (LibraryProxy.GetInstance((DBFactoryEnums)cboDbOption.SelectedIndex + 1).account.AccountLevel) { case AccountLevelEnums.Librarian: cboLevel.Items.Add(AccountLevelEnums.Patron); cboLevel.Items.Add(AccountLevelEnums.Librarian); break; case AccountLevelEnums.Manager: cboLevel.Items.Add(AccountLevelEnums.Patron); cboLevel.Items.Add(AccountLevelEnums.Librarian); cboLevel.Items.Add(AccountLevelEnums.Manager); break; default: cboLevel.Items.Add(AccountLevelEnums.Patron); break; } cboLevel.SelectedIndex = 0; }
private void btnSignIn_Click(object sender, EventArgs e) { var libraryApp = LibraryProxy.GetInstance((DBFactoryEnums)cboDbOption.SelectedIndex + 1); string address = txtAddress.Text.Trim(); string phone = txtPhone.Text.Trim(); AccountLevelEnums level = (AccountLevelEnums)cboLevel.SelectedIndex + 1; string fullname = txtFullname.Text.Trim(); string username = txtUsername.Text.Trim(); string password = txtPassword.Text; if (libraryApp.SignIn(fullname, address, phone, level, username, password)) { MessageBox.Show("Sign In Success"); txtAddress.Text = ""; txtFullname.Text = ""; txtPassword.Text = ""; txtPhone.Text = ""; txtUsername.Text = ""; } else { MessageBox.Show("One or more field haven't been filled correctly"); } }
private void frmMain_Load(object sender, EventArgs e) { libraryapp = LibraryProxy.GetInstance(); setLabelAccount(); HideTab(); }
private void frmBookList_Load(object sender, EventArgs e) { libraryapp = LibraryProxy.GetInstance(); loadAll(); }
private void frmDeleteAccount_Load(object sender, EventArgs e) { libraryApp = LibraryProxy.GetInstance(); }
private void frmReturnedBook_Load(object sender, EventArgs e) { libraryApp = LibraryProxy.GetInstance(); }
public frmUpdateAccount(int id) : this() { lblID.Text = id.ToString(); libraryApp = LibraryProxy.GetInstance(); LoadAccount(Convert.ToInt32(lblID.Text)); }
private void InputBook_Load(object sender, EventArgs e) { btnSelect.Enabled = false; libraryapp = LibraryProxy.GetInstance(); loadDataGrid(loadAll()); }
private void frmSearchBook_Load(object sender, EventArgs e) { libraryapp = LibraryProxy.GetInstance(); loadAllBook(); }
private void frmChangePassword_Load(object sender, EventArgs e) { libraryApp = LibraryProxy.GetInstance(); }
private void frmBorrowHistory_Load(object sender, EventArgs e) { libraryApp = LibraryProxy.GetInstance(); LoadAll(); }