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

            clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id);

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

            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

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

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

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

            TravelerTypeContactVM travelerTypeContactVM = new TravelerTypeContactVM();

            ClientSubUnit clientSubUnit = new ClientSubUnit();

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

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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

            Contact contact = new Contact();

            travelerTypeContactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

            travelerTypeContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId);

            return(View(travelerTypeContactVM));
        }
        public ActionResult Create(int id)
        {
            //Check Parent Exists
            PriceTrackingSetupGroup priceTrackingSetupGroup = new PriceTrackingSetupGroup();

            priceTrackingSetupGroup = priceTrackingSetupGroupRepository.GetPriceTrackingSetupGroup(id);

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

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

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

            PriceTrackingContactVM PriceTrackingContactVM = new PriceTrackingContactVM();

            //Create Item
            PriceTrackingContact priceTrackingContact = new PriceTrackingContact();

            priceTrackingContact.PriceTrackingSetupGroupId = id;
            priceTrackingContact.PriceTrackingSetupGroup   = priceTrackingSetupGroup;

            //ContactTypes
            PriceTrackingContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName");

            //PriceTrackingContactUserTypes
            PriceTrackingContactVM.PriceTrackingContactUserTypes = new SelectList(priceTrackingContactUserTypeRepository.GetAllPriceTrackingContactUserTypes().ToList(), "PriceTrackingContactUserTypeId", "PriceTrackingContactUserTypeName");

            //PriceTrackingDashboardAccessTypes
            PriceTrackingContactVM.PriceTrackingDashboardAccessTypes = new SelectList(commonRepository.GetTrueFalseList().ToList(), "Value", "Text");

            //PriceTrackingEmailAlertTypes
            PriceTrackingContactVM.PriceTrackingEmailAlertTypes = new SelectList(priceTrackingEmailAlertTypeRepository.GetAllPriceTrackingEmailAlertTypes().ToList(), "PriceTrackingEmailAlertTypeId", "PriceTrackingEmailAlertTypeName");

            PriceTrackingContactVM.PriceTrackingContact = priceTrackingContact;

            return(View(PriceTrackingContactVM));
        }
Example #3
0
        // GET: /Create
        public ActionResult Create(int id)
        {
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

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

            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(id);

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

            string clientTopUnitGuid = clientDetailClientTopUnit.ClientTopUnitGuid;


            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientTopUnitGuid);

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

            if (rolesRepository.HasWriteAccessToClientTopUnit(clientTopUnitGuid))
            {
                ViewData["Access"] = "WriteAccess";
            }

            ClientTopUnitContactVM clientTopUnitContactVM = new ClientTopUnitContactVM();

            clientTopUnitContactVM.ClientTopUnit = clientTopUnit;
            clientTopUnitContactVM.ClientDetail  = clientDetail;

            Contact contact = new Contact();

            clientTopUnitContactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

            clientTopUnitContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId);

            return(View(clientTopUnitContactVM));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            Contact contact = new Contact();

            contact = clientSubUnitContactRepository.GetContact(id);

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

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(contact.ClientSubUnitGuid);

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

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);

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

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

            ContactVM contactVM = new ContactVM();

            contactVM.ClientSubUnit = clientSubUnit;
            clientSubUnitContactRepository.EditForDisplay(contact);
            contactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

            contactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId);

            CountryRepository countryRepository = new CountryRepository();

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

            StateProvinceRepository stateProvinceRepository = new StateProvinceRepository();

            contactVM.StateProvinces = new SelectList(stateProvinceRepository.GetStateProvincesByCountryCode(contact.CountryCode).ToList(), "StateProvinceCode", "Name", contact.StateProvinceName);

            return(View(contactVM));
        }
        // GET: api/ContactType
        public IHttpActionResult GetAllContactTypes()
        {
            var contacttypeRepo = new ContactTypeRepository();
            var contacttypeList = contacttypeRepo.GetAllContactTypes();

            if (contacttypeList == null || contacttypeList.Count == 0)
            {
                return(NotFound());
            }

            return(Ok(contacttypeList));
        }
Example #6
0
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            ClientDetailContact clientDetailContact = new ClientDetailContact();

            clientDetailContact = clientDetailContactRepository.GetContactClientDetail(id);

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

            int clientDetailId = clientDetailContact.ClientDetailId;
            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(clientDetailId);

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

            string clientTopUnitGuid = clientDetailClientTopUnit.ClientTopUnitGuid;


            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientTopUnitGuid);

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

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

            ClientTopUnitContactVM clientTopUnitContactVM = new ClientTopUnitContactVM();

            clientTopUnitContactVM.ClientTopUnit = clientTopUnit;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);
            clientTopUnitContactVM.ClientDetail = clientDetail;

            Contact contact = new Contact();

            contact = contactRepository.GetContact(clientDetailContact.ContactId);
            clientTopUnitContactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

            clientTopUnitContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId);

            return(View(clientTopUnitContactVM));
        }
        // GET: /Edit
        public ActionResult Edit(string csu, int id)
        {
            ClientDetailContact clientDetailContact = new ClientDetailContact();

            clientDetailContact = clientDetailContactRepository.GetContactClientDetail(id);

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

            int clientDetailId = clientDetailContact.ClientDetailId;
            ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType();

            clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(clientDetailId);

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

            string tt = clientDetailTravelerType.TravelerTypeGuid;
            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

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

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

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

            TravelerTypeContactVM travelerTypeContactVM = new TravelerTypeContactVM();

            ClientSubUnit clientSubUnit = new ClientSubUnit();

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

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);
            travelerTypeContactVM.ClientDetail = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            Contact contact = new Contact();

            contact = contactRepository.GetContact(clientDetailContact.ContactId);
            travelerTypeContactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

            travelerTypeContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId);

            return(View(travelerTypeContactVM));
        }