36 lines
1.5 KiB
C#
36 lines
1.5 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 listItem = new CustomSelectListItem(text1, text2, value, textColor, rel.SupportConcept?.SupportConceptOid, rel.CostBearer2SupportConceptOid);
|
|
|
|
SelectedRelations.Add(listItem);
|
|
}
|
|
}
|
|
}
|
|
} |