private void btnAdd_Click(object sender, EventArgs e) { string admno = txtAdmNo.Text; Fee f = new Fee(); if (txtAdmNo.Text == "") { MessageBox.Show("Enter Admission Number", "Admission No.", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DataTable dt = f.TransactionStatus(Convert.ToInt16(txtAdmNo.Text)); if (dt.Rows.Count > 0) { if (dt.Rows[0]["Status"].ToString() == "Fee Slip Issued") { MessageBox.Show("Sorry You Can't Make New Transaction, first Cancel or Pay last transaction", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { frmAEFeeAdmission frm = new frmAEFeeAdmission(admno); if (frm.ShowDialog() == DialogResult.OK) { LoadList(); } } } else { frmAEFeeAdmission frm = new frmAEFeeAdmission(admno); if (frm.ShowDialog() == DialogResult.OK) { LoadList(); } } } }
private void grdList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int curSfid = Convert.ToInt32(grdList.SelectedRows[0].Cells["SFID"].Value); int curadmno = Convert.ToInt32(grdList.SelectedRows[0].Cells["AdmNo"].Value); Fee d = new Fee(); DataTable dt = d.GetMaxSFID(curadmno); int maxsfid = Convert.ToInt32(dt.Rows[0]["maxsfid"]); if (curSfid == maxsfid && grdList.SelectedRows[0].Cells["Status"].Value.ToString() == "Fee Slip Issued") { if (e.RowIndex >= 0) { frmAEFeeAdmission frm = new frmAEFeeAdmission((DataRowView)grdList.Rows[e.RowIndex].DataBoundItem); if (frm.ShowDialog() == DialogResult.OK) { LoadList(); } } } else { MessageBox.Show("You cant not Edit old or payed or canceled Fee Records"); } }