public IReportRequest GenerateReportRequest(DateTime runDate, string reportName, SushiCounterRepositoryArguments arguments, string releaseVersion) { return(new ReportRequest { ID = "", Created = DateTime.UtcNow, Requestor = new Requestor { Email = "*****@*****.**", ID = arguments.RequestorID, Name = "Taylor University" }, CustomerReference = new CustomerReference { ID = arguments.CustomerID, Name = "Taylor University" }, ReportDefinition = new ReportDefinition { Name = reportName, Release = releaseVersion, Filters = new ReportDefinitionFilters { UsageDateRange = LiftMonthRange(runDate), //Filter = new Sushi.FilterName[] { new Sushi.FilterName() { Name = "ExcludeZeroUsage", Value = "False" }} } }, PlatformCorrections = arguments.PlatformCorrections, }); }
public static ICounterRepository CreateCounterRepository(RepositoryArgumentsBase arguments) { switch (arguments) { case SushiCounterRepositoryArguments repositoryArguments: { BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0) }; LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress> factory; switch (repositoryArguments.Version) { case "3.0": case "3": factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_3_0.SushiServiceInterfaceClient(binding, address)); break; case "4.0": case "4": factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_4_0.SushiServiceInterfaceClient(binding, address)); break; case "4.1": case "": case null: factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new SushiServiceInterfaceClient(binding, address)); break; default: throw new NotImplementedException(@"Sushi Version is not supported: {repositoryArguments.Version}. Try 4.1"); } return(new SushiCounterRepository(repositoryArguments, factory)); } case EbscoHostCounterRepositoryArguments ebscoRepositoryArguments: { BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0), }; var sushiFactory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new SushiServiceInterfaceClient(binding, address)); var sushiRepoFactory = LambdaFactory.Wrap <SushiCounterRepository, SushiCounterRepositoryArguments>(s => new SushiCounterRepository(s, sushiFactory)); return(new EbscoHostCounterRepository(ebscoRepositoryArguments, sushiRepoFactory)); } case EmailRepositoryArguments emailRepositoryArguments: return(new EmailRepository(emailRepositoryArguments)); case SushiMuseCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); CustomBinding binding = new CustomBinding( new CustomTextMessageBindingElement("iso-8859-1", "text/xml", MessageVersion.Soap11), new HttpTransportBindingElement()); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_3_0.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiMpsCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); BasicHttpBinding binding = new BasicHttpBinding { MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = new TimeSpan(0, 6, 0), ReceiveTimeout = new TimeSpan(0, 6, 0), }; var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new MPSInsight.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiGaleCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); var binding = new CustomBinding(new BasicHttpBinding("SushiService4")); binding.Elements.Remove <TextMessageEncodingBindingElement>(); binding.Elements.Insert(0, new CustomTextMessageBindingElement(null, "text/html", MessageVersion.Soap11)); var httpTransportBindingElement = binding.Elements.Find <HttpTransportBindingElement>(); httpTransportBindingElement.MaxReceivedMessageSize = Int32.MaxValue; binding.Elements.Remove <HttpTransportBindingElement>(); binding.Elements.Add(httpTransportBindingElement); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Gale.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } case SushiJstorCounterRepositoryArguments sushiArgs: { SushiCounterRepositoryArguments counterArgumentsnew = SushiCounterRepositoryArguments(sushiArgs); var binding = new CustomBinding(new BasicHttpBinding(BasicHttpSecurityMode.Transport) { MaxReceivedMessageSize = Int32.MaxValue, SendTimeout = TimeSpan.FromMinutes(4) }); binding.Elements.Remove <TextMessageEncodingBindingElement>(); binding.Elements.Insert(0, new CustomTextMessageBindingElement(null, null, MessageVersion.Soap11)); var factory = new LambdaFactory <ISushiServiceInterfaceClient, EndpointAddress>(address => new Journal.Sushi_4_0.SushiServiceInterfaceClient(binding, address)); return(new SushiCounterRepository(counterArgumentsnew, factory)); } default: throw new NotImplementedException(); } }