private List <RightViewModel> GetRightDataList()
        {
            var dataList = _rightRepository.GetAll().ToList().Select(c => new TblRight
            {
                RightId       = c.RightId,
                RightName     = c.RightName,
                RightTitle    = c.RightTitle,
                Description   = c.Description,
                ApplicationId = c.ApplicationId,
                ModuleId      = c.ModuleId
            });

            var viewModels = dataList.Select(
                md =>
            {
                var singleOrDefaultApplication = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId);
                return(singleOrDefaultApplication != null ? new RightViewModel
                {
                    RightId = md.RightId,
                    RightName = md.RightName,
                    RightTitle = md.RightTitle,
                    Description = md.Description,
                    ApplicationId = Convert.ToInt32(md.ApplicationId),
                    ApplicationName = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId).ApplicationName,
                    ModuleId = Convert.ToInt32(md.ModuleId),
                    ModuleName = _moduleRepository.GetAll().SingleOrDefault(x => x.ModuleId == md.ModuleId).ModuleName,

                    ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.RightId.ToString())
                } : null);
            }).OrderBy(o => o.RightName).ToList();

            return(viewModels);
        }
        private List <ModuleViewModel> GetModuleDataList()
        {
            var dataList = _moduleRepository.GetAll().ToList().Select(c => new TblModule {
                ModuleId = c.ModuleId, ModuleName = c.ModuleName, Description = c.Description, ModuleTitle = c.ModuleTitle, ApplicationId = c.ApplicationId
            });

            var viewModels = dataList.Select(
                md =>
            {
                var singleOrDefault = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId);
                return(singleOrDefault != null ? new ModuleViewModel
                {
                    ModuleId = md.ModuleId,
                    ModuleName = md.ModuleName,
                    ModuleTitle = md.ModuleTitle,
                    Description = md.Description,
                    ApplicationId = md.ApplicationId,
                    ApplicationName = singleOrDefault.ApplicationName,

                    ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.ModuleId.ToString())
                } : null);
            }).OrderBy(o => o.ModuleName).ToList();

            return(viewModels);
        }
Example #3
0
        private List <UserViewModel> GetUserDataList()
        {
            var dataList = _userRepository.GetAll().ToList().Select(c => new TblUser
            {
                UserId        = c.UserId,
                FirstName     = c.FirstName,
                LastName      = c.LastName,
                UserName      = c.UserName,
                LoginId       = c.LoginId,
                EmailAddress  = c.EmailAddress,
                Phone         = c.Phone,
                Password      = c.Password,
                LastLoginDate = c.LastLoginDate,
                Status        = c.Status,
                ChangePasswordAtFirstLogin = c.ChangePasswordAtFirstLogin,
                Comment       = c.Comment,
                GroupId       = c.GroupId,
                ApplicationId = c.ApplicationId,
                EmployeeId    = c.EmployeeId
            });

            var viewModels = dataList.Select(
                md =>
            {
                var singleOrDefaultApplication = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId);
                return(singleOrDefaultApplication != null ? new UserViewModel
                {
                    UserId = md.UserId,
                    FirstName = md.FirstName,
                    LastName = md.LastName,
                    UserName = md.UserName,
                    LoginId = md.LoginId,
                    EmailAddress = md.EmailAddress,
                    Phone = md.Phone,
                    Password = md.Password,
                    LastLoginDate = Convert.ToDateTime(md.LastLoginDate),
                    Status = md.Status,
                    ChangePasswordAtFirstLogin = Convert.ToBoolean(md.ChangePasswordAtFirstLogin),
                    Comment = md.Comment,

                    GroupId = Convert.ToInt32(md.GroupId),
                    GroupName = _groupRepository.GetAll().SingleOrDefault(x => x.GroupId == md.GroupId).GroupName,

                    ApplicationId = Convert.ToInt32(md.ApplicationId),
                    ApplicationName = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId).ApplicationName,

                    EmployeeId = Convert.ToInt32(md.EmployeeId),
                    EmployeeName = _employeeRepository.GetAll().SingleOrDefault(x => x.EmployeeId == md.EmployeeId).EmployeeName,

                    ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.UserId.ToString())
                } : null);
            }).OrderBy(o => o.UserName).ToList();

            return(viewModels);
        }
