protected void btnSaveQuyen_Click(object sender, EventArgs e) { Int32 idNhomQuyen = Int32.Parse(RadTreeViewNhomQuyen.SelectedNode.Value); Int32 idChucNang = Int32.Parse(RadTreeViewChucNang.SelectedNode.Value); _entities.DeletePhanQuyenByIDNhomQuyenIDChucNang(idNhomQuyen, idChucNang); foreach (ListItem i in cblQuyen.Items) { if (i.Selected) { Aits_Hrm.Model.PhanQuyen pq = new Aits_Hrm.Model.PhanQuyen(); pq.IDNhomQuyen = Int32.Parse(RadTreeViewNhomQuyen.SelectedNode.Value); pq.IDChucNang = Int32.Parse(RadTreeViewChucNang.SelectedNode.Value); pq.IDQuyen = Int32.Parse(i.Value); pq.NguoiCapNhat = (int)Session["userID"]; pq.NguoiTao = (int)Session["userID"]; pq.NgayCapNhat = DateTime.Now; pq.NgayTao = DateTime.Now; _entities.AddToPhanQuyens(pq); } _entities.SaveChanges(); } }