private void butOK_Click(object sender, EventArgs e) { if (textDescription.Text == "") { MessageBox.Show(this, "Please enter a description."); return; } _groupCur.Description = textDescription.Text; try { if (_groupCur.IsNew) { long userGroupNum = UserGroups.Insert(_groupCur); _groupCur.UserGroupNumCEMT = userGroupNum; UserGroups.Update(_groupCur); //Doing this so we don't have to make another version of Insert } else { UserGroups.Update(_groupCur); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } Cache.Refresh(InvalidType.Security); DialogResult = DialogResult.OK; }
///<summary>Inserts the new user group, refreshes the group attaches cache and then returns UserGroupNum</summary> public static long CreateUserGroup(string description) { UserGroup newGroup = new UserGroup(); newGroup.Description = description; newGroup.UserGroupNum = UserGroups.Insert(newGroup); UserGroups.RefreshCache(); return(newGroup.UserGroupNum); }