//Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientDetail group)
        {
            TripTypeRepository tripTypeRepository = new TripTypeRepository();
            TripType           tripType           = new TripType();

            tripType = tripTypeRepository.GetTripType(group.TripTypeId);
            if (tripType != null)
            {
                group.TripType = tripType.TripTypeDescription;
            }

            HierarchyRepository hierarchyRepository = new HierarchyRepository();

            fnDesktopDataAdmin_SelectClientDetailHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectClientDetailHierarchy_v1Result();

            hierarchy = GetGroupHierarchy(group.ClientDetailId);

            group.HierarchyType    = hierarchy.HierarchyType;
            group.HierarchyCode    = hierarchy.HierarchyCode.ToString();
            group.HierarchyItem    = hierarchy.HierarchyName.Trim();
            group.SourceSystemCode = hierarchy.SourceSystemCode;
            group.ClientDetailName = Regex.Replace(group.ClientDetailName, @"[^\w\s\-()*]", "-");

            if (hierarchy.HierarchyType == "ClientSubUnitTravelerType")
            {
                group.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString();
                group.ClientSubUnitName = hierarchy.HierarchyName.Trim();
                group.TravelerTypeGuid  = hierarchy.TravelerTypeGuid;
                group.TravelerTypeName  = hierarchy.TravelerTypeName.Trim();
            }
        }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(GDSAdditionalEntry group)
        {
            TripTypeRepository tripTypeRepository = new TripTypeRepository();
            TripType           tripType           = new TripType();

            tripType = tripTypeRepository.GetTripType(group.TripTypeId);
            if (tripType != null)
            {
                group.TripType = tripType.TripTypeDescription;
            }

            GDSRepository gDSRepository = new GDSRepository();
            GDS           gds           = new GDS();

            gds = gDSRepository.GetGDS(group.GDSCode);
            if (gds != null)
            {
                group.GDSName = gds.GDSName;
            }

            SubProductRepository subProductRepository = new SubProductRepository();
            SubProduct           subProduct           = new SubProduct();

            subProduct = subProductRepository.GetSubProduct(group.SubProductId);
            if (subProduct != null)
            {
                group.SubProductName = subProduct.SubProductName;

                Product product = new Product();
                product           = subProductRepository.GetSubProductProduct(group.SubProductId);
                group.ProductId   = product.ProductId;
                group.ProductName = product.ProductName;
            }


            HierarchyRepository hierarchyRepository = new HierarchyRepository();

            fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result();

            hierarchy = GetGroupHierarchy(group.GDSAdditionalEntryId);
            group.GDSAdditionalEntryValue = Regex.Replace(group.GDSAdditionalEntryValue, @"[^\w\-()*]", "-");

            if (hierarchy != null)
            {
                group.HierarchyType = hierarchy.HierarchyType;
                group.HierarchyCode = hierarchy.HierarchyCode.ToString();
                group.HierarchyItem = hierarchy.HierarchyName.Trim();


                if (hierarchy.HierarchyType == "ClientSubUnitTravelerType")
                {
                    group.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString();
                    group.ClientSubUnitName = hierarchy.HierarchyName.Trim();
                    group.TravelerTypeGuid  = hierarchy.TravelerTypeGuid;
                    group.TravelerTypeName  = hierarchy.TravelerTypeName.Trim();
                }
            }
        }
        //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;
                }
            }
        }
Example #5
0
        //Add Data From Linked Tables for Display
        public void EditItemForDisplay(TripTypeItem tripTypeItem)
        {
            //Add Descrription
            TripTypeRepository tripTypeRepository = new TripTypeRepository();
            TripType           tripType           = new TripType();

            tripType = tripTypeRepository.GetTripType(tripTypeItem.TripTypeId);
            if (tripType != null)
            {
                tripTypeItem.TripTypeDescription = tripType.TripTypeDescription;
            }

            //Add PolicyGroupName
            TripTypeGroupRepository tripTypeGroupRepository = new TripTypeGroupRepository();
            TripTypeGroup           tripTypeGroup           = new TripTypeGroup();

            tripTypeGroup = tripTypeGroupRepository.GetGroup(tripTypeItem.TripTypeGroupId);
            if (tripTypeGroup != null)
            {
                tripTypeItem.TripTypeGroupName = tripTypeGroup.TripTypeGroupName;
            }
        }
Example #6
0
        //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;
            }
        }