//Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientProfileGroup clientProfileGroup)
        {
            //Set Hierarchy if ClientTopUnit
            ClientProfileGroupClientTopUnit clientProfileGroupClientTopUnit = clientProfileGroup.ClientProfileGroupClientTopUnits.SingleOrDefault();

            if (clientProfileGroupClientTopUnit != null)
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = new ClientTopUnit();
                clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientProfileGroupClientTopUnit.ClientTopUnitGuid);
                if (clientTopUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientTopUnit.ClientTopUnitName;
                    clientProfileGroup.HierarchyCode = clientTopUnit.ClientTopUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientTopUnit";
                }
            }

            //Set Hierarchy if ClientSubUnit
            ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault();

            if (clientProfileGroupClientSubUnit != null)
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientSubUnit.ClientSubUnitName;
                    clientProfileGroup.HierarchyCode = clientSubUnit.ClientSubUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientSubUnit";
                }
            }
        }
        //Add Data From Linked Tables for Display
        public void EditForDisplay(GSTIdentificationNumber gstIdentificationNumber)
        {
            CountryRepository countryRepository = new CountryRepository();
            Country           country           = new Country();

            country = countryRepository.GetCountry(gstIdentificationNumber.CountryCode);
            if (country != null)
            {
                gstIdentificationNumber.CountryName = country.CountryName;
            }

            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(gstIdentificationNumber.ClientTopUnitGuid);

            if (clientTopUnit != null)
            {
                gstIdentificationNumber.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
            }

            StateProvinceRepository stateProvinceRepository = new StateProvinceRepository();
            StateProvince           stateProvince           = stateProvinceRepository.GetStateProvinceByCountry(gstIdentificationNumber.CountryCode, gstIdentificationNumber.StateProvinceCode);

            if (stateProvince != null)
            {
                gstIdentificationNumber.StateProvinceName = stateProvince.Name;
            }
        }
        public ActionResult ListSubUnits(string id, int?page, string sortField, int?sortOrder, string filter)
        {
            //Sorting
            if (sortField == null || sortField == "Name")
            {
                sortField = "ClientSubUnitDisplayName";
            }
            ViewData["CurrentSortField"] = sortField;

            //Ordering
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            //extra data for page titles
            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(id);
            ViewData["ClientTopUnitName"] = clientTopUnit.ClientTopUnitName;
            ViewData["ClientTopUnitGuid"] = id;

            var paginatedView = clientTopUnitRepository.GetClientSubUnits(id, page ?? 1, sortField, sortOrder ?? 0, filter ?? "");

            return(View(paginatedView));
        }
 public ClientTopUnitClientLocationsVM(
     ClientTopUnit clientTopUnit,
     CWTPaginatedList <spDesktopDataAdmin_SelectClientTopUnitClientLocations_v1Result> clientLocations)
 {
     ClientTopUnit   = clientTopUnit;
     ClientLocations = clientLocations;
 }
        // GET: /ViewItem/
        public ActionResult ViewItem(string id, string csu)
        {
            TravelerType travelerType = new TravelerType();

            travelerType = travelerTypeRepository.GetTravelerType(id);

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

            ClientSubUnit clientSubUnit = new ClientSubUnit();

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

            ClientTopUnit clientTopUnit = clientSubUnit.ClientTopUnit;

            travelerType.ClientTopUnit = clientTopUnit;

            return(View(travelerType));
        }
Example #6
0
        //Shows SubUnit.ClientAccounts and their associated data
        public ActionResult ClientAccountsMatrix(string id, int?page, string filter)
        {
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id);
            if (clientSubUnit == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }

            ViewData["ClientSubUnitGuid"] = id;
            ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName;

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);
            ViewData["ClientTopUnitGuid"] = id;
            ViewData["ClientTopUnitName"] = clientTopUnit.ClientTopUnitName;

            if (page < 0)
            {
                page = 1;
            }

            ViewData["filter"] = filter;
            var items = clientSummaryRepository.GetClientSummaryClientAccountMatrix(id, page ?? 1);

            return(View(items));
        }
Example #7
0
 public TravelerTypeVM(TravelerType travelerType, TravelerTypeSponsor travelerTypeSponsor, ClientTopUnit clientTopUnit, ClientSubUnit clientSubUnit)
 {
     TravelerType        = travelerType;
     TravelerTypeSponsor = travelerTypeSponsor;
     ClientSubUnit       = clientSubUnit;
     ClientTopUnit       = clientTopUnit;
 }
