Commit 36d77870427fd64a2e27dbbc16afc4dc251535d4
1 parent
39a34d4d
QA merge code
Showing
1 changed file
with
55 additions
and
0 deletions
400-SOURCECODE/AIAHTML5.API/Models/PixelLocator.cs.orig
0 → 100644
1 | +using MongoDB.Bson; | ||
2 | +using MongoDB.Driver; | ||
3 | +using System; | ||
4 | +using System.Collections.Generic; | ||
5 | +using System.Linq; | ||
6 | +using System.Web; | ||
7 | + | ||
8 | +namespace AIAHTML5.API.Models | ||
9 | +{ | ||
10 | + public class PixelLocator | ||
11 | + { | ||
12 | + | ||
13 | + internal static dynamic GetBodyRegionsPixelData(string layerNumber, string bodyViewIndex, string systemNumber, string zoom) | ||
14 | + { | ||
15 | + var client = new MongoClient(); | ||
16 | +<<<<<<< HEAD | ||
17 | + var db = client.GetDatabase("aia"); | ||
18 | +======= | ||
19 | + var db = client.GetDatabase("AIAHTML5"); | ||
20 | +>>>>>>> 0251baa2b1e5cd15177e87c3de034dde7b1f03fb | ||
21 | + | ||
22 | + var col = db.GetCollection<BsonDocument>("DAImages"); | ||
23 | + | ||
24 | + var pipeline = new BsonDocument[] | ||
25 | + { | ||
26 | + new BsonDocument{{"$unwind", "$terms"}}, | ||
27 | + new BsonDocument{ { "$match", new BsonDocument("terms.SystemNumbers", | ||
28 | + Convert.ToInt32(systemNumber)).Add("bodyViewIndex", | ||
29 | + Convert.ToInt32(bodyViewIndex)).Add("layerNumber", | ||
30 | + Convert.ToInt32(layerNumber)).Add("zoom", | ||
31 | + Convert.ToInt32(zoom)) }}, | ||
32 | + new BsonDocument { {"$project", new BsonDocument() | ||
33 | + .Add("_id", 0) | ||
34 | + .Add("terms", 1) | ||
35 | + .Add("bodyRegionId", 1) | ||
36 | + } } | ||
37 | + }; | ||
38 | + | ||
39 | + | ||
40 | + var pixelData = col.Aggregate<BsonDocument>(pipeline).ToList(); | ||
41 | + | ||
42 | + return pixelData.ToJson(); | ||
43 | + } | ||
44 | +<<<<<<< HEAD | ||
45 | +} | ||
46 | +======= | ||
47 | + catch (Exception e) | ||
48 | + { | ||
49 | + string error = e.Message+"..STACKTRACE: "+e.StackTrace; | ||
50 | + return error; | ||
51 | + } | ||
52 | + } | ||
53 | +} | ||
54 | +>>>>>>> 0251baa2b1e5cd15177e87c3de034dde7b1f03fb | ||
55 | +} |