private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectData()) { Group group = new Group(); group.GroupCode = txtGroupCode.Text; group.GroupName = txtGroupName.Text; group.DivisionCode = cmbDivision.SelectedValue.ToString(); if (group.Insert() > 0) { _frmGroupList.BindGroupList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { InitializeFields(); } else { this.Close(); } } else { MessageBox.Show(clsMessageBox.MessageBoxErrorAdd, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnSave_Click(object sender, EventArgs e) { int intResults = 0; using (Group group = new Group(_strGroupCode)) { group.GroupName = txtGroupName.Text; group.DivisionCode = cmbDivision.SelectedValue.ToString(); intResults = group.Update(); } if (intResults > 0) { _frmGroupList.BindGroupList(); this.Close(); } else { MessageBox.Show(clsMessageBox.MessageBoxErrorUpdate, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error); } }