// GET: /List
        public ActionResult List(string csu, string tt, int id, int?page)
        {
            ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType();

            clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id);

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

            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

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

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

            if (rolesRepository.HasWriteAccessToClientSubUnit(csu))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Populate View Model
            TravelerTypeContactsVM travelerTypeContactsVM = new TravelerTypeContactsVM();

            travelerTypeContactsVM.Contacts = clientDetailRepository.ListClientDetailContacts(id, page ?? 1);

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            travelerTypeContactsVM.ClientSubUnit = clientSubUnit;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);
            travelerTypeContactsVM.ClientDetail = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            return(View(travelerTypeContactsVM));
        }
Example #2
0
        // GET: /List
        public ActionResult List(int id, int?page)
        {
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

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

            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id);

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

            string can = clientDetailClientAccount.ClientAccountNumber;
            string ssc = clientDetailClientAccount.SourceSystemCode;

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

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

            if (rolesRepository.HasWriteAccessToClientAccount(can, ssc))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Populate View Model
            ClientAccountContactsVM clientDetailContactsVM = new ClientAccountContactsVM();

            clientDetailContactsVM.Contacts      = clientDetailRepository.ListClientDetailContacts(id, page ?? 1);
            clientDetailContactsVM.ClientAccount = clientAccount;
            clientDetailContactsVM.ClientDetail  = clientDetail;

            return(View(clientDetailContactsVM));
        }