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

            //Check Exists
            if (policyOtherGroupHeaderSequenceVM.ProductId == null || policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypeId == null)
            {
                ViewData["Message"] = "You have not provided a Product or a PolicyOtherGroupHeaderServiceTypeId";
                return(View("Error"));
            }

            //Optional
            if (policyOtherGroupHeaderSequenceVM.SubProductId <= 0)
            {
                policyOtherGroupHeaderSequenceVM.SubProductId = 0;
            }

            //Return
            return(RedirectToAction("EditSequence", new {
                PolicyOtherGroupHeaderServiceTypeId = policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypeId,
                ProductId = policyOtherGroupHeaderSequenceVM.ProductId,
                SubProductId = policyOtherGroupHeaderSequenceVM.SubProductId
            }));
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        // GET: /EditSequence
        public ActionResult EditSequence(int policyOtherGroupHeaderServiceTypeId, int productId, int subProductId, int?page)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Check Exists
            if (policyOtherGroupHeaderServiceTypeId <= 0 || productId <= 0)
            {
                ViewData["Message"] = "You have not provided a Product or a PolicyOtherGroupHeaderServiceTypeId";
                return(View("Error"));
            }

            PolicyOtherGroupHeaderSequenceVM policyOtherGroupHeaderSequenceVM = new PolicyOtherGroupHeaderSequenceVM();

            policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypeId = policyOtherGroupHeaderServiceTypeId;
            policyOtherGroupHeaderSequenceVM.ProductId    = productId;
            policyOtherGroupHeaderSequenceVM.SubProductId = subProductId;

            //Get Items
            PolicyOtherGroupHeaderRepository policyOtherGroupHeaderRepository = new PolicyOtherGroupHeaderRepository();

            policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderSequences = policyOtherGroupHeaderRepository.GetPolicyOtherGroupHeaderSequences(
                policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypeId,
                policyOtherGroupHeaderSequenceVM.ProductId,
                policyOtherGroupHeaderSequenceVM.SubProductId,
                page ?? 1
                );

            //Service Types
            PolicyOtherGroupHeaderServiceTypeRepository policyOtherGroupHeaderServiceTypeRepository = new PolicyOtherGroupHeaderServiceTypeRepository();
            PolicyOtherGroupHeaderServiceType           policyOtherGroupHeaderServiceType           = policyOtherGroupHeaderServiceTypeRepository.GetPolicyOtherGroupHeaderServiceType(
                policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceTypeId
                );

            policyOtherGroupHeaderSequenceVM.PolicyOtherGroupHeaderServiceType = policyOtherGroupHeaderServiceType;

            //Products
            ProductRepository productRepository = new ProductRepository();
            Product           product           = productRepository.GetProduct(policyOtherGroupHeaderSequenceVM.ProductId);

            policyOtherGroupHeaderSequenceVM.Product = product;

            //Sub Products
            if (policyOtherGroupHeaderSequenceVM.SubProductId > 0)
            {
                SubProductRepository subProductRepository = new SubProductRepository();
                SubProduct           subProduct           = subProductRepository.GetSubProduct(policyOtherGroupHeaderSequenceVM.SubProductId);
                policyOtherGroupHeaderSequenceVM.SubProduct = subProduct;
            }

            ViewData["Page"] = page ?? 1;

            return(View(policyOtherGroupHeaderSequenceVM));
        }