Skip to content

Commit 38d362b

Browse files
authored
Merge pull request #1 from jmayer913/v1.0.0/VersionBranch
V1.0.0/version branch
2 parents 59441f9 + f1b5289 commit 38d362b

File tree

87 files changed

+3512
-100
lines changed

Some content is hidden

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

87 files changed

+3512
-100
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using JMayer.Data.Data;
2+
3+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
4+
5+
/// <summary>
6+
/// The class represents an asset (equipment) that needs to be monitored and work orders can be preformed on it.
7+
/// </summary>
8+
public class Asset : UserEditableDataObject
9+
{
10+
/// <summary>
11+
/// The property gets/sets the common category for the asset.
12+
/// </summary>
13+
public string? Category { get; set; }
14+
15+
/// <summary>
16+
/// The property gets/sets if the asset is online.
17+
/// </summary>
18+
public bool IsOnline { get; set; } = true;
19+
20+
/// <summary>
21+
/// The property gets/sets the make of the asset.
22+
/// </summary>
23+
public string? Make { get; set; }
24+
25+
/// <summary>
26+
/// The property gets/sets who makes the asset.
27+
/// </summary>
28+
public string? Manufacturer { get; set; }
29+
30+
/// <summary>
31+
/// The property gets/sets the identifier the manufacturer uses for the asset.
32+
/// </summary>
33+
public string? ManufacturerNumber { get; set; }
34+
35+
/// <summary>
36+
/// The property gets the parent path as if this asset is the parent.
37+
/// </summary>
38+
/// <remarks>
39+
/// This is only used by the backend when updating the parent path.
40+
/// </remarks>
41+
internal string MeAsParentPath
42+
{
43+
get => ParentID == null ? Name : $"{ParentPath}/{Name}";
44+
}
45+
46+
/// <summary>
47+
/// The property gets/sets the model for the asset.
48+
/// </summary>
49+
public string? Model { get; set; }
50+
51+
/// <summary>
52+
/// The property gets/sets id for the parent of this asset.
53+
/// </summary>
54+
public long? ParentID { get; set; }
55+
56+
/// <summary>
57+
/// The property gets/sets the path of parents for this asset.
58+
/// </summary>
59+
public string? ParentPath { get; set; }
60+
61+
/// <summary>
62+
/// The property gets/sets the how import the asset is to the system.
63+
/// </summary>
64+
public Priority Priority { get; set; } = Priority.Medium;
65+
66+
/// <summary>
67+
/// The property gets/sets the storage location the asset is located in.
68+
/// </summary>
69+
/// <remarks>
70+
/// Only an equipment asset can be assigned a storage location.
71+
/// </remarks>
72+
public long StorageLocationId { get; set; }
73+
74+
/// <summary>
75+
/// The property gets/sets what the asset represents.
76+
/// </summary>
77+
public AssetType Type { get; set; } = AssetType.Equipment;
78+
79+
/// <inheritdoc/>
80+
public Asset() : base() { }
81+
82+
/// <inheritdoc/>
83+
public Asset(Asset copy) : base(copy) { }
84+
85+
/// <inheritdoc/>
86+
public override void MapProperties(DataObject dataObject)
87+
{
88+
base.MapProperties(dataObject);
89+
90+
if (dataObject is Asset asset)
91+
{
92+
Category = asset.Category;
93+
IsOnline = asset.IsOnline;
94+
Make = asset.Make;
95+
Manufacturer = asset.Manufacturer;
96+
ManufacturerNumber = asset.ManufacturerNumber;
97+
Model = asset.Model;
98+
ParentID = asset.ParentID;
99+
ParentPath = asset.ParentPath;
100+
Priority = asset.Priority;
101+
StorageLocationId = asset.StorageLocationId;
102+
Type = asset.Type;
103+
}
104+
}
105+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
3+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
4+
5+
/// <summary>
6+
/// The class manages comparing two Asset objects.
7+
/// </summary>
8+
public class AssetEqualityComparer : IEqualityComparer<Asset>
9+
{
10+
/// <inheritdoc/>
11+
public bool Equals(Asset? x, Asset? y)
12+
{
13+
if (x == null || y == null)
14+
{
15+
return false;
16+
}
17+
18+
return x.Category == y.Category &&
19+
x.CreatedOn == y.CreatedOn &&
20+
x.Description == y.Description &&
21+
x.Integer64ID == y.Integer64ID &&
22+
x.LastEditedOn == y.LastEditedOn &&
23+
x.IsOnline == y.IsOnline &&
24+
x.Make == y.Make &&
25+
x.Manufacturer == y.Manufacturer &&
26+
x.ManufacturerNumber == y.ManufacturerNumber &&
27+
x.Model == y.Model &&
28+
x.Name == y.Name &&
29+
x.ParentID == y.ParentID &&
30+
x.Priority == y.Priority &&
31+
x.Type == y.Type;
32+
}
33+
34+
/// <inheritdoc/>
35+
public int GetHashCode([DisallowNull] Asset obj)
36+
{
37+
throw new NotImplementedException();
38+
}
39+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
2+
3+
/// <summary>
4+
/// The enumeration for the general types of assets.
5+
/// </summary>
6+
public enum AssetType
7+
{
8+
/// <summary>
9+
/// An asset which represents an equipment that needs to be monitored. This
10+
/// type can be taken online/offline and work orders can be created for it.
11+
/// </summary>
12+
Equipment,
13+
14+
/// <summary>
15+
/// An asset which represents an area of storage. This type can have storage
16+
/// locations; where assets or parts are stored for inventory purposes. It cannot
17+
/// be taken online/offline and work orders cannot be created for it.
18+
/// </summary>
19+
Area,
20+
21+
/// <summary>
22+
/// An asset which represents a common grouping of assets. Area or equipment assets
23+
/// would have this as a parent asset. It cannot be taken online/offline and work orders
24+
/// cannot be created for it.
25+
/// </summary>
26+
Group,
27+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using JMayer.Data.Data;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Assets;
5+
6+
/// <summary>
7+
/// The class represents a storage location for an area asset.
8+
/// </summary>
9+
/// <remarks>
10+
/// The OwnerId in the SubUserEditableDataObject will represent an asset.
11+
/// </remarks>
12+
public class StorageLocation : SubUserEditableDataObject
13+
{
14+
/// <summary>
15+
/// The property gets/sets the friendly name (locations concatenated).
16+
/// </summary>
17+
public string FriendlyName
18+
{
19+
get => $"{LocationA}{(!string.IsNullOrWhiteSpace(LocationB) ? $" {LocationB}" : string.Empty)}{(!string.IsNullOrWhiteSpace(LocationC) ? $" {LocationC}" : string.Empty)}";
20+
}
21+
22+
/// <summary>
23+
/// The property gets/sets the name of the A location for the storage location.
24+
/// </summary>
25+
[Required]
26+
public string LocationA { get; set; } = string.Empty;
27+
28+
/// <summary>
29+
/// The property gets/sets the name of the B location for the storage location.
30+
/// </summary>
31+
public string LocationB { get; set; } = string.Empty;
32+
33+
/// <summary>
34+
/// The property gets/sets the name of the C location for the storage location.
35+
/// </summary>
36+
public string LocationC { get; set; } = string.Empty;
37+
38+
/// <inheritdoc/>
39+
public StorageLocation() : base() { }
40+
41+
/// <inheritdoc/>
42+
public StorageLocation(StorageLocation copy) : base(copy) { }
43+
44+
/// <inheritdoc/>
45+
public override void MapProperties(DataObject dataObject)
46+
{
47+
base.MapProperties(dataObject);
48+
49+
if (dataObject is StorageLocation storageLocation)
50+
{
51+
LocationA = storageLocation.LocationA;
52+
LocationB = storageLocation.LocationB;
53+
LocationC = storageLocation.LocationC;
54+
}
55+
}
56+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using JMayer.Data.Data;
2+
3+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
4+
5+
/// <summary>
6+
/// The class represents a part to be used for repairing an asset.
7+
/// </summary>
8+
public class Part : UserEditableDataObject
9+
{
10+
/// <summary>
11+
/// The property gets/sets the common category for the part.
12+
/// </summary>
13+
public string? Category { get; set; }
14+
15+
/// <summary>
16+
/// The property gets/sets the make of the part.
17+
/// </summary>
18+
public string? Make { get; set; }
19+
20+
/// <summary>
21+
/// The property gets/sets who makes the part.
22+
/// </summary>
23+
public string? Manufacturer { get; set; }
24+
25+
/// <summary>
26+
/// The property gets/sets the identifier the manufacturer uses for the part.
27+
/// </summary>
28+
public string? ManufacturerNumber { get; set; }
29+
30+
/// <summary>
31+
/// The property gets/sets the model for the part.
32+
/// </summary>
33+
public string? Model { get; set; }
34+
35+
/// <summary>
36+
/// The property gets/sets is no longer procedured by the manfacturer.
37+
/// </summary>
38+
public bool Obsolete { get; set; }
39+
40+
/// <inheritdoc/>
41+
public Part() : base() { }
42+
43+
/// <inheritdoc/>
44+
public Part(Part copy) : base(copy) { }
45+
46+
/// <inheritdoc/>
47+
public override void MapProperties(DataObject dataObject)
48+
{
49+
base.MapProperties(dataObject);
50+
51+
if (dataObject is Part partDataObject)
52+
{
53+
Category = partDataObject.Category;
54+
Make = partDataObject.Make;
55+
Manufacturer = partDataObject.Manufacturer;
56+
ManufacturerNumber = partDataObject.ManufacturerNumber;
57+
Model = partDataObject.Model;
58+
Obsolete = partDataObject.Obsolete;
59+
}
60+
}
61+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
3+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
4+
5+
/// <summary>
6+
/// The class manages comparing two Part objects.
7+
/// </summary>
8+
public class PartEqualityComparer : IEqualityComparer<Part>
9+
{
10+
/// <inheritdoc/>
11+
public bool Equals(Part? x, Part? y)
12+
{
13+
if (x == null || y == null)
14+
{
15+
return false;
16+
}
17+
18+
return x.Category == y.Category &&
19+
x.CreatedOn == y.CreatedOn &&
20+
x.Description == y.Description &&
21+
x.Integer64ID == y.Integer64ID &&
22+
x.LastEditedOn == y.LastEditedOn &&
23+
x.Make == y.Make &&
24+
x.Manufacturer == y.Manufacturer &&
25+
x.ManufacturerNumber == y.ManufacturerNumber &&
26+
x.Model == y.Model &&
27+
x.Name == y.Name &&
28+
x.Obsolete == y.Obsolete;
29+
}
30+
31+
/// <inheritdoc/>
32+
public int GetHashCode([DisallowNull] Part obj)
33+
{
34+
throw new NotImplementedException();
35+
}
36+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using JMayer.Data.Data;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data.Parts;
5+
6+
/// <summary>
7+
/// The class represents stock for a part at a particular storage location.
8+
/// </summary>
9+
/// <remarks>
10+
/// The OwnerId in the SubUserEditableDataObject will represent a part.
11+
/// </remarks>
12+
public class Stock : SubUserEditableDataObject
13+
{
14+
/// <summary>
15+
/// The property gets/sets the amount of stock at the location for the part.
16+
/// </summary>
17+
[Required]
18+
[Range(0, int.MaxValue)]
19+
public decimal Amount { get; set; }
20+
21+
/// <summary>
22+
/// The property gets/sets the id for the storage location the part is stored at.
23+
/// </summary>
24+
[Required]
25+
public long StorageLocationId { get; set; }
26+
27+
/// <summary>
28+
/// The property gets/sets the name for the storage location the part is stored at.
29+
/// </summary>
30+
/// <remarks>
31+
/// This is only used to display the storage location name in the card grid.
32+
/// </remarks>
33+
public string StorageLocationName { get; set; } = string.Empty;
34+
35+
/// <inheritdoc/>
36+
public Stock() : base() { }
37+
38+
/// <inheritdoc/>
39+
public Stock(Stock copy) : base(copy) { }
40+
41+
/// <inheritdoc/>
42+
public override void MapProperties(DataObject dataObject)
43+
{
44+
base.MapProperties(dataObject);
45+
46+
if (dataObject is Stock stock)
47+
{
48+
Amount = stock.Amount;
49+
StorageLocationId = stock.StorageLocationId;
50+
StorageLocationName = stock.StorageLocationName;
51+
}
52+
}
53+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace JMayer.Example.WebAssemblyBlazor.Shared.Data;
2+
3+
/// <summary>
4+
/// The enumration for the priority so the user understands how imported an object is.
5+
/// </summary>
6+
public enum Priority
7+
{
8+
Low,
9+
Medium,
10+
High,
11+
}

0 commit comments

Comments
 (0)