Skip to content

Commit

Permalink
0.51.0
Browse files Browse the repository at this point in the history
This closes #20 and closes #22
  • Loading branch information
coni2k committed Mar 22, 2016
1 parent a077075 commit 50d0a66
Show file tree
Hide file tree
Showing 138 changed files with 2,451 additions and 2,009 deletions.
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/ElementCellTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ElementCellTests
[TestMethod]
public void NewElementCell_ShouldCreate()
{
var user = new User("User");
var user = new User("User", "[email protected]");
var newElement = new ResourcePool(user, "CMRP")
.AddElement("Element");

Expand Down
6 changes: 3 additions & 3 deletions BusinessObjects.Tests/ElementFieldIndexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ElementFieldIndexTests
[TestMethod]
public void NewElementFieldIndex_ShouldCreate()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddField("Field", ElementFieldDataType.Boolean, true)
Expand All @@ -21,7 +21,7 @@ public void NewElementFieldIndex_ShouldCreate()
[ExpectedException(typeof(ArgumentNullOrDefaultException))]
public void NewElementFieldIndexWithInvalidConstructor_Exception()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddField("Field", ElementFieldDataType.String)
Expand All @@ -32,7 +32,7 @@ public void NewElementFieldIndexWithInvalidConstructor_Exception()
[ExpectedException(typeof(ArgumentException))]
public void NewElementFieldIndexOnStringType_Exception()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddField("Field", ElementFieldDataType.String)
Expand Down
4 changes: 2 additions & 2 deletions BusinessObjects.Tests/ElementFieldTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ElementFieldTests
[TestMethod]
public void NewElementField_ShouldCreate()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddField("Field", ElementFieldDataType.String);
Expand All @@ -19,7 +19,7 @@ public void NewElementField_ShouldCreate()
[ExpectedException(typeof(ArgumentException))]
public void NewElementWithInvalidConstructor_Exception()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddField("Field", ElementFieldDataType.Boolean);
Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/ElementItemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ElementItemTests
[TestMethod]
public void NewElementItem_ShouldCreate()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element")
.AddItem("Item");
Expand Down
4 changes: 2 additions & 2 deletions BusinessObjects.Tests/ElementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ElementTests
[TestMethod]
public void NewElement_ShouldCreate()
{
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "CMRP")
.AddElement("Element");
}
Expand All @@ -18,7 +18,7 @@ public void NewElement_ShouldCreate()
public void AddField_SortOrder_ShouldCalculate()
{
// Arrange
var user = new User("User");
var user = new User("User", "[email protected]");
var element = new ResourcePool(user, "CMRP")
.AddElement("Element");

Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/ResourcePoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ResourcePoolTests
public void NewResourcePool_ShouldCreate()
{
// Arrange + act
var user = new User("User");
var user = new User("User", "[email protected]");
new ResourcePool(user, "Default");
}
}
Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/UserElementCellTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UserElementCellTests
[TestMethod]
public void NewUserElementCell_ShouldCreate()
{
var newUser = new User("Email");
var newUser = new User("User", "[email protected]");

var newElement = new ResourcePool(newUser, "CMRP")
.AddElement("Element");
Expand Down
4 changes: 2 additions & 2 deletions BusinessObjects.Tests/UserElementFieldIndexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class UserElementFieldIndexTests
[TestMethod]
public void NewUserElementFieldIndex_ShouldCreate()
{
var user = new User("Email");
var user = new User("User", "[email protected]");

var resourcePool = new ResourcePool(user, "CMRP");

var newIndex = resourcePool
Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/UserResourcePoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UserResourcePoolTests
[TestMethod]
public void NewUserResourcePool_ShouldCreate()
{
var user = new User("Email");
var user = new User("User", "[email protected]");
var resourcePool = new ResourcePool(user, "CMRP")
.AddUserResourcePool(user, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects.Tests/UserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UserTests
[TestMethod]
public void NewUser_ShouldCreate()
{
new User("a valid email address?");
new User("A valid username?", "A valid email address?");
}
}
}
15 changes: 0 additions & 15 deletions BusinessObjects/Attributes/DefaultPropertyAttribute.cs

This file was deleted.

15 changes: 0 additions & 15 deletions BusinessObjects/Attributes/DisplayOnEditViewAttribute.cs

This file was deleted.

15 changes: 0 additions & 15 deletions BusinessObjects/Attributes/DisplayOnListViewAttribute.cs

This file was deleted.

21 changes: 6 additions & 15 deletions BusinessObjects/BaseEntity.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
using forCrowd.WealthEconomy.BusinessObjects.Attributes;
using System;
using System.ComponentModel.DataAnnotations;
using System.Security.Permissions;

namespace forCrowd.WealthEconomy.BusinessObjects
namespace forCrowd.WealthEconomy.BusinessObjects
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Security.Permissions;

[PrincipalPermission(SecurityAction.Demand, Authenticated = false)]
public abstract class BaseEntity : IEntity
{
[DisplayOnListView(false)]
[DisplayOnEditView(false)]
public DateTime CreatedOn { get; set; }

[DisplayOnListView(false)]
[DisplayOnEditView(false)]
public DateTime ModifiedOn { get; set; }

[DisplayOnListView(false)]
[DisplayOnEditView(false)]
public Nullable<DateTime> DeletedOn { get; set; }
public DateTime? DeletedOn { get; set; }

[Timestamp]
[DisplayOnListView(false)]
[DisplayOnEditView(false)]
public byte[] RowVersion { get; set; }
}
}
3 changes: 0 additions & 3 deletions BusinessObjects/BusinessObjects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
<Compile Include="Models\ResourcePool.cs" />
<Compile Include="Models\User.cs" />
<Compile Include="Models\UserResourcePool.cs" />
<Compile Include="Attributes\DefaultPropertyAttribute.cs" />
<Compile Include="Attributes\DisplayOnEditViewAttribute.cs" />
<Compile Include="Attributes\DisplayOnListViewAttribute.cs" />
<Compile Include="IEntity.cs" />
<Compile Include="WealthEconomyContext.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion BusinessObjects/IEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public interface IEntity
{
DateTime CreatedOn { get; set; }
DateTime ModifiedOn { get; set; }
Nullable<DateTime> DeletedOn { get; set; }
DateTime? DeletedOn { get; set; }
byte[] RowVersion { get; set; }
}
}
6 changes: 0 additions & 6 deletions BusinessObjects/Models/Element.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
namespace forCrowd.WealthEconomy.BusinessObjects
{
using forCrowd.WealthEconomy.BusinessObjects.Attributes;
using forCrowd.WealthEconomy.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;

[forCrowd.WealthEconomy.BusinessObjects.Attributes.DefaultProperty("Name")]
// [ODataControllerAuthorization("Administrator")]
public class Element : BaseEntity
{
Expand All @@ -30,18 +28,14 @@ public Element(ResourcePool resourcePool, string name)
Name = name;
}

[DisplayOnListView(false)]
[DisplayOnEditView(false)]
public int Id { get; set; }

public int ResourcePoolId { get; set; }

[Display(Name = "Element")]
[Required]
[StringLength(50)]
public string Name { get; set; }

[Display(Name = "Is Main Element")]
[Required]
public bool IsMainElement { get; set; }

Expand Down
17 changes: 2 additions & 15 deletions BusinessObjects/Models/ElementCell.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
namespace forCrowd.WealthEconomy.BusinessObjects
{
using forCrowd.WealthEconomy.BusinessObjects.Attributes;
using forCrowd.WealthEconomy.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;

[DisplayName("Element Cell")]
[forCrowd.WealthEconomy.BusinessObjects.Attributes.DefaultProperty("Id")]
// [ODataControllerAuthorization("Administrator")]
public class ElementCell : BaseEntity
{
Expand All @@ -30,39 +25,31 @@ public ElementCell(ElementField field, ElementItem item)
ElementItem = item;
}

[DisplayOnListView(false)]
[DisplayOnEditView(false)]
[Display(Name = "Element Cell Id")]
public int Id { get; set; }

[Index("IX_ElementCellId", 1, IsUnique = true)]
[Index("UX_ElementCell_ElementFieldId_ElementItemId", 1, IsUnique = true)]
public int ElementFieldId { get; set; }

[Index("IX_ElementCellId", 2, IsUnique = true)]
[Index("UX_ElementCell_ElementFieldId_ElementItemId", 2, IsUnique = true)]
public int ElementItemId { get; set; }

[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public string StringValue { get; private set; }

// TODO Doesn't have to be nullable but it requires a default value then which needs to be done
// by manually editing migration file which is not necessary at the moment / SH - 03 Aug. '15
[DisplayOnListView(false)]
[DisplayOnEditView(false)]
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public decimal? NumericValueTotal { get; private set; }

// TODO Doesn't have to be nullable but it requires a default value then which needs to be done
// by manually editing migration file which is not necessary at the moment / SH - 03 Aug. '15
[DisplayOnListView(false)]
[DisplayOnEditView(false)]
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public int? NumericValueCount { get; private set; }

/// <summary>
/// In case this cell's field type is Element, this is the selected item for this cell.
/// Other values are stored on UserElementCell, but since this one has FK, it's directly set on ElementCell.
/// </summary>
[Display(Name = "Selected Element Item")]
public int? SelectedElementItemId { get; set; }

public virtual ElementItem ElementItem { get; set; }
Expand Down
Loading

0 comments on commit 50d0a66

Please sign in to comment.