Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
1,039 changes: 1,039 additions & 0 deletions OrdersSearchWebService/.vs/config/applicationhost.config

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions OrdersSearchWebService/OrdersSearchWebService.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrdersSearchWebService", "OrdersSearchWebService\OrdersSearchWebService.csproj", "{401510E5-FBE1-45B7-82CC-1D682972B578}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{401510E5-FBE1-45B7-82CC-1D682972B578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{401510E5-FBE1-45B7-82CC-1D682972B578}.Debug|Any CPU.Build.0 = Debug|Any CPU
{401510E5-FBE1-45B7-82CC-1D682972B578}.Release|Any CPU.ActiveCfg = Release|Any CPU
{401510E5-FBE1-45B7-82CC-1D682972B578}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
<!-- Extended list of bots:
search|spider|crawl|Bot|Monitor|BrowserMob|BingPreview|PagePeeker|WebThumb|URL2PNG|ZooShot|GomezA|Google SketchUp|Read Later|KTXN|KHTE|Keynote|Pingdom|AlwaysOn|zao|borg|oegp|silk|Xenu|zeal|NING|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|Java|JNLP|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr-agent|http client|Python-urllib|AppEngine-Google|semanticdiscovery|facebookexternalhit|web/snippet|Google-HTTP-Java-Client-->
<Filters>search|spider|crawl|Bot|Monitor|AlwaysOn</Filters>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
Use the following syntax here to collect additional performance counters:

<Counters>
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
...
</Counters>

PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName

NOTE: performance counters configuration will be lost upon NuGet upgrade.

The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
<Handlers>
<!--
Add entries here to filter out additional handlers:

NOTE: handler configuration will be lost upon NuGet upgrade.
-->
<Add>System.Web.Handlers.TransferRequestHandler</Add>
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
<Add>System.Web.StaticFileHandler</Add>
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
<Add>System.Web.Optimization.BundleHandler</Add>
<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
<Add>System.Web.Handlers.TraceHandler</Add>
<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
<Add>System.Web.HttpDebugHandler</Add>
</Handlers>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
</TelemetryModules>
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
</Add>
</TelemetryProcessors>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840

Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
--></ApplicationInsights>
136 changes: 136 additions & 0 deletions OrdersSearchWebService/OrdersSearchWebService/JsonData/Orders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
[
{
"OrderID": 36,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-12T05:10:00",
"Status": 10,
"Code": "R4C877FF",
"MSA": 1,
"Duration": "92.00",
"OfferType": 1
},
{
"OrderID": 37,
"ShipperID": 4,
"DriverID": 243,
"CompletionDte": "2018-02-15T05:10:00",
"Status": 10,
"Code": "R47077FF",
"MSA": 1,
"Duration": "43.00",
"OfferType": 1
},
{
"OrderID": 38,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R6453FF",
"MSA": 2,
"Duration": "120.00",
"OfferType": 1
},
{
"OrderID": 39,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R4C877DS",
"MSA": 4,
"Duration": "15.00",
"OfferType": 1
},
{
"OrderID": 40,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R4C9999F",
"MSA": 1,
"Duration": "111.00",
"OfferType": 1
},
{
"OrderID": 41,
"ShipperID": 67,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R4C87S32",
"MSA": 1,
"Duration": "54.00",
"OfferType": 1
},
{
"OrderID": 42,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R4C87123",
"MSA": 1,
"Duration": "92.00",
"OfferType": 1
},
{
"OrderID": 43,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R42G77FF",
"MSA": 1,
"Duration": "40.00",
"OfferType": 1
},
{
"OrderID": 44,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 10,
"Code": "R4002WFF",
"MSA": 1,
"Duration": "92.00",
"OfferType": 2
},
{
"OrderID": 45,
"ShipperID": 4,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 20,
"Code": "R400KHFF",
"MSA": 3,
"Duration": "23.00",
"OfferType": 1
},
{
"OrderID": 46,
"ShipperID": 24,
"DriverID": 35,
"CompletionDte": "2018-01-31T05:10:00",
"Status": 61,
"Code": "R4C437FF",
"MSA": 1,
"Duration": "92.00",
"OfferType": 1
},
{
"OrderID": 47,
"ShipperID": 121,
"DriverID": 35,
"CompletionDte": "2018-03-1T05:10:00",
"Status": 10,
"Code": "R422AQF",
"MSA": 1,
"Duration": "66.00",
"OfferType": 2
}

]

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="OrderSearchService.asmx.cs" Class="OrdersSearchWebService.OrderSearchService" %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using Newtonsoft.Json;
using OrdersSearchWebService.ViewModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace OrdersSearchWebService
{
/// <summary>
/// Summary description for OrderSearchService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class OrderSearchService : System.Web.Services.WebService
{

[WebMethod]
public List<Orders> SearchOrder(SearchOrderViewModel model, int page, int pageSize)
{
List<Orders> returnData = new List<Orders>();
bool modelValidation = false;
if (model.CompletionDte != null)
{
if (model.MSA > 0 && model.Status > 0)
{
modelValidation = true;
}
else if (model.OrderId > 0)
{
modelValidation = true;
}
}

if (modelValidation)
{
var data = GetJsondata();
if (data?.Any() ?? false)
{
returnData = data
.Where(x => (x.OrderId == model.OrderId || (x.MSA == model.MSA && x.Status == model.Status)) && x.CompletionDte.Date == model.CompletionDte.Date)?
.Skip(page * pageSize).Take(pageSize).ToList();

}
}
return returnData;
}

private List<Orders> GetJsondata()
{
using (StreamReader r = new StreamReader(Server.MapPath("~/JsonData/Orders.json")))
{
string json = r.ReadToEnd();
List<Orders> ro = JsonConvert.DeserializeObject<List<Orders>>(json);
return ro;
}
}
}
}
Loading