Exemple #1
0
        private void BtnAddBook_Click(object sender, EventArgs e)
        {
            frmAddEditBook frm = new frmAddEditBook(this);

            frm.btnUpdate.Enabled = false;
            frm.lblLibrarian.Text = admin;
            frm.ShowDialog();
        }
Exemple #2
0
        private void GunaDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //Load to labels
            lblBookTitle.Text = gunaDataGridView1[2, e.RowIndex].Value.ToString();
            lblISBN.Text      = gunaDataGridView1[3, e.RowIndex].Value.ToString();
            lblSubject.Text   = gunaDataGridView1[4, e.RowIndex].Value.ToString();
            lblGenre.Text     = gunaDataGridView1[5, e.RowIndex].Value.ToString();
            lblMediaType.Text = gunaDataGridView1[6, e.RowIndex].Value.ToString();
            lblLanguage.Text  = gunaDataGridView1[7, e.RowIndex].Value.ToString();
            lblAuthor.Text    = gunaDataGridView1[8, e.RowIndex].Value.ToString();
            lblPublisher.Text = gunaDataGridView1[9, e.RowIndex].Value.ToString();
            lblPrice.Text     = "₱" + Convert.ToDouble(gunaDataGridView1[10, e.RowIndex].Value).ToString("N");
            lblYear.Text      = gunaDataGridView1[11, e.RowIndex].Value.ToString();
            lblAllCopies.Text = gunaDataGridView1[12, e.RowIndex].Value.ToString();
            lblAvailable.Text = gunaDataGridView1[13, e.RowIndex].Value.ToString();
            lblBorrowed.Text  = gunaDataGridView1[14, e.RowIndex].Value.ToString();
            lblLost.Text      = gunaDataGridView1[15, e.RowIndex].Value.ToString();

            string colName = gunaDataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Edit")
            {
                frmAddEditBook frm = new frmAddEditBook(this);
                frm.lblLibrarian.Text = admin;
                frm.btnSave.Enabled   = false;
                frm.txtCopies.Enabled = false;
                frm.lblTitle.Text     = "Edit Book Details";
                frm.lblID.Text        = gunaDataGridView1[1, e.RowIndex].Value.ToString();
                frm.txtTitle.Text     = gunaDataGridView1[2, e.RowIndex].Value.ToString();
                frm.txtISBN.Text      = gunaDataGridView1[3, e.RowIndex].Value.ToString();
                frm.cboSubject.Text   = gunaDataGridView1[4, e.RowIndex].Value.ToString();
                frm.cboGenre.Text     = gunaDataGridView1[5, e.RowIndex].Value.ToString();
                frm.cboMediaType.Text = gunaDataGridView1[6, e.RowIndex].Value.ToString();
                frm.txtLanguage.Text  = gunaDataGridView1[7, e.RowIndex].Value.ToString();
                frm.txtAuthor.Text    = gunaDataGridView1[8, e.RowIndex].Value.ToString();
                frm.txtPublisher.Text = gunaDataGridView1[9, e.RowIndex].Value.ToString();
                frm.txtPrice.Text     = gunaDataGridView1[10, e.RowIndex].Value.ToString();
                frm.txtYear.Text      = gunaDataGridView1[11, e.RowIndex].Value.ToString();
                frm.txtCopies.Text    = gunaDataGridView1[12, e.RowIndex].Value.ToString();
                frm.ShowDialog();
            }
            else if (colName == "AddCopy")
            {
                frmAcquireBooks frm = new frmAcquireBooks(this);
                frm.lblLibrarian.Text   = admin;
                frm.lblBookTitle.Text   = gunaDataGridView1[2, e.RowIndex].Value.ToString();
                frm.lblAlLCopies.Text   = gunaDataGridView1[12, e.RowIndex].Value.ToString();
                frm.lblAvailCopies.Text = gunaDataGridView1[13, e.RowIndex].Value.ToString();
                frm.ShowDialog();
            }
        }