示例#1
0
        // GET: Create A Single MerchantFee
        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"));
            }

            MerchantFeeVM merchantFeeVM = new MerchantFeeVM();

            MerchantFee merchantFee = new MerchantFee();

            merchantFeeVM.MerchantFee = merchantFee;

            CountryRepository countryRepository = new CountryRepository();

            merchantFeeVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName");

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            merchantFeeVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");

            ProductRepository productRepository = new ProductRepository();

            merchantFeeVM.Products = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName");

            return(View(merchantFeeVM));
        }
        public ActionResult Delete(int id, string ctu)
        {
            //Check if changes are allowed to Cards for this Database
            CreditCardBehavior creditCardBehavior = new CreditCardBehavior();

            creditCardBehavior = creditCardRepository.GetCreditCardBehavior();
            if (!creditCardBehavior.CanChangeCreditCardsFlag)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("Error"));
            }

            //Check Exists
            CreditCard creditCard = new CreditCard();

            creditCard = creditCardRepository.GetCreditCard(id, false);
            creditCard.ValidateCreditCardNumber = true;
            if (creditCard == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientTopUnitCreditCards(ctu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientTopUnitCreditCardVM clientTopUnitCreditCardVM = new ClientTopUnitCreditCardVM();

            clientTopUnitCreditCardVM.ClientTopUnit = clientTopUnitRepository.GetClientTopUnit(ctu);

            creditCardRepository.EditForDisplay(creditCard);
            clientTopUnitCreditCardVM.CreditCard = creditCard;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            clientTopUnitCreditCardVM.CreditCardTypes = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription", creditCard.CreditCardTypeId);

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            clientTopUnitCreditCardVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", creditCard.CreditCardVendorCode);

            //Log View Of Credit Card
            LogRepository logRepository = new LogRepository();

            logRepository.LogApplicationUsage(8, "", "", "", creditCard.CreditCardToken, creditCard.CreditCardTypeId, true);

            //Show View Form
            return(View(clientTopUnitCreditCardVM));
        }
        // GET: /Create/
        public ActionResult Create(string csu, string tt)
        {
            //Check Exists
            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);
            if (clientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(View("RecordDoesNotExistError"));
            }

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnitCreditCards(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientSubUnitTravelerTypeCreditCardVM clientSubUnitTravelerTypeCreditCardVM = new ClientSubUnitTravelerTypeCreditCardVM();

            clientSubUnitTravelerTypeCreditCardVM.TravelerType  = travelerTypeRepository.GetTravelerType(tt);
            clientSubUnitTravelerTypeCreditCardVM.ClientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            CreditCard creditCard = new CreditCard();

            creditCard.ClientTopUnitName                     = clientSubUnit.ClientTopUnit.ClientTopUnitName;
            creditCard.CanHaveRealCreditCardsFlag            = creditCardRepository.GetCreditCardBehavior().CanHaveRealCreditCardsFlag;
            creditCard.WarningShownFlag                      = !creditCard.CanHaveRealCreditCardsFlag;
            clientSubUnitTravelerTypeCreditCardVM.CreditCard = creditCard;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            clientSubUnitTravelerTypeCreditCardVM.CreditCardTypes = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription");

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            clientSubUnitTravelerTypeCreditCardVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");

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

            ViewData["ProductList"] = products;

            //Show Create Form
            return(View(clientSubUnitTravelerTypeCreditCardVM));
        }
        // GET: /Create/
        public ActionResult Create(string ctu)
        {
            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(ctu);

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

            //Set Access Rights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToClientTopUnitCreditCards(ctu))
            {
                ViewData["Access"] = "WriteAccess";
            }

            ClientTopUnitCreditCardVM clientTopUnitCreditCardVM = new ClientTopUnitCreditCardVM();

            clientTopUnitCreditCardVM.ClientTopUnit = clientTopUnit;

            CreditCard creditCard = new CreditCard();

            creditCard.ClientTopUnitName          = clientTopUnit.ClientTopUnitName;
            creditCard.CanHaveRealCreditCardsFlag = creditCardRepository.GetCreditCardBehavior().CanHaveRealCreditCardsFlag;
            creditCard.WarningShownFlag           = !creditCard.CanHaveRealCreditCardsFlag;
            clientTopUnitCreditCardVM.CreditCard  = creditCard;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            clientTopUnitCreditCardVM.CreditCardTypes = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription");

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            clientTopUnitCreditCardVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");

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

            ViewData["ProductList"] = products;

            //Show Create Form
            return(View(clientTopUnitCreditCardVM));
        }
        //// 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");
        //	}

        //	CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();
        //	ViewData["CreditCardTypeList"] = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription");

        //	CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
        //	SelectList creditCardVendorsList = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");
        //	ViewData["CreditCardVendors"] = creditCardVendorsList;

        //	TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
        //	SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");
        //	ViewData["HierarchyTypes"] = hierarchyTypesList;

        //	CreditCard creditCard = new CreditCard();
        //	creditCard.CanHaveRealCreditCardsFlag = creditCardRepository.GetCreditCardBehavior().CanHaveRealCreditCardsFlag;
        //	creditCard.WarningShownFlag = !creditCard.CanHaveRealCreditCardsFlag;

        //	return View(creditCard);
        //}

        //// POST: /Create
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create(CreditCard group)
        //{
        //	//Check Access Rights to Domain
        //	if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
        //	{
        //		ViewData["Message"] = "You do not have access to this item";
        //		return View("Error");
        //	}

        //	//Check Access Rights to Domain Hierarchy
        //	//if (!hierarchyRepository.AdminHasDomainHierarchyWriteAccess(group.HierarchyType, group.HierarchyCode, group.SourceSystemCode, groupName))
        //	//{
        //	//    ViewData["Message"] = "You cannot add to this hierarchy item";
        //	//    return View("Error");
        //	//}

        //	//Update Model From Form + Validate against DB
        //	try
        //	{
        //		UpdateModel(group);
        //	}
        //	catch
        //	{
        //		string n = "";
        //		foreach (ModelState modelState in ViewData.ModelState.Values)
        //		{
        //			foreach (ModelError error in modelState.Errors)
        //			{
        //				n += error.ErrorMessage;
        //			}
        //		}
        //		ViewData["Message"] = "ValidationError : " + n;
        //		return View("Error");
        //	}

        //	//ClientSubUnitTravelerType has extra field
        //	string hierarchyCode = group.HierarchyCode;
        //	if (group.HierarchyType == "ClientSubUnitTravelerType")
        //	{
        //		group.ClientSubUnitGuid = hierarchyCode;  //ClientSubUnitTravelerType has 2 primarykeys
        //	}

        //	//Database Update
        //	try
        //	{
        //		creditCardRepository.AddCWTCreditCard(group);
        //	}
        //	catch (SqlException ex)
        //	{
        //		LogRepository logRepository = new LogRepository();
        //		logRepository.LogError(ex.Message);

        //		ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
        //		return View("Error");
        //	}
        //	return RedirectToAction("List");
        //}

        //GET: /Edit
        public ActionResult Edit(int id)
        {
            //Check if changes are allowed to Cards for this Database
            CreditCardBehavior creditCardBehavior = new CreditCardBehavior();

            creditCardBehavior = creditCardRepository.GetCreditCardBehavior();
            if (!creditCardBehavior.CanChangeCreditCardsFlag)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("Error"));
            }

            //Get Item From Database
            CreditCard group = new CreditCard();

            group = creditCardRepository.GetCreditCard(id, true);

            //Check Exists
            if (group == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //Check Access
            //RolesRepository rolesRepository = new RolesRepository();
            // (!rolesRepository.HasWriteAccessToPolicyGroup(id))
            //{
            //    ViewData["Message"] = "You do not have access to this item";
            //    return View("Error");
            //}

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
            SelectList creditCardVendorsList = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");

            ViewData["CreditCardVendors"] = creditCardVendorsList;

            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            ViewData["HierarchyTypes"] = hierarchyTypesList;

            //Log View Of Credit Card
            LogRepository logRepository = new LogRepository();

            logRepository.LogApplicationUsage(8, "", "", "", group.CreditCardToken, group.CreditCardTypeId, true);

            creditCardRepository.EditForDisplay(group);
            return(View(group));
        }
