private void btnCommit_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtEditStrand.Text) || string.IsNullOrEmpty(txtEditDesc.Text)) { MessageBox.Show("Please fill up the required fields"); return; } else //Save Method { strand.StrandName = txtEditStrand.Text; strand.StrandDesc = txtEditDesc.Text; strand.Id = Int32.Parse(dgvStrands.CurrentRow.Cells[0].FormattedValue.ToString()); strand.Update(); //Load Records this.LoadRecords(); } }
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); }