Ejemplo 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);
        }
Ejemplo n.º 2
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtEditFeeAmount.Text) || string.IsNullOrEmpty(txtEditName.Text))
            {
                MessageBox.Show("Please fill up the required fields");
                return;
            }
            else //Save Method
            {
                otherFee.OtherFeeName   = txtEditName.Text;
                otherFee.OtherFeeAmount = Convert.ToDouble(txtFeeAmount.Text);


                otherFee.Id = Int32.Parse(dgvOtherFee.CurrentRow.Cells[0].FormattedValue.ToString());
                otherFee.Update();

                //Load Records
                this.LoadRecords();
            }
        }