示例#6
0
        // GET: Edit A Single MerchantFee
        public ActionResult Edit(int id)
        {
            //Get Item From Database
            MerchantFee merchantFee = new MerchantFee();

            merchantFee = merchantFeeRepository.GetItem(id);

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

            MerchantFeeVM merchantFeeVM = new MerchantFeeVM();

            merchantFee.MerchantFeePercentMaximum = 100;

            merchantFeeRepository.EditForDisplay(merchantFee);
            merchantFeeVM.MerchantFee = merchantFee;

            CountryRepository countryRepository = new CountryRepository();

            merchantFeeVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName", merchantFee.CountryCode);

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            merchantFeeVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", merchantFee.CreditCardVendorCode);

            ProductRepository productRepository = new ProductRepository();

            merchantFeeVM.Products = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName", merchantFee.ProductId);

            return(View(merchantFeeVM));
        }
示例#7
0
        // GET: /Create
        public ActionResult Create(string can, string ssc, string csu)
        {
            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

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

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientSubUnit.ClientTopUnit;


            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientAccountCreditCards(can, ssc))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }
            CreditCard creditCard = new CreditCard();

            creditCard.ClientAccountNumber        = can;
            creditCard.SourceSystemCode           = ssc;
            creditCard.ClientTopUnitGuid          = clientTopUnit.ClientTopUnitGuid;
            creditCard.ClientSubUnitGuid          = clientSubUnit.ClientSubUnitGuid;
            creditCard.ClientSubUnitName          = clientSubUnit.ClientSubUnitName;
            creditCard.ClientTopUnitName          = clientTopUnit.ClientTopUnitName;
            creditCard.ClientAccountName          = clientAccount.ClientAccountName;
            creditCard.CanHaveRealCreditCardsFlag = creditCardRepository.GetCreditCardBehavior().CanHaveRealCreditCardsFlag;
            creditCard.WarningShownFlag           = !creditCard.CanHaveRealCreditCardsFlag;

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
            SelectList creditCardVendorsList = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", creditCard.CreditCardVendorCode);

            ViewData["CreditCardVendorsList"] = creditCardVendorsList;

            SelectList clientTopUnitsList = new SelectList(clientAccountRepository.GetClientAccountClientTopUnits(can, ssc).ToList(), "ClientTopUnitGuid", "ClientTopUnitName", creditCard.ClientTopUnitGuid);

            ViewData["ClientTopUnitList"] = clientTopUnitsList;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            ViewData["CreditCardTypeList"] = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription", creditCard.CreditCardTypeId);;

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

            ViewData["ProductList"] = products;

            //Show Create Form
            return(View(creditCard));
        }
