Beispiel #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (btnAdd.Text == "&Update")
     {
         util.ValidateTextBox2(txtStrandName, txtDesc);// Validation before Updating
         if (util.readyToSave == 1)
         {
             #region UPDATE DISCOUNT
             strand.Id         = id;
             strand.StrandDesc = txtDesc.Text;
             strand.StrandName = txtStrandName.Text;
             strand.Update();
             Reset();
             #endregion
         }
         else
         {
             Reset();
             return;
         }
     }
     else
     {
         util.ValidateTextBox2(txtStrandName, txtDesc);// Validation before saving
         if (util.readyToSave == 1)
         {
             #region UPDATE DISCOUNT
             strand.Id         = id;
             strand.StrandDesc = txtDesc.Text;
             strand.StrandName = txtStrandName.Text;
             strand.Save();
             Reset();
             #endregion
         }
         else
         {
             Reset();
             return;
         }
     }
     strand.LoadDataTable(dgvStrand);
 }
Beispiel #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtStrand.Text) || string.IsNullOrEmpty(txtDesc.Text))
            {
                MessageBox.Show("Please fill up the required fields", "System Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else //Save Method
            {
                //pass values
                strand.StrandName = txtStrand.Text;
                strand.StrandDesc = txtDesc.Text;

                // call save method
                strand.Save();

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

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