| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- 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 CraftEmployeeModel
- {
- #region Properties
- /// <summary>
- /// Craft employee model index
- /// </summary>
- public int? Index { get; set; }
- /// <summary>
- /// Craft employee Dictionary identifier
- /// </summary>
- public string DictIdentifier { get; set; }
- /// <summary>
- /// Craft employee id
- /// </summary>
- public int Id { get; set; }
- /// <summary>
- /// Craft id
- /// </summary>
- [Display(Name = "ID")]
- public int CraftId { get; set; }
- /// <summary>
- /// Craft
- /// </summary>
- [Display(Name = "Gewerk")]
- public virtual CraftModel Craft { get; set; }
- /// <summary>
- /// Employee id
- /// </summary>
- [Display(Name = "Mitarbeiter")]
- public int EmployeeId { get; set; }
- /// <summary>
- /// Employee
- /// </summary>
- [Display(Name = "Mitarbeiter")]
- public virtual EmployeeModel Employee { get; set; }
- /// <summary>
- /// The amount of employee working hours
- /// </summary>
- [Display(Name = "Menge / Dauer")]
- public float Amount
- {
- get
- {
- return String.IsNullOrEmpty(AmountText)
- ? 0
- : Convert.ToSingle(AmountText.Replace('.',','));
- }
- set
- {
- AmountText = value.ToString();
- }
- }
- /// <summary>
- /// The amount of employee working hours as text
- /// </summary>
- [Display(Name = "Menge / Dauer")]
- public string AmountText { get; set; }
- /// <summary>
- /// The value of the employee working hours
- /// </summary>
- [Display(Name = "Wert")]
- [DisplayFormat(ApplyFormatInEditMode = false, DataFormatString = "{0:C}")]
- public float Value { get; set; }
- /// <summary>
- /// Craft employee comment
- /// </summary>
- [Display(Name = "Kommentar")]
- public string Comment { get; set; }
- #endregion
- #region Ctor
- /// <summary>
- /// Initializes a new instance of the CraftEmployeeModel class
- /// </summary>
- public CraftEmployeeModel() { }
- /// <summary>
- /// Initializes a new instance of the CraftEmployeeModel class
- /// </summary>
- /// <param name="craftEmployee">The base craft employee.</param>
- public CraftEmployeeModel(CraftEmployee craftEmployee)
- {
- if (craftEmployee == null) return;
- Id = craftEmployee.Id;
- CraftId = craftEmployee.CraftId;
- EmployeeId = craftEmployee.EmployeeId;
- Employee = new EmployeeModel(craftEmployee.Employee);
- Amount = craftEmployee.Amount;
- Value = craftEmployee.Value;
- Comment = craftEmployee.Comment;
- }
- #endregion
- }
- }
|