예제 #1
0
        private void bookIssueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmStudentBookIssue frm = new frmStudentBookIssue();

            frm.lblUserType.Text = UserType.Text;
            frm.lblUser.Text     = User.Text;
            frm.Show();
        }
 private void frmBookIssueRecord_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (Set10.Text == "Book Return")
     {
         this.Hide();
         frmBookReturn frm = new frmBookReturn();
         frm.lblUserType.Text = lblUserType.Text;
         frm.lblUser.Text     = lblUser.Text;
         frm.Show();
     }
     else
     {
         this.Hide();
         frmStudentBookIssue frm = new frmStudentBookIssue();
         frm.lblUserType.Text = lblUserType.Text;
         frm.lblUser.Text     = lblUser.Text;
         frm.Show();
     }
 }
        private void dataGridView4_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (Set1.Text == "Book issue")
                {
                    DataGridViewRow dr = dataGridView4.SelectedRows[0];
                    this.Hide();
                    frmStudentBookIssue frm = new frmStudentBookIssue();
                    frm.Show();
                    frm.TabControl1.SelectedTab = frm.TabPage1;
                    frm.txtTransactionID.Text   = dr.Cells[0].Value.ToString();
                    frm.dtpIssueDate.Text       = dr.Cells[1].Value.ToString();

                    frm.dtpDueDate.Text     = dr.Cells[2].Value.ToString();
                    frm.cmbAccessionNo.Text = dr.Cells[3].Value.ToString();
                    frm.txtBookTitle.Text   = dr.Cells[4].Value.ToString();
                    frm.txtAuthor.Text      = dr.Cells[5].Value.ToString();
                    frm.txtsubject.Text     = dr.Cells[6].Value.ToString();
                    frm.txtISBN.Text        = dr.Cells[7].Value.ToString();

                    frm.txtEdition.Text     = dr.Cells[8].Value.ToString();
                    frm.txtStudentName.Text = dr.Cells[10].Value.ToString();
                    frm.cmbadmissionno.Text = dr.Cells[9].Value.ToString();
                    frm.txtClass.Text       = dr.Cells[11].Value.ToString();
                    frm.txtsection.Text     = dr.Cells[12].Value.ToString();

                    frm.btnDelete.Enabled        = true;
                    frm.btnUpdate_record.Enabled = true;
                    frm.lblUser.Text             = lblUser.Text;
                    frm.lblUserType.Text         = lblUserType.Text;

                    frm.btnSave.Enabled = false;
                }

                else
                {
                    DataGridViewRow dr = dataGridView4.SelectedRows[0];
                    this.Hide();
                    frmBookReturn frm = new frmBookReturn();
                    frm.Show();

                    frm.TabControl1.SelectedTab = frm.TabPage1;
                    frm.txtTransactionID.Text   = dr.Cells[0].Value.ToString();
                    frm.dtpIssueDate.Text       = dr.Cells[1].Value.ToString();

                    frm.dtpDueDate.Text     = dr.Cells[2].Value.ToString();
                    frm.txtAccessionNo.Text = dr.Cells[3].Value.ToString();
                    frm.txtBookTitle.Text   = dr.Cells[4].Value.ToString();
                    frm.txtAuthor.Text      = dr.Cells[5].Value.ToString();
                    frm.txtSubject.Text     = dr.Cells[6].Value.ToString();
                    frm.txtISBN.Text        = dr.Cells[7].Value.ToString();

                    frm.txtEdition.Text          = dr.Cells[8].Value.ToString();
                    frm.txtStudentName.Text      = dr.Cells[9].Value.ToString();
                    frm.AdmissionNo.Text         = dr.Cells[10].Value.ToString();
                    frm.txtClass.Text            = dr.Cells[11].Value.ToString();
                    frm.txtSection.Text          = dr.Cells[12].Value.ToString();
                    frm.lblUser.Text             = lblUser.Text;
                    frm.lblUserType.Text         = lblUserType.Text;
                    frm.btnDelete.Enabled        = false;
                    frm.btnUpdate_record.Enabled = false;

                    frm.btnSave.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void dataGridView4_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (SET.Text == "Book Issues")
                {
                    DataGridViewRow dr = dataGridView4.SelectedRows[0];
                    this.Hide();
                    frmStudentBookIssue frm = new frmStudentBookIssue();
                    frm.Show();

                    frm.TabControl1.SelectedTab = frm.TabPage2;
                    frm.txtTransactionID1.Text  = dr.Cells[0].Value.ToString();
                    frm.dtpIssueDate1.Text      = dr.Cells[1].Value.ToString();
                    frm.dtpDueDate1.Text        = dr.Cells[2].Value.ToString();
                    frm.cmbAccessionNo1.Text    = dr.Cells[3].Value.ToString();
                    frm.txtBookTitle1.Text      = dr.Cells[4].Value.ToString();
                    frm.txtAuthor1.Text         = dr.Cells[5].Value.ToString();
                    frm.txtsubject1.Text        = dr.Cells[6].Value.ToString();
                    frm.txtISBN1.Text           = dr.Cells[7].Value.ToString();

                    frm.txtEdition1.Text         = dr.Cells[8].Value.ToString();
                    frm.txtStaffName.Text        = dr.Cells[10].Value.ToString();
                    frm.cmbStaffID.Text          = dr.Cells[9].Value.ToString();
                    frm.txtDepartment1.Text      = dr.Cells[11].Value.ToString();
                    frm.lblUser.Text             = lblUser.Text;
                    frm.lblUserType.Text         = lblUserType.Text;
                    frm.btnDelete.Enabled        = true;
                    frm.btnUpdate_record.Enabled = true;
                    frm.btnDelete1.Enabled       = true;
                    frm.btnUpdate1.Enabled       = true;
                    frm.btnSave.Enabled          = false;
                }
                else
                {
                    DataGridViewRow dr = dataGridView4.SelectedRows[0];
                    this.Hide();
                    frmBookReturn frm = new frmBookReturn();
                    // or simply use column name instead of index
                    //dr.Cells["id"].Value.ToString();
                    frm.Show();

                    frm.TabControl1.SelectedTab = frm.TabPage2;
                    frm.txtTransactionID1.Text  = dr.Cells[0].Value.ToString();
                    frm.dtpIssueDate1.Text      = dr.Cells[1].Value.ToString();

                    frm.dtpDueDate1.Text     = dr.Cells[2].Value.ToString();
                    frm.txtAccessionNo1.Text = dr.Cells[3].Value.ToString();
                    frm.txtBookTitle1.Text   = dr.Cells[4].Value.ToString();
                    frm.txtAuthor1.Text      = dr.Cells[5].Value.ToString();
                    frm.txtsubject1.Text     = dr.Cells[6].Value.ToString();
                    frm.txtISBN1.Text        = dr.Cells[7].Value.ToString();

                    frm.txtEdition1.Text  = dr.Cells[8].Value.ToString();
                    frm.txtStaffName.Text = dr.Cells[9].Value.ToString();
                    frm.txtStaffID.Text   = dr.Cells[10].Value.ToString();

                    frm.txtDepartment1.Text = dr.Cells[11].Value.ToString();
                    frm.lblUser.Text        = lblUser.Text;
                    frm.lblUserType.Text    = lblUserType.Text;

                    frm.btnDelete1.Enabled = false;
                    frm.btnUpdate1.Enabled = false;

                    frm.btnSave.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }