| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace GreenTree.Nachtragsmanagement.Web.Models.Appendix
- {
- public class AppendixDataModel
- {
- public int Id { get; set; }
- public string CustomNumber { get; set; }
- public string Lot { get; set; }
- public decimal? Probability { get; set; }
- public int? OfferingNumber { get; set; }
- public DateTime OfferingDate { get; set; }
- public DateTime NegotiationDate { get; set; }
- public decimal? NegotiationValue { get; set; }
- public bool ProtocolExists { get; set; }
- public int? OrderNumber { get; set; }
- public DateTime OrderDate { get; set; }
- public string Comment { get; set; }
- public int? SiteId { get; set; }
- public string SiteDescription { get; set; }
- public ICollection<int> CategoryValues { get; set; }
- public ICollection<string> CategoryDescriptions { get; set; }
- public ICollection<int> DeviationValues { get; set; }
- public ICollection<string> DeviationDescriptions { get; set; }
- public static AppendixDataModel FromAppendix(Core.Domain.Appendix.Appendix appendixEntity, bool newWhenIsNull)
- {
- if (appendixEntity == null && newWhenIsNull)
- return new AppendixDataModel
- {
- Id = -1
- };
- if (appendixEntity == null && !newWhenIsNull)
- throw new ArgumentNullException("appendixEntity", "Cannot create AppendixDataModel from NULL appendix entity.");
- return new AppendixDataModel
- {
- Id = appendixEntity.Id,
- CustomNumber = appendixEntity.CustomNumber,
- Lot = appendixEntity.Lot,
- Probability = appendixEntity.Probability,
- OfferingNumber = appendixEntity.OfferingNumber,
- OfferingDate = appendixEntity.OfferingDate,
- NegotiationDate = appendixEntity.NegotiationDate,
- NegotiationValue = appendixEntity.NegotiationValue,
- ProtocolExists = appendixEntity.ProtocolExists,
- OrderNumber = appendixEntity.OrderNumber,
- OrderDate = appendixEntity.OrderDate,
- Comment = appendixEntity.Comment,
- SiteId = appendixEntity.SiteId,
- SiteDescription = appendixEntity.Site == null
- ? null
- : appendixEntity.Site.Description,
- CategoryValues =
- appendixEntity.Categories
- .Select(r => r.Id)
- .ToList(),
- CategoryDescriptions =
- appendixEntity.Categories
- .Select(r => r.Description)
- .ToList(),
- DeviationValues =
- appendixEntity.Deviations
- .Select(r => r.Id)
- .ToList(),
- DeviationDescriptions =
- appendixEntity.Deviations
- .Select(r => r.CustomNumber)
- .ToList()
- };
- }
- public Core.Domain.Appendix.Appendix ToAppendix()
- {
- return new Core.Domain.Appendix.Appendix
- {
- Id = this.Id,
- CustomNumber = this.CustomNumber,
- Lot = this.Lot,
- Probability = this.Probability,
- OfferingNumber = this.OfferingNumber,
- OfferingDate = this.OfferingDate,
- NegotiationDate = this.NegotiationDate,
- NegotiationValue = this.NegotiationValue,
- ProtocolExists = this.ProtocolExists,
- OrderNumber = this.OrderNumber,
- OrderDate = this.OrderDate,
- Comment = this.Comment,
- SiteId = this.SiteId
- };
- }
- }
- }
|