Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text == "&Update")
            {
                util.ValidateTextBox2(txtAmount, txtOtherFeeName);// Validation before Updating
                util.ValidateCombobox(cmbStrand);

                if (util.readyToSave == 1)
                {
                    #region UPDATE DISCOUNT
                    otherFee.Id             = id;
                    otherFee.OtherFeeName   = txtOtherFeeName.Text;
                    otherFee.OtherFeeAmount = Convert.ToDouble(txtAmount.Text);
                    otherFee.Strand         = cmbStrand.Text;

                    otherFee.Update();
                    Reset();
                    #endregion
                }
                else
                {
                    Reset();
                    return;
                }
            }
            else
            {
                util.ValidateTextBox2(txtAmount, txtOtherFeeName);// Validation before saving
                util.ValidateCombobox(cmbStrand);

                if (util.readyToSave == 1)
                {
                    #region SAVE DISCOUNT
                    otherFee.Id             = id;
                    otherFee.OtherFeeName   = txtOtherFeeName.Text;
                    otherFee.OtherFeeAmount = Convert.ToDouble(txtAmount.Text);
                    otherFee.Strand         = cmbStrand.Text;

                    otherFee.Save();
                    Reset();
                    #endregion
                }
                else
                {
                    Reset();
                    return;
                }
            }

            otherFee.LoadDataTable(dgvOtherFee);
        }
Esempio n. 2
0
        }//show edit OF window

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFeeName.Text) || string.IsNullOrEmpty(txtFeeAmount.Text))
            {
                MessageBox.Show("Please fill up the required fields", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else //Save Method
            {
                //pass values
                otherFee.OtherFeeName   = txtFeeName.Text;
                otherFee.OtherFeeAmount = Convert.ToDouble(txtFeeAmount.Text);

                // call save method
                otherFee.Save();

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

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