Example #8
0
        // GET: /List
        public ActionResult List(int?page, string id, string sortField, int?sortOrder)
        {
            //Set Access Rights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToReferenceInfo())
            {
                ViewData["Access"] = "WriteAccess";
            }
            ViewData["CurrentSortField"] = "Name";
            ViewData["CurrentSortOrder"] = 0;

            ClientTopUnitTelephoniesVM clientTopUnitTelephoniesVM = new ClientTopUnitTelephoniesVM();

            clientTopUnitTelephoniesVM.Telephonies = clientTopUnitTelephonyRepository.PageClientTopUnitTelephonies(page ?? 1, id, sortField, sortOrder);

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(id);

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

            clientTopUnitTelephoniesVM.ClientTopUnit = clientTopUnit;

            //return items
            return(View(clientTopUnitTelephoniesVM));
        }
Example #9
0
        public ActionResult Delete(int id, int pid, string sc, FormCollection collection)
        {
            ClientDetailSupplierProduct clientDetailSupplierProduct = new ClientDetailSupplierProduct();

            clientDetailSupplierProduct = clientDetailSupplierProductRepository.GetClientDetailSupplierProduct(id, pid, sc);

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

            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(id);

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

            //Delete Item
            try
            {
                clientDetailSupplierProduct.VersionNumber = Int32.Parse(collection["SupplierProduct.VersionNumber"]);
                clientDetailSupplierProductRepository.Delete(clientDetailSupplierProduct);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientTopUnitSupplierProduct.mvc/Delete?id=" + id.ToString() + "&sc=" + sc + "&pid=" + pid;
                    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 = id }));
        }
Example #10
0
 public ClientTopUnitContactVM(ClientTopUnit clientTopUnit, ClientDetail clientDetail, Contact contact, IEnumerable <SelectListItem> contactTypes)
 {
     ClientTopUnit = clientTopUnit;
     ClientDetail  = clientDetail;
     Contact       = contact;
     ContactTypes  = contactTypes;
 }
Example #11
0
        // GET: /Create
        public ActionResult Create(string id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            SelectList hierarchyTypesList = new SelectList(clientTopUnitMatrixDPCodeRepository.GetClientTopUnitMatrixDPCodeHierarchies(), "Key", "Value");

            ViewData["HierarchyTypes"] = hierarchyTypesList;

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(id);

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

            ClientTopUnitMatrixDPCode group = new ClientTopUnitMatrixDPCode();

            group.ClientTopUnit = clientTopUnit;

            return(View(group));
        }
        //Add Data From Linked Tables for Display
        public void EditForDisplay(ClientTelephony clientTelephony)
        {
            //Hierarchy
            if (clientTelephony.HierarchyType == "ClientTopUnit")
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = clientTopUnitRepository.GetClientTopUnit(clientTelephony.HierarchyItem);
                if (clientTopUnit != null)
                {
                    clientTelephony.HierarchyName = clientTopUnit.ClientTopUnitName;
                }
            }
            else if (clientTelephony.HierarchyType == "ClientSubUnit")
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = clientSubUnitRepository.GetClientSubUnit(clientTelephony.HierarchyItem);
                if (clientSubUnit != null)
                {
                    clientTelephony.HierarchyName = clientSubUnit.ClientSubUnitName;
                }
            }

            //MainNumberFlag
            clientTelephony.MainNumberFlagNullable = (clientTelephony.MainNumberFlag == true) ? true : false;
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientSubUnit clientSubUnit)
        {
            //PortraitStatusRepository portraitStatusRepository = new PortraitStatusRepository();
            //PortraitStatus portraitStatus = new PortraitStatus();
            //portraitStatus = portraitStatusRepository.GetPortraitStatus(clientSubUnit.PortraitStatusId);
            //if (portraitStatus != null)
            //{
            // clientSubUnit.PortraitStatus = portraitStatus.PortraitStatusDescription;
            //}

            CountryRepository countryRepository = new CountryRepository();
            Country           country           = new Country();

            country = countryRepository.GetCountry(clientSubUnit.CountryCode);
            if (country != null)
            {
                clientSubUnit.CountryName = country.CountryName;
            }

            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);
            if (clientTopUnit != null)
            {
                clientSubUnit.ClientTopUnitName = clientTopUnit.ClientTopUnitName;
            }
        }
        // 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";
            }

            ClientTopUnitAddressVM clientTopUnitAddressVM = new ClientTopUnitAddressVM();

            clientTopUnitAddressVM.ClientTopUnit = clientTopUnit;
            clientTopUnitAddressVM.ClientDetail  = clientDetail;

            Address address = new Address();

            clientTopUnitAddressVM.Address = address;

            CountryRepository countryRepository = new CountryRepository();

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

            MappingQualityRepository mappingQualityRepository = new MappingQualityRepository();

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

            return(View(clientTopUnitAddressVM));
        }
 public ClientTopUnitSupplierProductVM(ClientTopUnit clientTopUnit, ClientDetail clientDetail, ClientDetailSupplierProduct supplierProduct, Address address, IEnumerable <SelectListItem> products, IEnumerable <SelectListItem> suppliers)
 {
     ClientTopUnit   = clientTopUnit;
     ClientDetail    = clientDetail;
     SupplierProduct = supplierProduct;
     Products        = products;
     Suppliers       = suppliers;
 }
