//Add Data From Linked Tables for Display public void EditGroupForDisplay(LocalOperatingHoursGroup group) { group.LocalOperatingHoursGroupName = Regex.Replace(group.LocalOperatingHoursGroupName, @"[^\w\-()*]", "-"); fnDesktopDataAdmin_SelectLocalOperatingHoursGroupHierarchy_v1Result hierarchy = GetGroupHierarchy(group.LocalOperatingHoursGroupId); if (hierarchy != null) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy.HierarchyType ?? "", hierarchy.HierarchyCode ?? "", hierarchy.HierarchyName ?? "", hierarchy.TravelerTypeGuid ?? "", hierarchy.TravelerTypeName ?? "", hierarchy.SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(TeamOutOfOfficeGroup group) { //group.TeamOutOfOfficeGroupName = Regex.Replace(group.TeamOutOfOfficeGroupName, @"[^\w\-()*]", "-"); List <fnDesktopDataAdmin_SelectTeamOutOfOfficeGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectTeamOutOfOfficeGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.TeamOutOfOfficeGroupId); if (hierarchy.Count > 0) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(CommissionableRouteGroup group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType; } group.CommissionableRouteGroupName = Regex.Replace(group.CommissionableRouteGroupName, @"[^\w\-()*]", "-"); List <fnDesktopDataAdmin_SelectCommissionableRouteGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectCommissionableRouteGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.CommissionableRouteGroupId); if (hierarchy.Count > 0) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ExternalSystemParameter group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } ExternalSystemParameterTypeRepository externalSystemParameterTypeRepository = new ExternalSystemParameterTypeRepository(); ExternalSystemParameterType externalSystemParameterType = new ExternalSystemParameterType(); externalSystemParameterType = externalSystemParameterTypeRepository.GetExternalSystemParameterType(group.ExternalSystemParameterTypeId); if (externalSystemParameterType != null) { group.ExternalSystemParameterType = externalSystemParameterType.ExternalSystemParameterTypeName; } fnDesktopDataAdmin_SelectExternalSystemParameterHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectExternalSystemParameterHierarchy_v1Result(); hierarchy = GetGroupHierarchy(group.ExternalSystemParameterId); if (hierarchy != null) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy.HierarchyType ?? "", hierarchy.HierarchyCode ?? "", hierarchy.HierarchyName ?? "", hierarchy.TravelerTypeGuid ?? "", hierarchy.TravelerTypeName ?? "", hierarchy.SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ApprovalGroup group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType; } group.ApprovalGroupName = Regex.Replace(group.ApprovalGroupName, @"[^\w\-()*]", "-"); List <fnDesktopDataAdmin_SelectApprovalGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectApprovalGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.ApprovalGroupId); if (hierarchy.Count > 0) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } //ApprovalGroupApprovalTypeItems ApprovalGroupApprovalTypeRepository approvalGroupApprovalTypeRepository = new ApprovalGroupApprovalTypeRepository(); if (group.ApprovalGroupApprovalTypeItems != null && group.ApprovalGroupApprovalTypeItems.Count > 0) { foreach (ApprovalGroupApprovalTypeItem approvalGroupApprovalTypeItems in group.ApprovalGroupApprovalTypeItems) { approvalGroupApprovalTypeItems.ApprovalGroupApprovalTypes = new SelectList(approvalGroupApprovalTypeRepository.GetAllApprovalGroupApprovalTypes().ToList(), "ApprovalGroupApprovalTypeId", "ApprovalGroupApprovalTypeDescription", approvalGroupApprovalTypeItems.ApprovalGroupApprovalTypeId); } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ClientFeeGroup group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } group.ClientFeeGroupName = Regex.Replace(group.ClientFeeGroupName, @"[^\w\-()*]", "-"); HierarchyRepository hierarchyRepository = new HierarchyRepository(); List <fnDesktopDataAdmin_SelectClientFeeGroupHierarchy_v1Result> hierarchy = GetGroupHierarchy(group.ClientFeeGroupId); if (hierarchy.Count > 0) { if (hierarchy.Count == 1) { HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } else { List <MultipleHierarchyDefinition> multipleHierarchies = new List <MultipleHierarchyDefinition>(); foreach (fnDesktopDataAdmin_SelectClientFeeGroupHierarchy_v1Result item in hierarchy) { multipleHierarchies.Add(new MultipleHierarchyDefinition() { HierarchyType = item.HierarchyType, HierarchyItem = item.HierarchyName, HierarchyCode = item.HierarchyCode, TravelerTypeGuid = item.TravelerTypeGuid, SourceSystemCode = item.SourceSystemCode }); } group.MultipleHierarchies = hierarchyRepository.GetMultipleHierarchies(multipleHierarchies); } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(PolicyGroup group) { //Trip Types TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } //Meetings if (group.MeetingID != null) { int meetingID = Int32.Parse(group.MeetingID.ToString()); MeetingRepository meetingRepository = new MeetingRepository(); Meeting meeting = meetingRepository.GetGroup(meetingID); if (meeting != null) { group.Meeting = meeting; } } group.PolicyGroupName = Regex.Replace(group.PolicyGroupName, @"[^\w\-()*]", "-"); //Hierarchy HierarchyRepository hierarchyRepository = new HierarchyRepository(); List <fnDesktopDataAdmin_SelectPolicyGroupHierarchy_v1Result> hierarchy = GetGroupHierarchy(group.PolicyGroupId); if (hierarchy.Count > 0) { if (hierarchy.Count == 1) { HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } else { List <MultipleHierarchyDefinition> multipleHierarchies = new List <MultipleHierarchyDefinition>(); foreach (fnDesktopDataAdmin_SelectPolicyGroupHierarchy_v1Result item in hierarchy) { multipleHierarchies.Add(new MultipleHierarchyDefinition() { HierarchyType = item.HierarchyType, HierarchyItem = item.HierarchyName, HierarchyCode = item.HierarchyCode, TravelerTypeGuid = item.TravelerTypeGuid, SourceSystemCode = item.SourceSystemCode }); } group.ClientSubUnitsHierarchy = hierarchyRepository.GetClientSubUnitHierarchies(multipleHierarchies); ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); group.ClientTopUnitName = clientSubUnitRepository.GetClientSubUnitClientTopUnitName(group.ClientSubUnitsHierarchy.First().ClientSubUnitGuid); } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }