Beispiel #1
0
        public MappingProjectViewModel(
            List <IMappingProject> mappingProjects,
            List <IMunicipality> municipalities,
            List <IOffice> offices,
            string selectedMunicipality,
            int selectedOffice,
            MappingProjectState selectedState,
            RelevantMappingProjectDeliveryType selectedDeliveryType,
            int selectedYear)
        {
            foreach (IMappingProject project in mappingProjects)
            {
                MappingProjects.Add(new ProjectListItem(project));
            }

            Municipalities = municipalities;
            Municipalities.Sort((l, r) => l.Name.CompareTo(r.Name));
            SelectedMunicipality = selectedMunicipality;

            Offices = offices;
            Offices.Sort((l, r) => l.Name.CompareTo(r.Name));
            SelectedOffice = selectedOffice;

            foreach (var state in Enum.GetValues(typeof(MappingProjectState)).Cast <MappingProjectState>())
            {
                States.Add(new KeyValuePair <MappingProjectState, string>(state, ProjectListItem.GetStateName(state, false)));
            }
            SelectedState = selectedState;

            foreach (var deliveryType in Enum.GetValues(typeof(RelevantMappingProjectDeliveryType)).Cast <RelevantMappingProjectDeliveryType>())
            {
                DeliveryTypes.Add(new KeyValuePair <RelevantMappingProjectDeliveryType, string>(deliveryType, ProjectListItem.GetDeliveryTypeName(deliveryType, false)));
            }
            SelectedDeliveryType = selectedDeliveryType;

            const int startYear = 2010;

            Years        = Enumerable.Range(startYear, DateTime.Now.Year - startYear + 1).Reverse().ToList();
            SelectedYear = selectedYear;
        }
 public MappingProjectDetailsViewModel(IMappingProject project)
 {
     Project = new ProjectListItem(project, true);
 }