Example #16
0
 public ClientTopUnitAddressVM(ClientTopUnit clientTopUnit, ClientDetail clientDetail, Address address, IEnumerable <SelectListItem> countries, IEnumerable <SelectListItem> mappingQualityCodes)
 {
     ClientTopUnit       = clientTopUnit;
     ClientDetail        = clientDetail;
     Address             = address;
     Countries           = countries;
     MappingQualityCodes = mappingQualityCodes;
 }
Example #17
0
        public ActionResult Delete(int id)
        {
            ClientDetailContact clientDetailContact = new ClientDetailContact();

            clientDetailContact = clientDetailContactRepository.GetContactClientDetail(id);

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

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

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(clientDetailId);

            //Check Exists
            if (clientDetailClientTopUnit == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                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);
            contactRepository.EditForDisplay(contact);
            clientTopUnitContactVM.Contact = contact;

            return(View(clientTopUnitContactVM));
        }
Example #18
0
        public ActionResult Delete(string id, string hierarchyType, string hierarchyCode, FormCollection collection)
        {
            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(id);

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

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

            group = clientTopUnitMatrixDPCodeRepository.GetGroup(hierarchyCode, hierarchyType);

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

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

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

            group.ClientTopUnit = clientTopUnit;

            //Delete Item
            try
            {
                clientTopUnitMatrixDPCodeRepository.Delete(group);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientTopUnitMatrixDPCode.mvc/Delete/" + group.HierarchyCode;
                    return(View("VersionError"));
                }
                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 = group.ClientTopUnit.ClientTopUnitGuid }));
        }
Example #19
0
        // GET: /ListBySubUnit/
        public ActionResult List(int?page, string filter, string id, string sortField, int?sortOrder)
        {
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id);

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

            //Sorting
            if (sortField == null || sortField == "CreditCardTypeDescription")
            {
                sortField = "CreditCardTypeDescription";
            }
            ViewData["CurrentSortField"] = sortField;

            //Ordering
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
                sortOrder = 0;
            }

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

            if (rolesRepository.HasWriteAccessToClientSubUnitCreditCards(id))
            {
                ViewData["Access"] = "WriteAccess";
            }

            ClientSubUnitCreditCardsVM clientSubUnitCreditCardsVM = new ClientSubUnitCreditCardsVM();

            clientSubUnitCreditCardsVM.CreditCards = creditCardClientSubUnitRepository.GetCreditCardsBySubUnit(id, filter ?? "", page ?? 1, sortField, sortOrder ?? 0);

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            clientSubUnitCreditCardsVM.ClientSubUnit      = clientSubUnit;
            clientSubUnitCreditCardsVM.CreditCardBehavior = creditCardRepository.GetCreditCardBehavior();

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);
            clientSubUnitCreditCardsVM.ClientTopUnit = clientTopUnit;

            return(View(clientSubUnitCreditCardsVM));
        }
 public ClientTopUnitCreditCardsVM(
     ClientTopUnit clientTopUnit,
     CreditCardBehavior creditCardBehavior,
     CWTPaginatedList <spDesktopDataAdmin_SelectClientTopUnitCreditCards_v1Result> creditCards
     )
 {
     ClientTopUnit      = clientTopUnit;
     CreditCardBehavior = creditCardBehavior;
     CreditCards        = creditCards;
 }
        // 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        ctu           = clientDetailClientTopUnit.ClientTopUnitGuid;
            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(ctu);

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

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

            ClientTopUnitSubProductFormOfPaymentTypeVM clientTopUnitSubProductFormOfPaymentTypeVM = new ClientTopUnitSubProductFormOfPaymentTypeVM();

            clientTopUnitSubProductFormOfPaymentTypeVM.ClientTopUnit = clientTopUnit;
            clientTopUnitSubProductFormOfPaymentTypeVM.ClientDetail  = clientDetail;

            ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType();

            clientTopUnitSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType;

            FormOfPaymentTypeRepository formOfPaymentTypeRepository = new FormOfPaymentTypeRepository();

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

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

            return(View(clientTopUnitSubProductFormOfPaymentTypeVM));
        }
