renamed the base name of the model

This commit is contained in:
Paul Schneider 2016-11-28 15:14:58 +01:00
commit 83ca421100
104 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Market
{
public partial class BaseProduct
{
/// <summary>
/// An unique product identifier.
/// </summary>
/// <returns></returns>
[Key(),DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
public string Name { get; set; }
/// <summary>
/// A contractual description for this product.
/// </summary>
/// <returns></returns>
public string Description { get; set; }
/// <summary>
/// Controls wether this product or service
/// may be offered to clients, or simply
/// are internal workflow entry point.
/// </summary>
/// <returns>true when this product belongs to the public catalog.</returns>
public bool Public { get; set; }
}
}

View file

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace Yavsc.Models.Market {
public class Catalog {
public List<Product> Products { get; set; }
public List<Service> Services { get; set; }
}
}

View file

@ -0,0 +1,7 @@
namespace Yavsc.Models.Market {
public interface IUnit<VType> {
string Name { get; }
bool CanConvertFrom(IUnit<VType> other);
VType ConvertFrom (IUnit<VType> other, VType orgValue) ;
}
}

View file

@ -0,0 +1,40 @@
using System;
namespace Yavsc.Models.Market {
/// <summary>
/// Not yet used!
/// </summary>
public class Money : IUnit<decimal>
{
public Money(string name, decimal euroExchangeRate)
{
Name = name;
EuroExchangeRate = euroExchangeRate;
}
public string Name
{
get; private set ;
}
public decimal EuroExchangeRate
{
get; private set ;
}
public bool CanConvertFrom(IUnit<decimal> other)
{
if (other is Money)
return true;
return false;
}
public decimal ConvertFrom(IUnit<decimal> other, decimal orgValue)
{
if (other is Money) {
var om = other as Money;
return orgValue * om.EuroExchangeRate / EuroExchangeRate;
}
throw new NotImplementedException();
}
}
}

View file

@ -0,0 +1,32 @@
namespace Yavsc.Models.Market
{
public partial class Product : BaseProduct
{
/// <summary>
/// Weight in gram
/// </summary>
/// <returns></returns>
public decimal Weight { get; set; }
/// <summary>
/// Height in meter
/// </summary>
/// <returns></returns>
public decimal Height { get; set; }
/// <summary>
/// Width in meter
/// </summary>
/// <returns></returns>
public decimal Width { get; set; }
public decimal Depth { get; set; }
/// <summary>
/// In euro
/// </summary>
/// <returns></returns>
public decimal? Price { get; set; }
// TODO make use of public Money Money { get; set; }
}
}

View file

@ -0,0 +1,31 @@
namespace Yavsc.Models.Market {
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Billing;
public partial class Service : BaseProduct
{
public string ContextId { get; set; }
[ForeignKey("ContextId")]
public virtual Activity Context { get; set; }
/// <summary>
/// List of billing clause,
/// associated to this service,
/// that defines the transformation rules
/// to take in account during the transformation
/// of a corresponding prestation to an amount to pay.
/// This property is built at constructing a new instance
/// and is not mapped in database.
/// For the moment, it's hard coded only.
/// </summary>
/// <returns></returns>
[NotMapped]
public List<IBillingClause> Billing { get; set; }
}
}