示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text == "&Update")
            {
                util.ValidateTextBox4(txtAmount, txtDesc, txtReservation, txtTuitionFeeName);// Validation before Updating
                if (util.readyToSave == 1)
                {
                    #region UPDATE DISCOUNT
                    tuition.Id                    = id;
                    tuition.TuitionFeeName        = txtTuitionFeeName.Text;
                    tuition.TuitionFeeDescription = txtDesc.Text;
                    tuition.TuitionFeeAmount      = txtAmount.Text;
                    tuition.ReservationFee        = txtReservation.Text;
                    tuition.Dept                  = cmbDept.Text;
                    tuition.Status                = cmbStatus.Text;
                    tuition.Update();

                    Reset();
                    #endregion
                }
                else
                {
                    Reset();
                    return;
                }
            }
            else
            {
                util.ValidateTextBox4(txtAmount, txtDesc, txtReservation, txtTuitionFeeName);// Validation before saving
                if (util.readyToSave == 1)
                {
                    #region UPDATE DISCOUNT
                    tuition.Id                    = id;
                    tuition.TuitionFeeName        = txtTuitionFeeName.Text;
                    tuition.TuitionFeeDescription = txtDesc.Text;
                    tuition.TuitionFeeAmount      = txtAmount.Text;
                    tuition.ReservationFee        = txtReservation.Text;
                    tuition.Dept                  = cmbDept.Text;
                    tuition.Status                = cmbStatus.Text;


                    tuition.Save();
                    Reset();
                    #endregion
                }
                else
                {
                    Reset();
                    return;
                }
            }
            tuition.LoadDataTable(dgvTuitionFee);
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTuition.Text) || string.IsNullOrEmpty(txtTuitionAmount.Text))
            {
                MessageBox.Show("Please fill up the required fields", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else //Save Method
            {
                //pass values
                tuitionFee.TuitionFeeName        = txtTuition.Text;
                tuitionFee.TuitionFeeAmount      = txtTuitionAmount.Text;
                tuitionFee.TuitionFeeDescription = txtTuitionComment.Text;

                // call save method
                tuitionFee.Save();

                //call load record to refresh list
                this.LoadRecords();

                //reset all objects
                this.Reset();
            }
        }