protected void btnSave_Click(object sender, EventArgs e) { List <int> softIds = new List <int>(); foreach (ListItem item in cbkListSoft.Items) { if (item.Selected) { softIds.Add(int.Parse(item.Value)); } } foreach (ListItem item in cbkListSoftout.Items) { if (item.Selected) { softIds.Add(int.Parse(item.Value)); } } List <int> projectSources = new List <int>(); foreach (ListItem item in cbkProjectSource.Items) { if (item.Selected) { projectSources.Add(int.Parse(item.Value)); } } List <int> resIds = new List <int>(); if (txtResIdList.Text.Length > 0) { string[] resids = txtResIdList.Text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string resid in resids) { int id = 0; if (int.TryParse(resid.Trim(), out id)) { resIds.Add(id); } } } URRightsService rightService = new URRightsService(); if (UserID > 0) { rightService.AddUserSoftRights(UserID, softIds); rightService.AddUserProjectSourceRights(UserID, projectSources); if (loginService.LoginUser.AccountType != UserTypeOptions.ProductAdmin) { rightService.AddUserResRights(UserID, resIds); } } else if (RoleID > 0) { rightService.AddRoleSoftRights(RoleID, softIds); rightService.AddRoleProjectSourceRights(RoleID, projectSources); } Response.Redirect(ReturnUrl); }