示例#1
0
        // GET: /ConfirmDelete
        public ActionResult ConfirmDelete(int id)
        {
            //Check Exists
            Location location = new Location();

            location = locationRepository.GetLocation(id);
            if (location == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

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

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

            locationRepository.EditForDisplay(location);

            LocationWizardRepository locationWizardRepository     = new LocationWizardRepository();
            LocationLinkedItemsVM    locationLinkedItemsViewModel = new LocationLinkedItemsVM();

            locationLinkedItemsViewModel.Location = location;

            locationWizardRepository.AddLinkedItems(locationLinkedItemsViewModel);
            return(View(locationLinkedItemsViewModel));
        }
示例#2
0
        //Show 2nd Popup When a User tries To Delete (PART OF STEP 2)- Returns PartialView
        public ActionResult ShowConfirmDelete2(int locationId)
        {
            //Access to Locations
            if (!hierarchyRepository.AdminHasDomainWriteAccess("Location"))
            {
                return(PartialView("Error", "You do not have access to this item"));
            }

            Location location = new Location();

            location = locationRepository.GetLocation(locationId);

            //Check Exists
            if (location == null)
            {
                return(PartialView("Error", "Location Does Not Exist"));
            }
            //Access to this Location
            if (!rolesRepository.HasWriteAccessToLocation(locationId))
            {
                return(PartialView("Error", "You do not have access to this item"));
            }
            LocationTeamsVM locationTeamsScreenViewModel = new LocationTeamsVM();

            locationTeamsScreenViewModel.Teams    = locationWizardRepository.GetLocationTeams(locationId);
            locationTeamsScreenViewModel.Location = location;

            LocationLinkedItemsVM locationLinkedItems = new LocationLinkedItemsVM();

            locationLinkedItems.Location = location;
            locationWizardRepository.AddLinkedItems(locationLinkedItems);
            locationTeamsScreenViewModel.LinkedItemsCount =
                (locationLinkedItems.Contacts.Count +

                 locationLinkedItems.CreditCards.Count +
                 locationLinkedItems.ExternalSystemParameters.Count +
                 locationLinkedItems.GDSAdditionalEntries.Count +
                 locationLinkedItems.LocalOperatingHoursGroups.Count +

                 locationLinkedItems.PolicyGroups.Count +
                 locationLinkedItems.PublicHolidayGroups.Count +
                 locationLinkedItems.QueueMinderGroups.Count +
                 locationLinkedItems.ServicingOptionGroups.Count +
                 locationLinkedItems.TicketQueueGroups.Count +
                 locationLinkedItems.TripTypeGroups.Count);
            //removing these as we only want the items that prevent us deleting
            //locationLinkedItems.PNROutputGroups.Count +
            //locationLinkedItems.Addresses.Count +
            //locationLinkedItems.ValidPseudoCityOrOfficeIds.Count +
            //locationLinkedItems.WorkFlowGroups.Count);

            return(PartialView("ConfirmDeletePopup2", locationTeamsScreenViewModel));
        }
示例#3
0
        public ActionResult Delete(int id)
        {
            //Check Exists
            Location location = new Location();

            location = locationRepository.GetLocation(id);
            if (location == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

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

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

            locationRepository.EditForDisplay(location);

            LocationDeleteVM locationDeleteVM = new LocationDeleteVM();

            locationDeleteVM.Address = new Address();

            Address address = locationRepository.GetLocationAddress(id);

            if (address != null)
            {
                AddressRepository addressRepository = new AddressRepository();
                addressRepository.EditForDisplay(address);
                locationDeleteVM.Address = address;
            }

            LocationWizardRepository locationWizardRepository = new LocationWizardRepository();

            locationDeleteVM.Location    = location;
            locationDeleteVM.Teams       = locationWizardRepository.GetLocationTeams(id);
            locationDeleteVM.SystemUsers = locationWizardRepository.GetLocationSystemUsers(id);

            LocationLinkedItemsVM locationLinkedItemsVM = new LocationLinkedItemsVM();

            locationLinkedItemsVM.Location = location;
            locationWizardRepository.AddLinkedItems(locationLinkedItemsVM);
            locationDeleteVM.LinkedItems = locationLinkedItemsVM;

            return(View(locationDeleteVM));
        }
示例#4
0
        //Show 3rd Popup When a User tries To Delete (PART OF STEP 2)- Returns PartialView
        public ActionResult ShowConfirmDelete3(int locationId)
        {
            Location location = new Location();

            location = locationRepository.GetLocation(locationId);

            //Check Exists
            if (location == null)
            {
                return(PartialView("Error", "Location Does Not Exist"));
            }
            //Access Rights to this Location
            if (!rolesRepository.HasWriteAccessToLocation(location.LocationId))
            {
                return(PartialView("Error", "You do not have access to this item"));
            }
            LocationLinkedItemsVM locationLinkedItemsScreenViewModel = new LocationLinkedItemsVM();

            locationLinkedItemsScreenViewModel.Location = location;
            locationWizardRepository.AddLinkedItems(locationLinkedItemsScreenViewModel);


            return(PartialView("ConfirmDeletePopup3", locationLinkedItemsScreenViewModel));
        }
示例#5
0
        //Get List of Items attached to a Location (to populate LocationLinkedItemsVM)
        public void AddLinkedItems(LocationLinkedItemsVM locationLinkedItemsScreenViewModel)
        {
            int locationId = locationLinkedItemsScreenViewModel.Location.LocationId;

            HierarchyDC hierarchyDC = new HierarchyDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.Addresses =
                (from n in hierarchyDC.LocationAddresses where n.LocationId == locationId select n.Address).ToList();

            locationLinkedItemsScreenViewModel.Contacts =
                (from n in hierarchyDC.LocationContacts where n.LocationId == locationId select n.Contact).ToList();

            ExternalSystemParameterDC externalSystemParameterDC = new ExternalSystemParameterDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.ExternalSystemParameters =
                (from n in externalSystemParameterDC.ExternalSystemParameterLocations where n.LocationId == locationId select n.ExternalSystemParameter).ToList();

            GDSAdditionalEntryDC gdsAdditionalEntryDC = new GDSAdditionalEntryDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.GDSAdditionalEntries =
                (from n in gdsAdditionalEntryDC.GDSAdditionalEntryLocations  where n.LocationId == locationId select n.GDSAdditionalEntry).ToList();


            locationLinkedItemsScreenViewModel.CreditCards =
                (from n in hierarchyDC.CreditCardLocations where n.LocationId == locationId select n.CreditCard).ToList();

            locationLinkedItemsScreenViewModel.QueueMinderGroups =
                (from n in hierarchyDC.QueueMinderGroupLocations where n.LocationId == locationId select n.QueueMinderGroup).ToList();


            locationLinkedItemsScreenViewModel.ValidPseudoCityOrOfficeIds =
                (from n in hierarchyDC.LocationDefaultPseudoCityOrOfficeIds where n.LocationId == locationId select n.ValidPseudoCityOrOfficeId).ToList();

            ServicingOptionGroupDC servicingOptionGroupDC = new ServicingOptionGroupDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.ServicingOptionGroups =
                (from n in servicingOptionGroupDC.ServicingOptionGroupLocations where n.LocationId == locationId select n.ServicingOptionGroup).ToList();

            TicketQueueGroupDC ticketQueueGroupDC = new TicketQueueGroupDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.TicketQueueGroups =
                (from n in ticketQueueGroupDC.TicketQueueGroupLocations where n.LocationId == locationId select n.TicketQueueGroup).ToList();

            TripTypeGroupDC tripTypeGroupDC = new TripTypeGroupDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.TripTypeGroups =
                (from n in tripTypeGroupDC.TripTypeGroupLocations where n.LocationId == locationId select n.TripTypeGroup).ToList();

            locationLinkedItemsScreenViewModel.PNROutputGroups =
                (from n in hierarchyDC.PNROutputGroupLocations where n.LocationId == locationId select n.PNROutputGroup).ToList();

            PublicHolidayGroupDC publicHolidayGroupDC = new PublicHolidayGroupDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.PublicHolidayGroups =
                (from n in publicHolidayGroupDC.PublicHolidayGroupLocations where n.LocationId == locationId select n.PublicHolidayGroup).ToList();

            locationLinkedItemsScreenViewModel.WorkFlowGroups =
                (from n in hierarchyDC.WorkFlowGroupLocations where n.LocationId == locationId select n.WorkFlowGroup).ToList();

            locationLinkedItemsScreenViewModel.Teams =
                (from n in hierarchyDC.TeamLocations where n.LocationId == locationId select n.Team).ToList();

            locationLinkedItemsScreenViewModel.LocalOperatingHoursGroups =
                (from n in hierarchyDC.LocalOperatingHoursGroupLocations where n.LocationId == locationId select n.LocalOperatingHoursGroup).ToList();

            PolicyGroupDC policyGroupDC = new PolicyGroupDC(Settings.getConnectionString());

            locationLinkedItemsScreenViewModel.PolicyGroups =
                (from n in policyGroupDC.PolicyGroupLocations where n.LocationId == locationId select n.PolicyGroup).ToList();
        }