using GreenTree.Strohrmann.ERP.Core.Domain.Business;
using GreenTree.Strohrmann.ERP.Web.Models.Shared;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace GreenTree.Strohrmann.ERP.Web.Models.Business
{
public class CraftMaterialModel
{
#region Properties
///
/// Craft material model index
///
public int? Index { get; set; }
///
/// Craft material Dictionary identifier
///
public string DictIdentifier { get; set; }
///
/// Craft id
///
[Display(Name = "ID")]
public int CraftId { get; set; }
///
/// Craft
///
[Display(Name = "Gewerk")]
public virtual CraftModel Craft { get; set; }
///
/// Material id
///
[Display(Name = "Material")]
public int MaterialId { get; set; }
///
/// Material
///
[Display(Name = "Material")]
public MaterialModel Material { get; set; }
///
/// The amount of the material
///
[Display(Name = "Menge")]
public decimal Amount { get; set; }
///
/// The material calculation factor
///
[Display(Name = "Kalkulationsfaktor")]
[DisplayFormat(DataFormatString = "{0:P0}")]
public decimal CalculationFactor { get; set; }
///
/// The value of the employee working hours
///
[Display(Name = "Wert")]
[DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:C}")]
public float Value { get; set; }
#endregion
#region Ctor
///
/// Initializes a new instance of the CraftMaterialModel class
///
public CraftMaterialModel() { }
///
/// Initializes a new instance of the CraftMaterialModel class
///
/// The base craft material.
public CraftMaterialModel(CraftMaterial craftMaterial)
{
if (craftMaterial == null) return;
CraftId = craftMaterial.CraftId;
MaterialId = craftMaterial.MaterialId;
Amount = craftMaterial.Amount;
CalculationFactor = craftMaterial.CalculationFactor;
Value = Convert.ToSingle(craftMaterial.Value);
}
#endregion
}
}