Example #1
0
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Get Item From Database
            PointOfSaleFeeLoad pointOfSaleFeeLoad = new PointOfSaleFeeLoad();

            pointOfSaleFeeLoad = pointOfSaleFeeLoadRepository.GetGroup(id);

            //Check Exists
            if (pointOfSaleFeeLoad == 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"));
            }

            PointOfSaleFeeLoadVM pointOfSaleFeeLoadVM = new PointOfSaleFeeLoadVM();

            pointOfSaleFeeLoadRepository.EditGroupForDisplay(pointOfSaleFeeLoad);

            pointOfSaleFeeLoadVM.PointOfSaleFeeLoad = pointOfSaleFeeLoad;

            //FeeLoadDescriptionTypeCodes
            FeeLoadDescriptionTypeCodeRepository feeLoadDescriptionTypeCodeRepository = new FeeLoadDescriptionTypeCodeRepository();
            SelectList feeLoadDescriptionTypeCodes = new SelectList(feeLoadDescriptionTypeCodeRepository.GetAllFeeLoadDescriptionTypeCodes().ToList(), "FeeLoadDescriptionTypeCode", "FeeLoadDescriptionTypeCode", pointOfSaleFeeLoad.FeeLoadDescriptionTypeCode);

            pointOfSaleFeeLoadVM.FeeLoadDescriptionTypeCodes = feeLoadDescriptionTypeCodes;

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

            pointOfSaleFeeLoadVM.Products = products;

            //TravelIndicators
            TravelIndicatorRepository TravelIndicatorRepository = new TravelIndicatorRepository();
            SelectList travelIndicators = new SelectList(TravelIndicatorRepository.GetAllTravelIndicators().OrderBy(x => x.TravelIndicatorDescription).ToList(), "TravelIndicator1", "TravelIndicatorDescription", pointOfSaleFeeLoad.TravelIndicator);

            pointOfSaleFeeLoadVM.TravelIndicators = travelIndicators;

            //Currencies
            CurrencyRepository currencyRepository = new CurrencyRepository();
            SelectList         currencies         = new SelectList(currencyRepository.GetAllCurrencies().ToList(), "CurrencyCode", "Name", pointOfSaleFeeLoad.FeeLoadCurrencyCode);

            pointOfSaleFeeLoadVM.Currencies = currencies;

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

            PointOfSaleFeeLoadVM pointOfSaleFeeLoadVM = new PointOfSaleFeeLoadVM();

            //AgentInitiatedFlag Default Checked
            PointOfSaleFeeLoad pointOfSaleFeeLoad = new PointOfSaleFeeLoad();

            pointOfSaleFeeLoad.AgentInitiatedFlag = true;

            pointOfSaleFeeLoadVM.PointOfSaleFeeLoad = pointOfSaleFeeLoad;

            //FeeLoadDescriptionTypeCodes
            FeeLoadDescriptionTypeCodeRepository feeLoadDescriptionTypeCodeRepository = new FeeLoadDescriptionTypeCodeRepository();
            SelectList feeLoadDescriptionTypeCodes = new SelectList(feeLoadDescriptionTypeCodeRepository.GetAllFeeLoadDescriptionTypeCodes().ToList(), "FeeLoadDescriptionTypeCode", "FeeLoadDescriptionTypeCode");

            pointOfSaleFeeLoadVM.FeeLoadDescriptionTypeCodes = feeLoadDescriptionTypeCodes;

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

            pointOfSaleFeeLoadVM.Products = products;

            //TravelIndicators
            TravelIndicatorRepository TravelIndicatorRepository = new TravelIndicatorRepository();
            SelectList travelIndicators = new SelectList(TravelIndicatorRepository.GetAllTravelIndicators().OrderBy(x => x.TravelIndicatorDescription).ToList(), "TravelIndicator1", "TravelIndicatorDescription");

            pointOfSaleFeeLoadVM.TravelIndicators = travelIndicators;

            //Currencies
            CurrencyRepository currencyRepository = new CurrencyRepository();
            SelectList         currencies         = new SelectList(currencyRepository.GetAllCurrencies().ToList(), "CurrencyCode", "Name");

            pointOfSaleFeeLoadVM.Currencies = currencies;

            return(View(pointOfSaleFeeLoadVM));
        }