// 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"));
            }

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeContactVM clientSubUnitTravelerTypeContactVM = new ClientSubUnitTravelerTypeContactVM();

            clientSubUnitTravelerTypeContactVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeContactVM.ClientDetail  = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            Contact contact = new Contact();

            clientSubUnitTravelerTypeContactVM.Contact = contact;

            ContactTypeRepository contactTypeRepository = new ContactTypeRepository();

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

            return(View(clientSubUnitTravelerTypeContactVM));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id, int fpt, int sp)
        {
            ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType();

            clientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentTypeRepository.GetClientDetailSubProductFormOfPaymentType(sp, id);

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

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM = new ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM();

            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientSubUnit = clientSubUnit;

            clientDetailSubProductFormOfPaymentTypeRepository.EditForDisplay(clientDetailSubProductFormOfPaymentType);
            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType;

            TravelerType travelerType = new TravelerType();

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

            ClientDetail clientDetail = new ClientDetail();

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

            return(View(clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM));
        }
        public ActionResult Delete(int id)
        {
            ClientDetailESCInformation clientDetailESCInformation = new ClientDetailESCInformation();

            clientDetailESCInformation = clientDetailESCInformationRepository.GetClientDetailESCInformation(id);

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

            int clientDetailId = clientDetailESCInformation.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeESCInformationVM clientSubUnitTravelerTypeESCInformationVM = new ClientSubUnitTravelerTypeESCInformationVM();

            clientSubUnitTravelerTypeESCInformationVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeESCInformationVM.ClientDetailESCInformation = clientDetailESCInformation;

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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

            return(View(clientSubUnitTravelerTypeESCInformationVM));
        }
        // GET: /View
        public ActionResult View(int id)
        {
            ClientDetailAddress clientDetailAddress = new ClientDetailAddress();

            clientDetailAddress = clientDetailAddressRepository.GetAddressClientDetail(id);

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

            int clientDetailId = clientDetailAddress.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;


            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            ClientSubUnitTravelerTypeAddressVM clientSubUnitTravelerTypeAddressVM = new ClientSubUnitTravelerTypeAddressVM();

            clientSubUnitTravelerTypeAddressVM.ClientSubUnit = clientSubUnit;

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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

            Address address = new Address();

            address = addressRepository.GetAddress(clientDetailAddress.AddressId);
            addressRepository.EditForDisplay(address);
            clientSubUnitTravelerTypeAddressVM.Address = address;

            return(View(clientSubUnitTravelerTypeAddressVM));
        }
Exemplo n.º 5
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"] = "List";
                return(View("RecordDoesNotExistError"));
            }

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            //Populate View Model
            ClientSubUnitTravelerTypeSupplierProductsVM clientSubUnitTravelerTypeSupplierProductsVM = new ClientSubUnitTravelerTypeSupplierProductsVM();

            clientSubUnitTravelerTypeSupplierProductsVM.SupplierProducts = clientDetailRepository.ListClientDetailSupplierProducts(id, page ?? 1);
            clientSubUnitTravelerTypeSupplierProductsVM.ClientSubUnit    = clientSubUnit;
            clientSubUnitTravelerTypeSupplierProductsVM.ClientDetail     = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            //Return Form
            return(View(clientSubUnitTravelerTypeSupplierProductsVM));
        }
        // 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"));
            }

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeESCInformationVM clientSubUnitTravelerTypeESCInformationVM = new ClientSubUnitTravelerTypeESCInformationVM();

            clientSubUnitTravelerTypeESCInformationVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeESCInformationVM.ClientDetail  = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            ClientDetailESCInformation clientDetailESCInformation = new ClientDetailESCInformation();

            clientSubUnitTravelerTypeESCInformationVM.ClientDetailESCInformation = clientDetailESCInformation;

            return(View(clientSubUnitTravelerTypeESCInformationVM));
        }
        // GET: /View
        public ActionResult View(int id)
        {
            ClientDetailContact clientDetailContact = new ClientDetailContact();

            clientDetailContact = clientDetailContactRepository.GetContactClientDetail(id);

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

            int clientDetailId = clientDetailContact.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;


            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            ClientSubUnitTravelerTypeContactVM clientSubUnitTravelerTypeContactVM = new ClientSubUnitTravelerTypeContactVM();

            clientSubUnitTravelerTypeContactVM.ClientSubUnit = clientSubUnit;

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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

            Contact contact = new Contact();

            contact = contactRepository.GetContact(clientDetailContact.ContactId);
            contactRepository.EditForDisplay(contact);
            clientSubUnitTravelerTypeContactVM.Contact = contact;

            return(View(clientSubUnitTravelerTypeContactVM));
        }
        // GET: /View
        public ActionResult View(int id)
        {
            ClientDetailESCInformation clientDetailESCInformation = new ClientDetailESCInformation();

            clientDetailESCInformation = clientDetailESCInformationRepository.GetClientDetailESCInformation(id);

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

            int clientDetailId = clientDetailESCInformation.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            ClientSubUnitTravelerTypeESCInformationVM clientSubUnitTravelerTypeESCInformationVM = new ClientSubUnitTravelerTypeESCInformationVM();

            clientSubUnitTravelerTypeESCInformationVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeESCInformationVM.ClientDetailESCInformation = clientDetailESCInformation;

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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

            return(View(clientSubUnitTravelerTypeESCInformationVM));
        }
        // GET: /ListSubMenu
        public ActionResult ListSubMenu(int id)
        {
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

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

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;



            ClientSubUnitTravelerTypeClientDetailVM clientSubUnitTravelerTypeClientDetailVM = new ClientSubUnitTravelerTypeClientDetailVM();

            clientSubUnitTravelerTypeClientDetailVM.ClientDetail = clientDetail;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

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

            TravelerType travelerType = new TravelerType();

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

            return(View(clientSubUnitTravelerTypeClientDetailVM));
        }
