private void bttnHistory_Click(object sender, System.EventArgs e) { if (lvBooks.Items.Count > 0) { try { if (MessageBox.Show("Do you want to print the list of adjustments in the selected record?", clsVariables.sMSGBOX, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { FORMBooks_Monitoring.sBookNumber = lvBooks.Items[lvBooks.FocusedItem.Index].SubItems[0].Text; FORMBooks_Monitoring sForm = new FORMBooks_Monitoring(); sForm.ShowDialog(); } else { FORMViewer.sDeploy = "Adjustments"; FORMViewer.sBookNO = lvBooks.Items[lvBooks.FocusedItem.Index].SubItems[0].Text; FORMViewer.sBookTitle = lvBooks.Items[lvBooks.FocusedItem.Index].SubItems[2].Text; FORMViewer.sISBN = lvBooks.Items[lvBooks.FocusedItem.Index].SubItems[1].Text; FORMViewer.sSQL = "SELECT tblBooks.BookNo, tblBooks.ISBN, tblBooks.BookTitle, tblCategory.CategoryName, tblLibrarian.LibrarianID, [LastName] & ', ' & [FirstName] & ' ' & [MiddleName] AS Fullname, tblAdjustments.DateAdjust " + "FROM tblLibrarian INNER JOIN (tblCategory RIGHT JOIN (tblBooks RIGHT JOIN tblAdjustments ON tblBooks.BookNo = tblAdjustments.BookNumber) ON tblCategory.IndexCategory = tblBooks.CategoryIndex) ON tblLibrarian.LibrarianID = tblAdjustments.AdjustBy " + "WHERE tblBooks.BookNo LIKE '" + lvBooks.Items[lvBooks.FocusedItem.Index].SubItems[0].Text + "' " + "ORDER BY tblLibrarian.LibrarianID ASC"; FORMViewer.sTable = "tblAdjustments"; FORMViewer sForm = new FORMViewer(); sForm.ShowDialog(); } } catch (ArgumentOutOfRangeException aooreE) { MessageBox.Show("" + aooreE.Message); } catch (NullReferenceException nreE) {} } else { MessageBox.Show("No record. Pls. select a new record", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void FORMBooks_Monitoring_Load(object sender, System.EventArgs e) { //Set the Icon on Listview. lvBooks.SmallImageList = MDIFORM.i16x16; //Set the Data Adapter daHistory = new OleDbDataAdapter("", clsConnections.CN); //Set to Load Books History loadBooks("SELECT tblAdjustments.BookNumber, tblBooks.ISBN, tblBooks.BookTitle, tblCategory.CategoryName, tblLibrarian.LibrarianID, [LastName] & ', ' & [FirstName] & ' ' & [MiddleName] AS Fullname, tblAdjustments.DateAdjust FROM tblCategory RIGHT JOIN (tblLibrarian INNER JOIN (tblBooks RIGHT JOIN tblAdjustments ON tblBooks.BookNo = tblAdjustments.BookNumber) ON tblLibrarian.LibrarianID = tblAdjustments.AdjustBy) ON tblCategory.IndexCategory = tblBooks.CategoryIndex WHERE tblAdjustments.BookNumber LIKE '" + sBookNumber + "' ORDER BY tblAdjustments.DateAdjust DESC"); publicHistory = this; }