CraftMaterialModel.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using GreenTree.Strohrmann.ERP.Core.Domain.Business;
  2. using GreenTree.Strohrmann.ERP.Web.Models.Shared;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. namespace GreenTree.Strohrmann.ERP.Web.Models.Business
  9. {
  10. public class CraftMaterialModel
  11. {
  12. #region Properties
  13. /// <summary>
  14. /// Craft material model index
  15. /// </summary>
  16. public int? Index { get; set; }
  17. /// <summary>
  18. /// Craft material Dictionary identifier
  19. /// </summary>
  20. public string DictIdentifier { get; set; }
  21. /// <summary>
  22. /// Craft id
  23. /// </summary>
  24. [Display(Name = "ID")]
  25. public int CraftId { get; set; }
  26. /// <summary>
  27. /// Craft
  28. /// </summary>
  29. [Display(Name = "Gewerk")]
  30. public virtual CraftModel Craft { get; set; }
  31. /// <summary>
  32. /// Material id
  33. /// </summary>
  34. [Display(Name = "Material")]
  35. public int MaterialId { get; set; }
  36. /// <summary>
  37. /// Material
  38. /// </summary>
  39. [Display(Name = "Material")]
  40. public MaterialModel Material { get; set; }
  41. /// <summary>
  42. /// The amount of the material
  43. /// </summary>
  44. [Display(Name = "Menge")]
  45. public decimal Amount { get; set; }
  46. /// <summary>
  47. /// The material calculation factor
  48. /// </summary>
  49. [Display(Name = "Kalkulationsfaktor")]
  50. [DisplayFormat(DataFormatString = "{0:P0}")]
  51. public decimal CalculationFactor { get; set; }
  52. /// <summary>
  53. /// The value of the employee working hours
  54. /// </summary>
  55. [Display(Name = "Wert")]
  56. [DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:C}")]
  57. public float Value { get; set; }
  58. #endregion
  59. #region Ctor
  60. /// <summary>
  61. /// Initializes a new instance of the CraftMaterialModel class
  62. /// </summary>
  63. public CraftMaterialModel() { }
  64. /// <summary>
  65. /// Initializes a new instance of the CraftMaterialModel class
  66. /// </summary>
  67. /// <param name="craftMaterial">The base craft material.</param>
  68. public CraftMaterialModel(CraftMaterial craftMaterial)
  69. {
  70. if (craftMaterial == null) return;
  71. CraftId = craftMaterial.CraftId;
  72. MaterialId = craftMaterial.MaterialId;
  73. Amount = craftMaterial.Amount;
  74. CalculationFactor = craftMaterial.CalculationFactor;
  75. Value = Convert.ToSingle(craftMaterial.Value);
  76. }
  77. #endregion
  78. }
  79. }