Exemplo n.º 10
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"));
            }

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM = new ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM();

            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetail  = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType();

            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType;

            FormOfPaymentTypeRepository formOfPaymentTypeRepository = new FormOfPaymentTypeRepository();

            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.FormOfPaymentTypes = new SelectList(formOfPaymentTypeRepository.GetAllFormOfPaymentTypes().ToList(), "FormOfPaymentTypeId", "FormOfPaymentTypeDescription");

            clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.SubProducts = new SelectList(clientDetailSubProductFormOfPaymentTypeRepository.GetUnUsedSubProducts(id).ToList(), "SubProductId", "SubProductName");

            return(View(clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM));
        }
Exemplo n.º 11
0
        public ActionResult Delete(int id, int fpt, int sp, FormCollection collection)
        {
            ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType();

            clientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentTypeRepository.GetClientDetailSubProductFormOfPaymentType(sp, id);

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

            int clientDetailId = clientDetailSubProductFormOfPaymentType.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            //Delete Item
            try
            {
                clientDetailSubProductFormOfPaymentType.VersionNumber = Int32.Parse(collection["ClientDetailSubProductFormOfPaymentType.VersionNumber"]);
                clientDetailSubProductFormOfPaymentTypeRepository.Delete(clientDetailSubProductFormOfPaymentType);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientSubUnitTravelerTypeSubProductFormOfPaymentType.mvc/Delete/?id=" + id.ToString() + "&sp=" + sp.ToString() + "&fpt=" + fpt.ToString();
                    return(View("VersionError"));
                }
                //Generic Error
                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", new { id = clientDetailId }));
        }
Exemplo n.º 12
0
        public ActionResult Create(ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM)
        {
            int          clientDetailId = clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetail.ClientDetailId;
            ClientDetail clientDetail   = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);

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

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string        csu           = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string        tt            = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            //Check Exists
            if (clientSubUnit == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                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"));
            }


            //Update  Model from Form
            try
            {
                TryUpdateModel <ClientDetailSubProductFormOfPaymentType>(clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType, "ClientDetailSubProductFormOfPaymentType");
            }
            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"));
            }



            try
            {
                clientDetailSubProductFormOfPaymentTypeRepository.Add(clientDetail, clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType);
            }
            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", new { id = clientDetailId }));
        }
        // 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"));
            }

            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeAddressVM clientSubUnitTravelerTypeAddressVM = new ClientSubUnitTravelerTypeAddressVM();

            clientSubUnitTravelerTypeAddressVM.ClientSubUnit = clientSubUnit;
            clientSubUnitTravelerTypeAddressVM.ClientDetail  = clientDetail;

            TravelerType travelerType = new TravelerType();

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

            Address address = new Address();

            clientSubUnitTravelerTypeAddressVM.Address = address;

            CountryRepository countryRepository = new CountryRepository();

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

            MappingQualityRepository mappingQualityRepository = new MappingQualityRepository();

            clientSubUnitTravelerTypeAddressVM.MappingQualityCodes = new SelectList(mappingQualityRepository.GetAllMappingQualities().ToList(), "MappingQualityCode", "MappingQualityCode", address.MappingQualityCode);

            return(View(clientSubUnitTravelerTypeAddressVM));
        }
        public ActionResult Delete(int id)
        {
            ClientDetailAddress clientDetailAddress = new ClientDetailAddress();

            clientDetailAddress = clientDetailAddressRepository.GetAddressClientDetail(id);

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

            int clientDetailId = clientDetailAddress.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

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

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientSubUnitTravelerTypeAddressVM clientSubUnitTravelerTypeAddressVM = new ClientSubUnitTravelerTypeAddressVM();

            clientSubUnitTravelerTypeAddressVM.ClientSubUnit = clientSubUnit;

            ClientDetail clientDetail = new ClientDetail();

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

            TravelerType travelerType = new TravelerType();

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


            Address address = new Address();

            address = addressRepository.GetAddress(clientDetailAddress.AddressId);
            addressRepository.EditForDisplay(address);
            clientSubUnitTravelerTypeAddressVM.Address = address;

            return(View(clientSubUnitTravelerTypeAddressVM));
        }