public async void SelectDocument(DocumentViewModel selectedDocument)
        {
            SelectedDocument = selectedDocument;

            var allDocumentVersions   = mapper.Map <IList <DocumentVersionViewModel> >(await documentVersionService.GetAllVersionsByDocumentId(selectedDocument.Id));
            var latestDocumentVersion = allDocumentVersions.Where(dv => dv.Progress == Progress.InEffect && dv.IsRemoved.ToLower() != "true").OrderByDescending(dv => dv.EffectiveDate).FirstOrDefault();

            if (latestDocumentVersion == null)
            {
                return;
            }

            SelectedDocument.VersionNumber = latestDocumentVersion.VersionNumber;
            SelectedDocument.EffectiveDate = latestDocumentVersion.EffectiveDate;
            SelectedDocument.Location      = fileHelper.GetDocumentLocation(_selectedDocument);
        }
예제 #2
0
        public async void OnStartUp(DocumentViewModel selectedDocument)
        {
            SelectedDocument = selectedDocument;
            var documentVersions = mapper.Map <List <DocumentVersionViewModel> >((await documentVersionService.GetAllVersionsByDocumentId(_selectedDocument.Id)).OrderByDescending(dv => dv.EffectiveDate));

            DocumentVersions = new ObservableCollection <DocumentVersionViewModel>(documentVersions);

            SelectedDocumentVersion = _documentVersions
                                      .Where(dv => dv.Progress == Progress.InEffect)
                                      .OrderByDescending(dv => dv.EffectiveDate)
                                      .FirstOrDefault();
        }