private void btnSubmit_Click(object sender, EventArgs e) { BPCompanyGroups groups = new BPCompanyGroups(); BECompanyGroups.tbl_CompanyGroupsRow group; DSCompanyGroups = groups.SelectCompanyGroupsByID(CompanyGroupID); group = DSCompanyGroups.tbl_CompanyGroups.FindByCompanyGroupID(CompanyGroupID); if (CompanyGroupID == 0) { group = DSCompanyGroups.tbl_CompanyGroups.Newtbl_CompanyGroupsRow(); group.DateCreated = DateTime.Now; group.ModifiedByAdminID = 1; } group.CompanyGroupName = txtGroupName.Text; group.CompanyGroupDescription = txtGroupDescription.Text; group.CompanyGroupActive = chkActive.Checked; group.DateModified = DateTime.Now; if(CompanyGroupID == 0) { DSCompanyGroups.tbl_CompanyGroups.Addtbl_CompanyGroupsRow(group); } groups.Update(DSCompanyGroups); if (_HasChangedUsers ) { groups.UpdateCompanyUsers(group.CompanyGroupID, UserGroupsList); } //Cache.Remove("dsAdmins"); if (CompanyGroupID == 0) { Response.Redirect("EditCompanyPermissionGroups.aspx?CompanyGroupID=" + group.CompanyGroupID); } else { Response.Redirect("BrowseCompanyPermissionGroups.aspx"); } }
private void ShowGroupUsers() { pnlUsers.Visible = true; if (_HasChangedUsers) { BPCompanyGroups groups = new BPCompanyGroups(); BECompanyGroups.tbl_CompanyGroupsRow group; DSCompanyGroups = groups.SelectCompanyGroupsByID(CompanyGroupID); group = DSCompanyGroups.tbl_CompanyGroups.FindByCompanyGroupID(CompanyGroupID); groups.Update(DSCompanyGroups); if (_HasChangedUsers) { groups.UpdateCompanyUsers(group.CompanyGroupID, UserGroupsList); } } BPCompanyUsers bp = new BPCompanyUsers(); DSCompanyUsers = bp.SelectByCompanyGroupID(CompanyGroupID); dgUsers.DataBind(); }