예제 #1
0
        }     //End Search

        private void grdBookList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //Extract BookID from column 0 of selected row
            Books aBook = new Books();

            //Retrieve details from this member item from DB
            aBook.getBook(Convert.ToInt32(grdBookList.Rows[grdBookList.CurrentCell.RowIndex].Cells[0].Value));

            //Load instance variable values onto form
            txtBookID.Text  = aBook.getBookID().ToString("0000");
            txtISBN.Text    = aBook.getISBN();
            txtClassNo.Text = aBook.getClassNo();

            //Subject
            //Declare Variable to hold Subject Name
            strSubjectName          = Books.getSubjectName(aBook.getSubjectCode());
            cmbSubject.SelectedItem = strSubjectName;

            txtTitle.Text    = aBook.getTitle();
            txtAuthor.Text   = aBook.getAuthor();
            nudEdition.Value = aBook.getEdition();
            txtPrice.Text    = aBook.getPrice().ToString();
            txtPages.Text    = aBook.getPage().ToString();
            txtPName.Text    = aBook.getPubName();

            //Country
            //Declare Variable to hold Country Name
            strCountryName          = Books.getCountryName(aBook.getCountry());
            cmbCountry.SelectedItem = strCountryName;

            txtYearPub.Text = aBook.getYearPub();

            //Display Member details
            grpBookInfo.Visible = true;
        } //End Cell Click Event
예제 #2
0
        } //End Search Method

        private void grdBookList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //Extract BookID from column 0 of selected row
            aBook = new Books();

            //Retrieve details from this member item from DB
            aBook.getBook(Convert.ToInt32(grdBookList.Rows[grdBookList.CurrentCell.RowIndex].Cells[0].Value));

            //Variables to Store Book ID, ISBN, and Book Title
            int    intBookID = aBook.getBookID();
            String strISBN   = aBook.getISBN();
            String strTitle  = aBook.getTitle();

            //Join All Variables
            String strValue = intBookID.ToString("0000") + " " + strISBN + " " + strTitle;

            //Add Details to List
            //Prevent Duplicates entries into ListBox
            if (lstCart.Items.Contains(strValue))
            {
                //Display error message to indicates that no duplicates allow
                String strErrorMessage = "'" + strTitle + "' has been added, no duplicates";
                MessageBox.Show(strErrorMessage, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                lstCart.Items.Add(strValue);
            }
        } //End Book List