示例#8
0
        // GET: /Edit
        public ActionResult Edit(int id, string can, string ssc, string csu)
        {
            //Check if changes are allowed to Cards for this Database
            CreditCardBehavior creditCardBehavior = new CreditCardBehavior();

            creditCardBehavior = creditCardRepository.GetCreditCardBehavior();
            if (!creditCardBehavior.CanChangeCreditCardsFlag)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("Error"));
            }

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

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

            CreditCard creditCard = new CreditCard();

            creditCard = creditCardRepository.GetCreditCard(id, true);

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

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            //Check Exists
            if (clientSubUnit == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            creditCard.ClientAccountName   = clientAccount.ClientAccountName;
            creditCard.ClientAccountNumber = clientAccount.ClientAccountNumber;
            creditCard.SourceSystemCode    = clientAccount.SourceSystemCode;
            creditCard.ClientSubUnitName   = clientSubUnit.ClientSubUnitName;

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
            SelectList creditCardVendorsList = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", creditCard.CreditCardVendorCode);

            ViewData["CreditCardVendorsList"] = creditCardVendorsList;

            SelectList clientTopUnitsList = new SelectList(clientAccountRepository.GetClientAccountClientTopUnits(can, ssc).ToList(), "ClientTopUnitGuid", "ClientTopUnitName", creditCard.ClientTopUnitGuid);

            ViewData["ClientTopUnitList"] = clientTopUnitsList;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();
            SelectList creditCardTypeList = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription", creditCard.CreditCardTypeId);;

            ViewData["CreditCardTypeList"] = creditCardTypeList;

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

            ViewData["ProductList"] = products;

            //Log View Of Credit Card
            LogRepository logRepository = new LogRepository();

            logRepository.LogApplicationUsage(8, clientSubUnit.ClientSubUnitGuid, "", "", creditCard.CreditCardToken, creditCard.CreditCardTypeId, true);

            creditCardRepository.EditForDisplay(creditCard);
            return(View(creditCard));
        }