Example #4
0
        private List <CompanyViewModel> GetCompanyDataList()
        {
            var dataList = _companyRepository.GetAll().ToList().Select(c => new TblCompany {
                CompanyId = c.CompanyId, CompanyName = c.CompanyName, Address = c.Address
            });

            var viewModels = dataList.Select(
                md => new CompanyViewModel
            {
                CompanyId   = md.CompanyId,
                CompanyName = md.CompanyName,
                Address     = md.Address,

                ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.CompanyId.ToString())
            }).OrderBy(o => o.CompanyName).ToList();

            return(viewModels);
        }
Example #5
0
        private List <ApplicationViewModel> GetApplicationDataList()
        {
            var dataList = _applicationRepository.GetAll().ToList().Select(c => new TblApplication {
                ApplicationId = c.ApplicationId, ApplicationName = c.ApplicationName, Description = c.Description, ApplicationTitle = c.ApplicationTitle
            });

            var viewModels = dataList.Select(
                md => new ApplicationViewModel
            {
                ApplicationId    = md.ApplicationId,
                ApplicationName  = md.ApplicationName,
                ApplicationTitle = md.ApplicationTitle,
                Description      = md.Description,

                ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.ApplicationId.ToString())
            }).OrderBy(o => o.ApplicationName).ToList();

            return(viewModels);
        }
        private List <MenuViewModel> GetMenuDataList()
        {
            var dataList = _menuRepository.GetAll().ToList().Select(c => new TblMenu
            {
                MenuId         = c.MenuId,
                MenuName       = c.MenuName,
                MenuCaption    = c.MenuCaption,
                MenuCaptionBng = c.MenuCaptionBng,
                PageUrl        = c.PageUrl,
                SerialNo       = c.SerialNo,
                OrderNo        = c.OrderNo,
                ParentMenuId   = c.ParentMenuId,
                ApplicationId  = c.ApplicationId,
                ModuleId       = c.ModuleId
            });

            var viewModels = dataList.Select(
                md =>
            {
                var singleOrDefaultApplication = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId);
                return(singleOrDefaultApplication != null ? new MenuViewModel
                {
                    MenuId = md.MenuId,
                    MenuName = md.MenuName,
                    MenuCaption = md.MenuCaption,
                    MenuCaptionBng = md.MenuCaptionBng,
                    PageUrl = md.PageUrl,
                    SerialNo = Convert.ToInt32(md.SerialNo),
                    OrderNo = Convert.ToInt32(md.OrderNo),
                    ParentMenuId = Convert.ToInt32(md.ParentMenuId),
                    ParentMenuName = _menuRepository.GetAll().SingleOrDefault(x => x.MenuId == md.MenuId).MenuName,
                    ApplicationId = md.ApplicationId,
                    ApplicationName = _applicationRepository.GetAll().SingleOrDefault(x => x.ApplicationId == md.ApplicationId).ApplicationName,
                    ModuleId = md.ModuleId,
                    ModuleName = _moduleRepository.GetAll().SingleOrDefault(x => x.ModuleId == md.ModuleId).ModuleName,

                    ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.MenuId.ToString())
                } : null);
            }).OrderBy(o => o.MenuName).ToList();

            return(viewModels);
        }
Example #7
0
        private List <GroupViewModel> GetUserGroupDataList()
        {
            var dataList = _groupRepository.GetAll().ToList().Select(c => new TblGroup
            {
                GroupId     = c.GroupId,
                GroupName   = c.GroupName,
                Description = c.Description,
                //ApplicationId = c.ApplicationId,
                //ModuleId = c.ModuleId
            });

            var viewModels = dataList.Select(
                md => new GroupViewModel
            {
                GroupId     = md.GroupId,
                GroupName   = md.GroupName,
                Description = md.Description,

                ActionLink = KendoUiHelper.KendoUIGridActionLinkGenerate(md.GroupId.ToString())
            }
                ).OrderBy(o => o.GroupName).ToList();

            return(viewModels);
        }