コード例 #1
0
ファイル: usrGroup.cs プロジェクト: WendyAnne/Hotel-software
 private void UpdateModule()
 {
     int _groupID = (int)grdvGroup.GetRowCellValue(grdvGroup.FocusedRowHandle, colGroupID);
     busGroupModule = new BUS.BUStblGROUPMODULE();
     var _oldModule = busGroupModule.LayTatCatblGROUPMODULE().Where(a => a.GROUPID == _groupID);
     var _newModule = GetGroupModule(_groupID);
     foreach (var a in _oldModule)
     {
         busGroupModule.XoatblGROUPMODULE(a.MODULEID,a.GROUPID);
     }
     foreach (var b in _newModule)
     {
         busGroupModule.ThemtblGROUPMODULE(b);
     }
 }
コード例 #2
0
ファイル: frmLogin.cs プロジェクト: WendyAnne/Hotel-software
        //lấy quyền sử dụng các control trong từng module cho người dùng, bao gồm cả việc ng sd thuộc nhiều nhóm sử dụng
        private void GetModuleOfGroupsByUserID(int _userID)
        {
            busGroupUser = new BUS.BUStblGROUPUSER();

            var _GroupUser = busGroupUser.LayTatCatblGROUPUSER().Where(a => a.USERID == _userID);
            List<DTO.DTOtblGROUPMODULE> _lstGroupModule = new List<DTO.DTOtblGROUPMODULE>();
            foreach (var a in _GroupUser)
            {
                busGroupModule = new BUS.BUStblGROUPMODULE();
                var _lstModule = busGroupModule.LayTatCatblGROUPMODULE().Where(p => p.GROUPID == a.GROUPID).ToList();
                foreach (var b in _lstModule)
                {
                    _lstGroupModule.Add(b);
                }
            }
            //var _IsUsedFunc= _lstGroupFunction.GroupBy(a => a.FUNCTIONID).ToList();
            var _IsUsedModule = _lstGroupModule.Where(a => a.VALUE == true).GroupBy(a => a.MODULEID, (key, group) => group.First()).ToList();
            foreach (var a in _IsUsedModule)
            {
                switch (a.MODULEID)
                {
                    #region cấp quyền sử dụng các chức năng
                    case 1: Modules.Modules.DatPhong = BarItemVisibility.Always; break;
                    case 2: Modules.Modules.DSPhong = BarItemVisibility.Always; break;
                    case 3: Modules.Modules.KP_LP = BarItemVisibility.Always; break;
                    case 4: Modules.Modules.Gia = BarItemVisibility.Always; break;
                    case 5: Modules.Modules.TinhTien = BarItemVisibility.Always; break;
                    case 6: Modules.Modules.HoaDon = BarItemVisibility.Always; break;
                    case 7: Modules.Modules.PT_CK = BarItemVisibility.Always; break;
                    case 8: Modules.Modules.KhachHang = BarItemVisibility.Always; break;
                    case 9: Modules.Modules.NhanVien = BarItemVisibility.Always; break;
                    case 10: Modules.Modules.ChucVu= BarItemVisibility.Always; break;
                    case 11: Modules.Modules.DichVu = BarItemVisibility.Always; break;
                    case 12: Modules.Modules.ThietBi= BarItemVisibility.Always; break;
                    case 13: Modules.Modules.QLUsers = BarItemVisibility.Always; break;
                    case 14: Modules.Modules.QLGroups = BarItemVisibility.Always; break;
                    case 15: Modules.Modules.BaoCao = BarItemVisibility.Always; break;
                    #endregion
                }
            }
        }
コード例 #3
0
ファイル: usrGroup.cs プロジェクト: WendyAnne/Hotel-software
        private void LoadModule()
        {
            if (grdvGroup.GetRowCellValue(grdvGroup.FocusedRowHandle, colGroupID) != null)
            {

                busGroupModule = new BUS.BUStblGROUPMODULE();
                busModule = new BUS.BUStblMODULE();
                int _groupID = (int)grdvGroup.GetRowCellValue(grdvGroup.FocusedRowHandle, colGroupID);
                var _Module = from a in busGroupModule.LayTatCatblGROUPMODULE()
                             join b in busModule.LayTatCatblMODULE() on a.MODULEID equals b.MODULEID
                             where a.GROUPID == _groupID
                             orderby a.MODULEID ascending
                             select new
                             {
                                 ModuleID = a.MODULEID,
                                 ModuleName = b.MODULENAME,
                                 Value = a.VALUE
                             };
                DataTable dt = clsXuLy.ConvertDataTable(_Module.ToList());
                grdModule.DataSource = dt;
            }
            else
                grdModule.DataSource = null;
        }