示例#9
0
        // GET: /Create/
        public ActionResult Create(string csu, string tt)
        {
            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

            //Check Exists - Although TT exists independently of CSU, Access Rights are dependent on CSU
            //User can only edit a TT Credit Card if it s linked to a CSU that the user has access to
            //Must check for existance to prevent user changing CSUid in URL to access other TTs
            if (clientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }


            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnitCreditCards(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            TravelerTypeCreditCardVM travelerTypeCreditCardVM = new TravelerTypeCreditCardVM();

            TravelerType travelerType = new TravelerType();

            travelerType = travelerTypeRepository.GetTravelerType(tt);
            travelerTypeCreditCardVM.TravelerType = travelerTypeRepository.GetTravelerType(tt);

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            travelerTypeCreditCardVM.ClientSubUnit = clientSubUnit;
            CreditCard creditCard = new CreditCard();

            creditCard.ClientTopUnitName          = clientSubUnit.ClientTopUnit.ClientTopUnitName;
            creditCard.ClientSubUnitGuid          = clientSubUnit.ClientSubUnitGuid;
            creditCard.CanHaveRealCreditCardsFlag = creditCardRepository.GetCreditCardBehavior().CanHaveRealCreditCardsFlag;
            creditCard.WarningShownFlag           = !creditCard.CanHaveRealCreditCardsFlag;
            travelerTypeCreditCardVM.CreditCard   = creditCard;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            travelerTypeCreditCardVM.CreditCardTypes = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription");

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            travelerTypeCreditCardVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName");

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

            ViewData["ProductList"] = products;

            //Show Create Form
            return(View(travelerTypeCreditCardVM));
        }
示例#10
0
        // GET: /Edit
        public ActionResult Edit(int id, string csu)
        {
            //Check if changes are allowed to Cards for this Database
            CreditCardBehavior creditCardBehavior = new CreditCardBehavior();

            creditCardBehavior = creditCardRepository.GetCreditCardBehavior();
            if (!creditCardBehavior.CanChangeCreditCardsFlag)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("Error"));
            }

            //Check Exists
            CreditCardTravelerType creditCardTravelerType = new CreditCardTravelerType();

            creditCardTravelerType = creditCardTravelerTypeRepository.GetCreditCardTravelerType(id);

            if (creditCardTravelerType == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            //string csu = creditCardTravelerType.ClientSubUnitGuid;
            string tt = creditCardTravelerType.TravelerTypeGuid;

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnitCreditCards(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }


            TravelerTypeCreditCardVM travelerTypeCreditCardVM = new TravelerTypeCreditCardVM();

            travelerTypeCreditCardVM.TravelerType  = travelerTypeRepository.GetTravelerType(tt);
            travelerTypeCreditCardVM.ClientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            CreditCard creditCard = new CreditCard();

            creditCard = creditCardRepository.GetCreditCard(id, true);
            creditCardRepository.EditForDisplay(creditCard);
            travelerTypeCreditCardVM.CreditCard = creditCard;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            travelerTypeCreditCardVM.CreditCardTypes = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription", creditCard.CreditCardTypeId);

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();

            travelerTypeCreditCardVM.CreditCardVendors = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", creditCard.CreditCardVendorCode);

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

            ViewData["ProductList"] = products;

            //Log View Of Credit Card
            LogRepository logRepository = new LogRepository();

            logRepository.LogApplicationUsage(8, csu, tt, "", creditCard.CreditCardToken, creditCard.CreditCardTypeId, true);

            //Show Form

            return(View(travelerTypeCreditCardVM));
        }
示例#11
0
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            //Check if changes are allowed to Cards for this Database
            CreditCardBehavior creditCardBehavior = new CreditCardBehavior();

            creditCardBehavior = creditCardRepository.GetCreditCardBehavior();
            if (!creditCardBehavior.CanChangeCreditCardsFlag)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("Error"));
            }

            CreditCard creditCard = new CreditCard();

            creditCard = creditCardRepository.GetCreditCard(id, true);

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

            //Check Exists
            CreditCardClientSubUnit creditCardClientSubUnit = new CreditCardClientSubUnit();

            creditCardClientSubUnit = creditCardClientSubUnitRepository.GetCreditCardClientSubUnit(id);

            if (creditCardClientSubUnit == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnitCreditCards(creditCardClientSubUnit.ClientSubUnitGuid))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            CreditCardVendorRepository creditCardVendorRepository = new CreditCardVendorRepository();
            SelectList creditCardVendorsList = new SelectList(creditCardVendorRepository.GetAllCreditCardVendors().ToList(), "CreditCardVendorCode", "CreditCardVendorName", creditCard.CreditCardVendorCode);

            ViewData["CreditCardVendorsList"] = creditCardVendorsList;

            CreditCardTypeRepository creditCardTypeRepository = new CreditCardTypeRepository();

            ViewData["CreditCardTypeList"] = new SelectList(creditCardTypeRepository.GetAllCreditCardTypes().ToList(), "CreditCardTypeId", "CreditCardTypeDescription", creditCard.CreditCardTypeId);;

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

            ViewData["ProductList"] = products;

            //Log View Of Credit Card
            LogRepository logRepository = new LogRepository();

            logRepository.LogApplicationUsage(8, creditCardClientSubUnit.ClientSubUnitGuid, "", "", creditCard.CreditCardToken, creditCard.CreditCardTypeId, true);

            //Show Create Form
            creditCardRepository.EditForDisplay(creditCard);
            return(View(creditCard));
        }