Exemplo n.º 1
0
        //Modify Book
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //【1】Get current Click Book information
            Book objBook = null;

            try
            {
                objBook = objBookServices.GetBookById(dgvBook.CurrentRow.Cells[0].Value.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Abnormal access to book details! Specific reasons:" + ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            //【2】 Assign a value to flag
            actionFlag = 3;

            //【3】Loading a form
            frmBookDetail objFrmBookDetail = new frmBookDetail(actionFlag, objBook);
            DialogResult  result           = objFrmBookDetail.ShowDialog();

            if (result == DialogResult.OK)
            {
                LoadBookInfo();
            }
        }
Exemplo n.º 2
0
        //Add a book:
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //【2】 Assign a value to flag
            actionFlag = 2;
            //【3】Loading a form
            frmBookDetail objFrmBookDetail = new frmBookDetail(actionFlag, null);
            DialogResult  result           = objFrmBookDetail.ShowDialog();

            if (result == DialogResult.OK)
            {
                //Update list information
                LoadBookInfo();
            }
        }
Exemplo n.º 3
0
        private void dgvBorrowedList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //Get a breakdown of the current book
            Book objBook = objBookServices.GetBookById(dgvBorrowedList.CurrentRow.Cells[1].Value.ToString());

            //Open Form
            if (objFrmBookDetail == null)
            {
                objFrmBookDetail = new frmBookDetail(1, objBook);
                objFrmBookDetail.Show();
            }
            else
            {
                objFrmBookDetail.Activate();
                objFrmBookDetail.WindowState = FormWindowState.Normal;
            }
        }
        private void dgvReturn_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //Get information about a book
            Book objBook = objBookServices.GetBookById(dgvReturn.CurrentRow.Cells[1].Value.ToString());

            //Load form
            if (objFrmBookDetail == null)
            {
                objFrmBookDetail = new frmBookDetail(1, objBook);
                objFrmBookDetail.Show();
            }
            else
            {
                objFrmBookDetail.Activate();
                objFrmBookDetail.WindowState = FormWindowState.Normal;
            }
        }
Exemplo n.º 5
0
        //View book details: View only
        private void dgvBook_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //【1】Get current Click Book information
            Book objBook = null;

            try
            {
                objBook = objBookServices.GetBookById(dgvBook.CurrentRow.Cells[0].Value.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Abnormal access to book details! Specific reasons:" + ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            //【2】 Assign a value to flag
            actionFlag = 1;

            //【3】Loading a form
            frmBookDetail objFrmBookDetail = new frmBookDetail(actionFlag, objBook);

            objFrmBookDetail.Show();
        }