Files
BeWoPlaner/BeWoPlanerMobil/Util/GroupBookingSelectionObject.cs

47 lines
1.9 KiB
C#

using System.Collections.Generic;
using BeWoPlanerMobil.Models;
using BS.Shared.DataContracts;
namespace BeWoPlanerMobil.Util
{
public class GroupBookingSelectionObject
{
public List<CustomSelectListItem> SelectedRelations { get; set; } = new List<CustomSelectListItem>();
public IEnumerable<long> GroupOids { get; set; }
public GroupBookingSelectionObject(IEnumerable<SupportConceptCostBearerRelDC> selectedConceptCostBearerRelations, IEnumerable<long> groupOids)
{
GroupOids = groupOids ?? new List<long>();
foreach(var rel in selectedConceptCostBearerRelations)
{
var text1 = $"{rel.SupportConcept.Customer.LastNameFirstName}";
var text2 = $"{rel.StartDate?.ToShortDateString() ?? string.Empty} - {rel.EndDate?.ToShortDateString()} {rel.CostBearer.Name}";
var value = rel.CostBearer2SupportConceptOid.ToString();
var textColor = rel.SupportConcept.IsAboutToExpire ?
"text-bewo-is-about-to-expire" :
rel.SupportConcept.ExpiresIn3MonthOrLess ?
"text-bewo-expires-in-three-months" :
"text-light";
var nameAndDateOfBirthColor = "text-light";
if(rel.SupportConcept.IsArchived)
{
nameAndDateOfBirthColor = "text-bewo-archived-sc";
textColor = "text-bewo-archived-sc";
}
else if(rel.SupportConcept.IsDeleted)
{
nameAndDateOfBirthColor = "text-bewo-deleted-sc";
textColor = "text-bewo-deleted-sc";
}
SelectedRelations.Add(new CustomSelectListItem(text1, text2, value, textColor, rel.SupportConcept?.SupportConceptOid, rel.CostBearer2SupportConceptOid, nameAndDateOfBirthColor));
}
}
}
}