Beispiel #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(feeid))
         {
             throw new Exception("Select a record to perform operation");
         }
         if (UpdateFee.isUpdate(sessionid, feename))
         {
             var fees = new Fees();
             fees.setSection(txtSection.Text);
             fees.setFeeName(txtFeename.Text);
             fees.setAmount(double.Parse(txtAmount.Text));
             UpdateFee.updateFee(feeid, fees.getSection(), fees.getFeeName(), fees.getAmount().ToString());
             MessageBox.Show("Update Successful", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Clear();
         }
         else
         {
             throw new Exception("Fee CANNOT be updated");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Update error", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(feeid))
                {
                    throw new Exception("Select a record to perform operation");
                }

                if (UpdateFee.isUpdate(sessionid, feename))
                {
                    UpdateFee.DeletFee(feeid);
                    MessageBox.Show("Delete Successful", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Clear();
                }
                else
                {
                    throw new Exception("Fee CANNOT be updated");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Delete error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
 public UpdateFeesForm()
 {
     InitializeComponent();
     UpdateFee.viewFees(dataGridSession);
 }