public FloodingRequestMapperTests()
        {
            _floodingPavementConfiguration = new FloodingConfiguration
            {
                VerintOption = new Option
                {
                    Classification = "Public Realm >> Highways >> Flooded Roadway",
                    EventTitle     = "Flooded pavement",
                    Type           = "pavement",
                    EventCode      = 2002592
                }
            };

            _floodingRoadConfiguration = new FloodingConfiguration
            {
                VerintOption = new Option
                {
                    Classification = "Public Realm >> Highways >> Flooded Roadway",
                    EventTitle     = "Flooded road",
                    Type           = "road",
                    EventCode      = 2002695
                }
            };

            _floodingHomeConfiguration = new FloodingConfiguration
            {
                VerintOption = new Option
                {
                    Classification = "Public Realm >> Highways >> Flooded Roadway",
                    EventTitle     = "Flooded home",
                    Type           = "home",
                    EventCode      = 2009484
                }
            };

            _roadFloodingLocationConfiguration = new Config
            {
                Type  = "road",
                Value = "Road"
            };

            _pavementFloodingLocationConfiguration = new Config
            {
                Type  = "pavement",
                Value = "Pavement"
            };
        }
Пример #2
0
        public static Case ToCase(
            this FloodingRequest floodingRequest,
            FloodingConfiguration floodingConfiguration,
            FloodingAddress streetResult,
            Config floodingLocationConfig
            )
        {
            var crmCase = new Case
            {
                EventCode      = floodingConfiguration.VerintOption.EventCode,
                Classification = floodingConfiguration.VerintOption.Classification,
                EventTitle     = floodingConfiguration.VerintOption.EventTitle,
                Customer       = new Customer
                {
                    Forename  = floodingRequest.Reporter.FirstName,
                    Surname   = floodingRequest.Reporter.LastName,
                    Email     = floodingRequest.Reporter.EmailAddress,
                    Telephone = floodingRequest.Reporter.PhoneNumber
                },
                Description       = DescriptionBuilder(floodingRequest),
                RaisedByBehaviour = RaisedByBehaviourEnum.Individual,
            };

            if (floodingRequest.DidNotUseMap)
            {
                crmCase.AssociatedWithBehaviour = AssociatedWithBehaviourEnum.Street;
                crmCase.Street = new Street
                {
                    USRN        = streetResult.USRN,
                    Reference   = streetResult.UniqueId,
                    Description = floodingRequest.Reporter.Address.SelectedAddress
                };

                crmCase.FurtherLocationInformation = floodingRequest.Reporter.Address.SelectedAddress;
            }
            else
            {
                if (string.IsNullOrEmpty(floodingRequest.Map.Street))
                {
                    crmCase.Street = new Street
                    {
                        USRN        = ConfirmConstants.USRN,
                        Description = ConfirmConstants.Description,
                        Reference   = ConfirmConstants.USRN
                    };
                }
                else
                {
                    crmCase.AssociatedWithBehaviour = AssociatedWithBehaviourEnum.Street;
                    crmCase.Street = new Street
                    {
                        USRN        = streetResult.USRN,
                        Description = streetResult.Name,
                        Reference   = string.IsNullOrEmpty(streetResult.UniqueId) ? null : streetResult.UniqueId
                    };
                }

                crmCase.FurtherLocationInformation = floodingLocationConfig.Value;
            }

            return(crmCase);
        }