Skip to content

Commit 15be66b

Browse files
committed
Add project files.
1 parent 45a9ff4 commit 15be66b

File tree

92 files changed

+3998
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3998
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace eBirdDataVisualizer.Core.Contracts.Services;
2+
3+
public interface IFileService
4+
{
5+
T Read<T>(string folderPath, string fileName);
6+
7+
void Save<T>(string folderPath, string fileName, T content);
8+
9+
void Delete(string folderPath, string fileName);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using eBirdDataVisualizer.Core.Models;
2+
3+
namespace eBirdDataVisualizer.Core.Contracts.Services;
4+
5+
// Remove this class once your pages/features are using your data.
6+
public interface ISampleDataService
7+
{
8+
Task<IEnumerable<SampleOrder>> GetContentGridDataAsync();
9+
10+
Task<IEnumerable<SampleOrder>> GetGridDataAsync();
11+
12+
Task<IEnumerable<SampleOrder>> GetListDetailsDataAsync();
13+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Newtonsoft.Json;
2+
3+
namespace eBirdDataVisualizer.Core.Helpers;
4+
5+
public static class Json
6+
{
7+
public static async Task<T> ToObjectAsync<T>(string value)
8+
{
9+
return await Task.Run<T>(() =>
10+
{
11+
return JsonConvert.DeserializeObject<T>(value);
12+
});
13+
}
14+
15+
public static async Task<string> StringifyAsync(object value)
16+
{
17+
return await Task.Run<string>(() =>
18+
{
19+
return JsonConvert.SerializeObject(value);
20+
});
21+
}
22+
}
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace eBirdDataVisualizer.Core.Models;
8+
9+
/// <summary>
10+
/// Class for dispalying (initially) frequency of observations data
11+
/// </summary>
12+
///
13+
14+
15+
16+
public class Bird
17+
{
18+
public int BirdId
19+
{
20+
get; set;
21+
}
22+
23+
public string CommonName
24+
{
25+
get; set;
26+
}
27+
28+
public string ScientificName
29+
{
30+
get; set;
31+
}
32+
33+
public ICollection<double> Frequency
34+
{
35+
get; set;
36+
}
37+
38+
public override string ToString() => $"{CommonName} ({ScientificName})";
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
namespace eBirdDataVisualizer.Core.Models;
2+
3+
// Model for the SampleDataService. Replace with your own model.
4+
public class SampleCompany
5+
{
6+
public string CompanyID
7+
{
8+
get; set;
9+
}
10+
11+
public string CompanyName
12+
{
13+
get; set;
14+
}
15+
16+
public string ContactName
17+
{
18+
get; set;
19+
}
20+
21+
public string ContactTitle
22+
{
23+
get; set;
24+
}
25+
26+
public string Address
27+
{
28+
get; set;
29+
}
30+
31+
public string City
32+
{
33+
get; set;
34+
}
35+
36+
public string PostalCode
37+
{
38+
get; set;
39+
}
40+
41+
public string Country
42+
{
43+
get; set;
44+
}
45+
46+
public string Phone
47+
{
48+
get; set;
49+
}
50+
51+
public string Fax
52+
{
53+
get; set;
54+
}
55+
56+
public ICollection<SampleOrder> Orders
57+
{
58+
get; set;
59+
}
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
namespace eBirdDataVisualizer.Core.Models;
2+
3+
// Model for the SampleDataService. Replace with your own model.
4+
public class SampleOrder
5+
{
6+
public long OrderID
7+
{
8+
get; set;
9+
}
10+
11+
public DateTime OrderDate
12+
{
13+
get; set;
14+
}
15+
16+
public DateTime RequiredDate
17+
{
18+
get; set;
19+
}
20+
21+
public DateTime ShippedDate
22+
{
23+
get; set;
24+
}
25+
26+
public string ShipperName
27+
{
28+
get; set;
29+
}
30+
31+
public string ShipperPhone
32+
{
33+
get; set;
34+
}
35+
36+
public double Freight
37+
{
38+
get; set;
39+
}
40+
41+
public string Company
42+
{
43+
get; set;
44+
}
45+
46+
public string ShipTo
47+
{
48+
get; set;
49+
}
50+
51+
public double OrderTotal
52+
{
53+
get; set;
54+
}
55+
56+
public string Status
57+
{
58+
get; set;
59+
}
60+
61+
public int SymbolCode
62+
{
63+
get; set;
64+
}
65+
66+
public string SymbolName
67+
{
68+
get; set;
69+
}
70+
71+
public char Symbol => (char)SymbolCode;
72+
73+
public ICollection<SampleOrderDetail> Details
74+
{
75+
get; set;
76+
}
77+
78+
public string ShortDescription => $"Order ID: {OrderID}";
79+
80+
public override string ToString() => $"{Company} {Status}";
81+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
namespace eBirdDataVisualizer.Core.Models;
2+
3+
// Model for the SampleDataService. Replace with your own model.
4+
public class SampleOrderDetail
5+
{
6+
public long ProductID
7+
{
8+
get; set;
9+
}
10+
11+
public string ProductName
12+
{
13+
get; set;
14+
}
15+
16+
public int Quantity
17+
{
18+
get; set;
19+
}
20+
21+
public double Discount
22+
{
23+
get; set;
24+
}
25+
26+
public string QuantityPerUnit
27+
{
28+
get; set;
29+
}
30+
31+
public double UnitPrice
32+
{
33+
get; set;
34+
}
35+
36+
public string CategoryName
37+
{
38+
get; set;
39+
}
40+
41+
public string CategoryDescription
42+
{
43+
get; set;
44+
}
45+
46+
public double Total
47+
{
48+
get; set;
49+
}
50+
51+
public string ShortDescription => $"Product ID: {ProductID} - {ProductName}";
52+
}

eBirdDataVisualizer.Core/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*Recommended Markdown Viewer: [Markdown Editor](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor2)*
2+
3+
## Getting Started
4+
5+
The Core project contains code that can be [reused across multiple application projects](https://docs.microsoft.com/dotnet/standard/net-standard#net-5-and-net-standard).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using eBirdDataVisualizer.Core.Models;
8+
9+
namespace eBirdDataVisualizer.Core.Services;
10+
public class BirdDataService
11+
{
12+
static DataSet DataSet = new DataSet();
13+
static DataTable Birds = new DataTable(nameof(Birds));
14+
static DataColumn BirdId = new DataColumn(nameof(BirdId), typeof(Int32));
15+
static DataColumn CommonName = new DataColumn(nameof(CommonName), typeof(string));
16+
static DataColumn ScientificName = new DataColumn(nameof(ScientificName), typeof(string));
17+
static DataColumn Frequency = new DataColumn(nameof(Frequency), typeof(List<double>));
18+
19+
private static List<Bird> allBirds;
20+
21+
static BirdDataService()
22+
{
23+
Birds.Columns.Add(BirdId);
24+
Birds.Columns.Add(CommonName);
25+
Birds.Columns.Add(ScientificName);
26+
Birds.Columns.Add(Frequency);
27+
28+
Birds.Rows.Add(0, "Black-bellied Whistling-Duck", "Dendrocygna autumnalis", new List<double>() { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.655E-4, 2.082E-4, 4.693E-4, 4.624E-4, 8.357E-4, 9.092E-4, 8.3E-5, 0.0012603, 0.0012944, 4.97E-5, 0.0015, 0.0010597, 4.18E-4, 7.671E-4, 1.218E-4, 6.09E-5, 0.0, 0.0, 0.0019542, 0.0, 4.4E-5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 });
29+
30+
Birds.Rows.Add(1, "Emu", "Dromaius novaehollandiae", new List<double>() { 0.0, 0.0, 0.0, 0.0, 4.44E-5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 });
31+
32+
Birds.Rows.Add(1, "Snow Goose", "Anser caerulescens", new List<double>() { 0.0164127, 0.0130752, 0.0147944, 0.0115589, 0.0134523, 0.0070272, 0.0060272, 0.0100091, 0.0097213, 0.0075751, 0.0053493, 0.0031462, 0.0010052, 6.83E-4, 6.52E-4, 4.76E-4, 4.164E-4, 7.41E-5, 3.391E-4, 2.279E-4, 1.186E-4, 8.3E-5, 1.8E-4, 0.0, 1.491E-4, 5.39E-5, 5.89E-5, 4.18E-5, 1.18E-4, 1.828E-4, 1.218E-4, 7.95E-5, 2.555E-4, 6.514E-4, 9.051E-4, 0.0011868, 0.0010745, 0.0026718, 0.0040783, 0.0059102, 0.0064931, 0.0110383, 0.0122762, 0.0232245, 0.0200967, 0.0151272, 0.0184791, 0.030209 });
33+
34+
DataSet.Tables.Add(Birds);
35+
}
36+
37+
public BirdDataService()
38+
{
39+
40+
}
41+
42+
private static IEnumerable<Bird> AllBirds()
43+
{
44+
List<Bird> birds = new List<Bird>();
45+
foreach (DataRow row in DataSet.Tables[DataSet.Tables.IndexOf(Birds)].Rows)
46+
{
47+
birds.Add(new Bird()
48+
{
49+
BirdId = (int)row[BirdId],
50+
CommonName = (string)row[CommonName],
51+
ScientificName = (string)row[ScientificName],
52+
Frequency = (List<double>)row[Frequency]
53+
});
54+
}
55+
return birds;
56+
}
57+
58+
public async Task<IEnumerable<Bird>> GetGridDataAsync()
59+
{
60+
if (allBirds == null)
61+
{
62+
allBirds = new List<Bird>(AllBirds());
63+
}
64+
65+
await Task.CompletedTask;
66+
return allBirds;
67+
}
68+
}

0 commit comments

Comments
 (0)