Exemplo n.º 1
0
        public IList <DefaultModule> GetDefaultModules(License license, bool?moduleStatus = null)
        {
            var modules = moduleRepository.GetByLicenseId(license.Id, moduleStatus);

            modules = modules.Where(m => !m.IsLocked).ToList();

            var defaultModules = modules.Select(module =>
            {
                var m   = defaultModuleRepository.GetById(module.DefaultModuleId);
                m.Price = module.Price;
                return(m);
            }).ToList();

            return(defaultModules);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> licenceInfo()
        {
            var user = userRepository.GetById(User.Identity.GetUserId <int>());

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var companyId       = user.CompanyId;
            var company         = companyRepository.GetById(companyId);
            var licenseId       = company.LicenseId;
            var license         = licenseRepository.GetById(licenseId);
            var disabledModules = moduleRepository.GetByLicenseId(licenseId, false);
            var defaultModules  = disabledModules.Select(module => defaultModuleRepository.GetById(module.Id)).ToList();

            var model = new EditLicenseModules()
            {
                LicenseName = defaultLicenseRepository.GetById(license.DefaultLicenseId).Name,
                LicenseCode = license.LicenseCode,
                Modules     = defaultModules
            };


            return(View(model));
        }
Exemplo n.º 3
0
        public ActionResult EditModule(int id)
        {
            var             module         = defaultModuleRepository.GetById(id);
            var             moduleLicenses = defaultLicenseRepository.GetByModuleId(module.Id);
            var             allLicenses    = defaultLicenseRepository.GetAll();
            EditModuleModel editModule     = new EditModuleModel()
            {
                Id             = module.Id,
                Name           = module.Name,
                Description    = module.Description,
                Price          = module.Price,
                ModuleLicenses = moduleLicenses.ToList(),
                AllLicenses    = allLicenses.ToList()
            };

            return(View(editModule));
        }
Exemplo n.º 4
0
        public UserInfoViewModel GetUserInfo(int id)
        {
            var customer = userRepository.GetById(id);
            var company  = GetById(customer.CompanyId);
            var license  = licenseRepository.GetById(company.LicenseId);
            UserInfoViewModel customerInfo = new UserInfoViewModel()
            {
                Id        = customer.Id,
                FirstName = customer.FirstName,
                LastName  = customer.LastName,
                Company   = company,
                License   = license,
                Modules   = moduleRepository.GetByLicenseId(license.Id).Select(m => new Models.ViewModels.License.ModuleInfo()
                {
                    Id       = m.Id,
                    Name     = defaultModuleRepository.GetById(m.DefaultModuleId).Name,
                    Price    = m.Price,
                    isLocked = m.IsLocked
                }).ToList()
            };

            return(customerInfo);
        }