示例#1
0
        private void frmMaster_Load(object sender, EventArgs e)
        {
            string MaPhongBan;

            MaPhongBan = "";
            BHXH.Data.BHXHEntities ctx = new BHXH.Data.BHXHEntities();
            var queryPhongBan          = from c in ctx.ListPhongBan
                                         //where c.MaTDVanHoa == MaTDVanHoa
                                         select new
            {
                c.MaPhongBan,
                c.TenPhongBan
            };


            foreach (var qPB in queryPhongBan)
            {
                NavBarGroup group = new NavBarGroup();

                group.Caption = qPB.TenPhongBan;
                group.Tag     = qPB.MaPhongBan;
                MaPhongBan    = qPB.MaPhongBan;
                navBarControlDSUser.Groups.Add(group);
                var queryNhanVien = from c in ctx.HrNhanVien
                                    join p in ctx.SysUser on c.MaNhanVien equals p.MaNhanVien

                                    where c.MaPhongBan == MaPhongBan
                                    select new
                {
                    p.UserID,
                    c.TenNhanVien
                };
                foreach (var qNV in queryNhanVien)
                {
                    NavBarItem item = new NavBarItem();
                    item.Caption = qNV.TenNhanVien;
                    item.Tag     = qNV.UserID;
                    group.ItemLinks.Add(item);
                }
            }
        }
示例#2
0
        private void frmHrNhanVien_Load(object sender, EventArgs e)
        {
            //kgghtkhjtkjh fdf
            string MaPhongBan;

            MaPhongBan = "";
            BHXH.Data.BHXHEntities ctx = new BHXH.Data.BHXHEntities();
            var queryPhongBan          = from c in ctx.ListPhongBan
                                         //where c.MaTDVanHoa == MaTDVanHoa
                                         select new
            {
                c.MaPhongBan,
                c.TenPhongBan
            };


            foreach (var qPB in queryPhongBan)
            {
                NavBarGroup group = new NavBarGroup();
                group.Caption = qPB.TenPhongBan;
                group.Tag     = qPB.MaPhongBan;
                MaPhongBan    = qPB.MaPhongBan;
                NavBarControlDSNhanVien.Groups.Add(group);
                var queryNhanVien = from c in ctx.HrNhanVien
                                    where c.MaPhongBan == MaPhongBan
                                    select new
                {
                    c.MaNhanVien,
                    c.TenNhanVien
                };
                foreach (var qNV in queryNhanVien)
                {
                    NavBarItem item = new NavBarItem();
                    item.Caption = qNV.TenNhanVien;
                    item.Tag     = qNV.MaNhanVien;
                    group.ItemLinks.Add(item);
                }
            }
        }