Exemple #1
0
        // GET: /SelectPolicyOtherGroupHeaderToOrder
        public ActionResult SelectPolicyOtherGroupHeaderToOrder()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            PolicyOtherGroupHeaderSequenceVM policyOtherGroupHeaderSequenceVM = new PolicyOtherGroupHeaderSequenceVM();

            //Service Types
            PolicyOtherGroupHeaderServiceTypeRepository policyOtherGroupHeaderServiceTypeRepository = new PolicyOtherGroupHeaderServiceTypeRepository();
            SelectList policyOtherGroupHeaderServiceTypes = new SelectList(
                policyOtherGroupHeaderServiceTypeRepository.GetAllPolicyOtherGroupHeaderServiceTypes().ToList(),
                "PolicyOtherGroupHeaderServiceTypeId",
                "PolicyOtherGroupHeaderServiceTypeDescription"
                );

            policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypes = policyOtherGroupHeaderServiceTypes;

            //Products
            ProductRepository productRepository = new ProductRepository();
            SelectList        products          = new SelectList(productRepository.GetPolicyOtherGroupHeaderProducts().ToList(), "ProductId", "ProductName");

            policyOtherGroupHeaderSequenceVM.Products = products;

            //Sub Products
            SubProductRepository subProductRepository = new SubProductRepository();
            SelectList           subProducts          = new SelectList(subProductRepository.GetPolicyOtherGroupHeaderSubProducts().ToList(), "SubProductId", "SubProductName");

            policyOtherGroupHeaderSequenceVM.SubProducts = subProducts;

            return(View(policyOtherGroupHeaderSequenceVM));
        }
        public JsonResult ProductSubProducts(int productId)
        {
            SubProductRepository subProductRepository = new SubProductRepository();
            var result = subProductRepository.ListProductSubProducts(productId);

            return(Json(result));
        }
Exemple #3
0
        public ActionResult Delete(int id)
        {
            //Get Item From Database
            PolicyOtherGroupHeader policyOtherGroupHeader = new PolicyOtherGroupHeader();

            policyOtherGroupHeader = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeader(id);

            //Check Exists
            if (policyOtherGroupHeader == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            PolicyOtherGroupHeaderVM policyOtherGroupHeaderVM = new PolicyOtherGroupHeaderVM();

            policyOtherGroupHeaderVM.PolicyOtherGroupHeader = policyOtherGroupHeader;

            //Service Types
            PolicyOtherGroupHeaderServiceTypeRepository policyOtherGroupHeaderServiceTypeRepository = new PolicyOtherGroupHeaderServiceTypeRepository();
            SelectList policyOtherGroupHeaderServiceTypes = new SelectList(
                policyOtherGroupHeaderServiceTypeRepository.GetAllPolicyOtherGroupHeaderServiceTypes().ToList(),
                "PolicyOtherGroupHeaderServiceTypeId",
                "PolicyOtherGroupHeaderServiceTypeDescription",
                policyOtherGroupHeader.PolicyOtherGroupHeaderServiceTypeId
                );

            policyOtherGroupHeaderVM.PolicyOtherGroupHeaderServiceTypes = policyOtherGroupHeaderServiceTypes;

            //Languages
            LanguageRepository languageRepository = new LanguageRepository();
            SelectList         languages          = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName", "en-gb");

            policyOtherGroupHeaderVM.Languages = languages;

            //Products
            ProductRepository productRepository = new ProductRepository();
            SelectList        products          = new SelectList(productRepository.GetPolicyOtherGroupHeaderProducts().ToList(), "ProductId", "ProductName", policyOtherGroupHeader.ProductId);

            policyOtherGroupHeaderVM.Products = products;

            //Sub Products
            SubProductRepository subProductRepository = new SubProductRepository();
            SelectList           subProducts          = new SelectList(subProductRepository.GetPolicyOtherGroupHeaderSubProducts().ToList(), "SubProductId", "SubProductName", policyOtherGroupHeader.SubProductId);

            policyOtherGroupHeaderVM.SubProducts = subProducts;

            return(View(policyOtherGroupHeaderVM));
        }