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));
        }
 public LookUpService()
 {
     _custClassRepo            = new CustClassRepository(context);
     _paymentTermsRepo         = new PaymentTermsRepository(context);
     _statementCycleRepository = new StatementCycleRepository(context);
     _shipMethodRepository     = new ShipMethodRepository(context);
     _businessFormRepository   = new BusinessFormRepository(context);
     _salesSourceRepository    = new SalesSourceRepository(context);
     _branchRepository         = new BranchRepository(context);
     _salesTerritoryRepository = new SalesTerritoryRepository(context);
     _territoryRepository      = new TerritoryRepository(context);
     _countryRepository        = new CountryRepository(context);
     _customerRepository       = new CustomerRepository(context);
     _userRepository           = new UserRepository(context);
     _groupRepository          = new GroupRepository(context);
     _creditCardTypeRepository = new CreditCardTypeRepository(context);
     _stateRepository          = new StateRepository(context);
     _taxSubjClassRepository   = new TaxSubjClassRepository(context);
     _taxScheduleRepository    = new TaxScheduleRepository(context);
     _batchRepository          = new BatchRepository();
 }
Exemple #5
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));
        }
Exemple #6
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));
        }
Exemple #7
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));
        }
Exemple #8
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));
        }
Exemple #9
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));
        }