Exemplo n.º 1
0
        //on form submit - check user input against existing items
        //if editing, id is passed to ignore current item
        public bool IsAvailablePolicyGroupName(string groupName, int?groupId)
        {
            PolicyGroupDC dbPolicyGroup = new PolicyGroupDC(Settings.getConnectionString());
            int           count         = 0;

            if (groupId.HasValue)
            {
                var result = from n in dbPolicyGroup.PolicyGroups
                             where n.PolicyGroupName.Trim().Equals(groupName) && n.PolicyGroupId != groupId
                             select n.PolicyGroupName;
                count = result.Count();
            }
            else
            {
                var result = from n in dbPolicyGroup.PolicyGroups
                             where n.PolicyGroupName.Trim().Equals(groupName)
                             select n.PolicyGroupName;
                count = result.Count();
            }
            if (count == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
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();
        }
        //Get List of Items attached to a Location (to populate LocationLinkedItemsVM)
        public void AddLinkedItems(TeamLinkedItemsVM teamLinkedItemsScreenViewModel)
        {
            int teamid = teamLinkedItemsScreenViewModel.Team.TeamId;

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

            teamLinkedItemsScreenViewModel.Addresses =
                (from n in hierarchyDC.TeamAddresses where n.TeamId == teamid select n.Address).ToList();

            teamLinkedItemsScreenViewModel.Contacts =
                (from n in hierarchyDC.TeamContacts where n.TeamId == teamid select n.Contact).ToList();


            teamLinkedItemsScreenViewModel.CreditCards =
                (from n in hierarchyDC.CreditCardTeams where n.TeamId == teamid select n.CreditCard).ToList();

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

            teamLinkedItemsScreenViewModel.ExternalSystemParameters =
                (from n in externalSystemParameterDC.ExternalSystemParameterTeams where n.TeamId == teamid select n.ExternalSystemParameter).ToList();

            teamLinkedItemsScreenViewModel.ExternalSystemLogins =
                (from n in hierarchyDC.ExternalSystemLoginTeams where n.TeamId == teamid select n.ExternalSystemLogin).ToList();

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

            teamLinkedItemsScreenViewModel.GDSAdditionalEntries =
                (from n in gdsAdditionalEntryDC.GDSAdditionalEntryTeams where n.TeamId == teamid select n.GDSAdditionalEntry).ToList();

            teamLinkedItemsScreenViewModel.LocalOperatingHoursGroups =
                (from n in hierarchyDC.LocalOperatingHoursGroupTeams where n.TeamId == teamid select n.LocalOperatingHoursGroup).ToList();

            teamLinkedItemsScreenViewModel.PNROutputGroups =
                (from n in hierarchyDC.PNROutputGroupTeams where n.TeamId == teamid select n.PNROutputGroup).ToList();

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

            teamLinkedItemsScreenViewModel.PolicyGroups =
                (from n in policyGroupDC.PolicyGroupTeams where n.TeamId == teamid select n.PolicyGroup).ToList();

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

            teamLinkedItemsScreenViewModel.PublicHolidayGroups =
                (from n in publicHolidayGroupDC.PublicHolidayGroupTeams where n.TeamId == teamid select n.PublicHolidayGroup).ToList();

            teamLinkedItemsScreenViewModel.QueueMinderGroups =
                (from n in hierarchyDC.QueueMinderGroupTeams where n.TeamId == teamid select n.QueueMinderGroup).ToList();

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

            teamLinkedItemsScreenViewModel.TicketQueueGroups =
                (from n in ticketQueueGroupDC.TicketQueueGroupTeams where n.TeamId == teamid select n.TicketQueueGroup).ToList();

            teamLinkedItemsScreenViewModel.ValidPseudoCityOrOfficeIds =
                (from n in hierarchyDC.TeamDefaultPseudoCityOrOfficeIds where n.TeamId == teamid select n.ValidPseudoCityOrOfficeId).ToList();

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

            teamLinkedItemsScreenViewModel.ServicingOptionGroups =
                (from n in servicingOptionGroupDC.ServicingOptionGroupTeams where n.TeamId == teamid select n.ServicingOptionGroup).ToList();
        }