protected override void btnSave_Click(object sender, EventArgs e) { long r = Convert.ToInt64(id); List <cmsUserPurview> ls = new List <cmsUserPurview>(); string[] c_vals = hidCatalog.Value.Replace(",,", ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] s_vals = hidMenu.Value.Replace(",,", ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < c_vals.Length; i++) { cmsUserPurview rp = new cmsUserPurview(); rp.UserId = r; rp.NodeCode = c_vals[i]; rp.Type = 0; ls.Add(rp); } for (int i = 0; i < s_vals.Length; i++) { cmsUserPurview rp = new cmsUserPurview(); rp.UserId = r; rp.NodeCode = s_vals[i]; rp.Type = 1; ls.Add(rp); } try { r = ups.Add(r, ls); ScriptUtil.AlertAndCloseDialog("权限分配成功!"); } catch (Exception ex) { ScriptUtil.Alert("服务器发生未知错误!"); Logger.Error(ex.Message); } }
protected override void btnSave_Click(object sender, EventArgs e) { long r = Convert.ToInt64(id); List<cmsUserPurview> ls = new List<cmsUserPurview>(); string[] c_vals = hidCatalog.Value.Replace(",,", ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] s_vals = hidMenu.Value.Replace(",,", ",").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < c_vals.Length; i++) { cmsUserPurview rp = new cmsUserPurview(); rp.UserId = r; rp.NodeCode = c_vals[i]; rp.Type = 0; ls.Add(rp); } for (int i = 0; i < s_vals.Length; i++) { cmsUserPurview rp = new cmsUserPurview(); rp.UserId = r; rp.NodeCode = s_vals[i]; rp.Type = 1; ls.Add(rp); } try { r = ups.Add(r, ls); ScriptUtil.AlertAndCloseDialog("权限分配成功!"); } catch(Exception ex) { ScriptUtil.Alert("服务器发生未知错误!"); Logger.Error(ex.Message); } }