private void f_Load_Quyen() { ttStatus.Text = ""; try { string aid = "", aloai = "N"; try { aid = treeView1.SelectedNode.Tag.ToString().Split(':')[treeView1.SelectedNode.Parent == null ? 0 : 1]; aloai = treeView1.SelectedNode.Parent == null ? "N" : "U"; } catch { aid = ""; } if (aloai == "N") { m_dsquyen = m_v.f_get_v_phanquyennhom(aid); } else { m_dsquyen = m_v.f_get_v_phanquyen(aid); } foreach (TreeNode anode in treeView2.Nodes) { anode.Checked = f_Chon(anode.Tag.ToString()); try { if (m_dsquyen.Tables[0].Select("menuname='" + anode.Tag.ToString() + "'").Length <= 0 && anode.Nodes.Count <= 0) { DataRow r = m_dsquyen.Tables[0].NewRow(); r[0] = 0; r["menuname"] = anode.Tag.ToString(); r["chon"] = 0; r["chitiet"] = "000" + r["chon"].ToString() + "00"; m_dsquyen.Tables[0].Rows.Add(r); } } catch { } if (anode.Nodes.Count > 0) { if (m_dsquyen.Tables[0].Select("menuname='" + anode.Tag.ToString() + "'").Length > 0) { DataRow r1 = m_dsquyen.Tables[0].Select("menuname='" + anode.Tag.ToString() + "'")[0]; m_dsquyen.Tables[0].Rows.Remove(r1); } f_Set_Quyen(anode); } } f_Set_Quyen_Chitiet(); } catch { } }