Source

main / Source / WebClient / Web.Client / ViewModel / DocumentDetailViewModel.cs

Full commit
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using DataUp.Web.Client.Model;
using System.Linq;
using DataUp.Web.Client.Infrastructure;

namespace DataUp.Web.Client.ViewModel
{
    public class DocumentDetailViewModel
    {
        public DocumentDetailViewModel()
        {
            this.SheetList = new List<DocumentSheet>();
            this.MetadataList = new List<DocumentMetadata>();
            this.AvailableRepositories = new SelectList(Enumerable.Empty<DocumentRepository>());
            this.Citation = new DocumentCitation();

            this.ParameterMetadataList = new List<ParameterMetadataViewModel>();
            this.ParameterTypeList = new SelectList(Enum.GetValues(typeof(ParameterMetadataEnum)).Cast<ParameterMetadataEnum>().ToList());
            this.ParameterUnitList = new SelectList(Helper.GetParameterUnitsList());
            this.EntityNameList = new SelectList(Enumerable.Empty<DocumentSheet>());
        }

        public int DocumentId { get; set; }

        public string DocumentName { get; set; }

        [Display(Name = "RepositoryType")]
        public string Type { get; set; }

        public IList<DocumentSheet> SheetList { get; set; }

        public IList<DocumentMetadata> MetadataList { get; set; }

        public DocumentCitation Citation { get; set; }

        public SelectList AvailableRepositories { get; set; }

        public SelectList ParameterTypeList { get; set; }

        public SelectList ParameterUnitList { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "User name is Required")]
        [Display(Name = "User Name")]
        [DataType(DataType.Text)]
        public string UserName { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Password is Required")]
        [Display(Name = "Password")]
        [DataType(DataType.Text)]
        public string Password { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "User name is Required")]
        [Display(Name = "User Name")]
        [DataType(DataType.Text)]
        public string PostUserName { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Password is Required")]
        [Display(Name = "Password")]
        [DataType(DataType.Text)]
        public string PostPassword { get; set; }

        public string When { get; set; }

        public string What { get; set; }

        public static string Name { get; set; }

        public string Who { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessage = "Please select Repository")]
        [Display(Name = "Repository")]
        [DataType(DataType.Text)]
        public string SelectedRepositoryId { get; set; }

        public bool IsPostAsXSL { get; set; }
        public bool NoError { get; set; }
        public bool isRemoved { get; set; }

        public string RepositoryTypesJson { get; set; }

        public string UserAgreementJson { get; set; }

        //public IList<DocumentParameterMetadata> ParameterMetadataList { get; set; }

        public IList<ParameterMetadataViewModel> ParameterMetadataList { get; set; }

        public SelectList EntityNameList { get; set; }

        public IEnumerable<string> ExcelSheetNames { get; set; }
    }

    public class ParameterMetadataViewModel
    {
        [Required(AllowEmptyStrings = false, ErrorMessage = "*")]
        public string Name { get; set; }
        public string Description { get; set; }
        public string Type { get; set; }
        public string Units { get; set; }
        public string EntityName { get; set; }
        public string SelectedEntityNameId { get; set; }
        public string EntityDescription { get; set; }
        public bool IsBlankRow { get; set; }
    }
}