Example #22
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));
        }
 public ClientTopUnitCreditCardEditableVM(
     CreditCardEditable creditCard,
     ClientTopUnit clientTopUnit,
     IEnumerable <SelectListItem> creditCardTypes,
     IEnumerable <SelectListItem> creditCardVendors
     )
 {
     CreditCard        = creditCard;
     ClientTopUnit     = clientTopUnit;
     CreditCardTypes   = creditCardTypes;
     CreditCardVendors = creditCardVendors;
 }
        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"));
            }

            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(id);

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

            ClientTopUnitSubProductFormOfPaymentTypeVM clientTopUnitSubProductFormOfPaymentTypeVM = new ClientTopUnitSubProductFormOfPaymentTypeVM();

            clientTopUnitSubProductFormOfPaymentTypeVM.ClientTopUnit = clientTopUnit;

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

            ClientDetail clientDetail = new ClientDetail();

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

            return(View(clientTopUnitSubProductFormOfPaymentTypeVM));
        }
Example #25
0
 public ClientTopUnitSubProductFormOfPaymentTypeVM(
     ClientTopUnit clientTopUnit,
     ClientDetail clientDetail,
     ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType,
     IEnumerable <SelectListItem> subProducts,
     IEnumerable <SelectListItem> formOfPaymentTypes)
 {
     ClientTopUnit = clientTopUnit;
     ClientDetail  = clientDetail;
     ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType;
     FormOfPaymentTypes = formOfPaymentTypes;
     SubProducts        = subProducts;
 }
Example #26
0
        public ActionResult Edit(string csu, string tt)
        {
            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

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

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

            //Check Exists - Although TT exists independently of CSU, Access Rights are dependent on CSU
            //User can only edit a TT if it is linked to a CSU that the user has access to
            if (clientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            TravelerTypeVM travelerTypeVM = new TravelerTypeVM();

            ClientSubUnit clientSubUnit = new ClientSubUnit();

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

            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);
            travelerTypeVM.ClientTopUnit = clientTopUnit;

            TravelerTypeSponsor travelerTypeSponsor = new TravelerTypeSponsor();

            travelerTypeSponsor = travelerTypeSponsorRepository.GetTravelerTypeSponsor(tt);

            if (travelerTypeSponsor == null)
            {
                travelerTypeSponsor = new TravelerTypeSponsor();
                travelerTypeSponsor.TravelerTypeGuid = tt;
            }
            travelerTypeVM.TravelerTypeSponsor = travelerTypeSponsor;

            TravelerType travelerType = new TravelerType();

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

            return(View(travelerTypeVM));
        }
        // 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 TravelerTypeCreditCardsVM(
     ClientTopUnit clientTopUnit,
     ClientSubUnit clientSubUnit,
     TravelerType travelerType,
     CreditCardBehavior creditCardBehavior,
     CWTPaginatedList <spDesktopDataAdmin_SelectTravelerTypeCreditCards_v1Result> creditCards
     )
 {
     ClientTopUnit      = clientTopUnit;
     ClientSubUnit      = clientSubUnit;
     TravelerType       = travelerType;
     CreditCardBehavior = creditCardBehavior;
     CreditCards        = creditCards;
 }
Example #29
0
        // 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;
            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(clientDetailId);

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

            string clientTopUnitGuid = clientDetailClientTopUnit.ClientTopUnitGuid;


            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientTopUnitGuid);

            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);
            contactRepository.EditForDisplay(contact);
            clientTopUnitContactVM.Contact = contact;

            return(View(clientTopUnitContactVM));
        }
        // 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;
            ClientDetailClientTopUnit clientDetailClientTopUnit = new ClientDetailClientTopUnit();

            clientDetailClientTopUnit = clientDetailClientTopUnitRepository.GetClientDetailClientTopUnit(clientDetailId);

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

            string clientTopUnitGuid = clientDetailClientTopUnit.ClientTopUnitGuid;


            ClientTopUnit clientTopUnit = new ClientTopUnit();

            clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientTopUnitGuid);

            ClientTopUnitAddressVM clientTopUnitAddressVM = new ClientTopUnitAddressVM();

            clientTopUnitAddressVM.ClientTopUnit = clientTopUnit;

            ClientDetail clientDetail = new ClientDetail();

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

            Address address = new Address();

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

            return(View(clientTopUnitAddressVM));
        }