using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web.Mvc; using BeWoPlanerMobil.Controllers; using BeWoPlanerMobil.Service; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; namespace BeWoPlanerMobil.Models { public class DevelopmentModel : AbstractModel { public List UserRightGroups { get; set; } = new List(); public List SupportConcepts { get; set; } public List AllCustomers { get; set; } = new List(); public List AllEmployees { get; set; } = new List(); [Display(Name = "Ersteller")] public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid; public CompactEmployeeDC SelectedEmployee { get; set; } // TODO: name und oid public List AvailableEmployees { get { var result = new List(); result.AddRange(AllEmployees.Select(item => new SelectListItem { Value = item.EmployeeOid.ToString(), Text = $"{item.LastName}, {item.FirstName}", Selected = item.Equals(MobileSessionFacade.LoggedInCompactEmployee) }).OrderBy(s => s.Text).ToList()); return result; } } public List AvailableCostbearerRelations { get; set; } = new List(); public List SelectedCustomers { get; set; } = new List(); public List AvailableCustomers { get; set; } = new List(); public List SelectedResources { get; set; } = new List(); public Dictionary> ResourceCategories2Resources { get; set; } = new Dictionary>(); public List AvailableResources { get { var result = new List(); ResourceCategories2Resources.DoForEach(rc2R => { result.AddRangeIfElementsNotIn(rc2R.Value); }); return result; } } public List SelectedEmployees { get; set; } = new List(); } }