main / Source / WebClient / Web.Client / Extensions / PostFileDetailExtensions.cs

Naethra D 3ee1b94 



























using System;
using System.Linq;
using DataUp.Web.BizLogic;
using DataUp.Web.Client.ViewModel;

namespace DataUp.Web.Client
{
    /// <summary>
    /// Extension for the PostFileDetail object which represents the file to be posted to repository.
    /// </summary>
    public static class PostFileDetailExtensions
    {
        public static void SetValuesFrom(this PostFileDetail postfileDetail, DocumentDetailViewModel documentDetail)
        {
            DateTime date = new DateTime();
            DateTime.TryParse(documentDetail.MetadataList.Where(m => m.Label.ToLowerInvariant().Contains("today's date")).FirstOrDefault().Value, out date);

            postfileDetail.RepositoryName = documentDetail.SelectedRepositoryId;
            postfileDetail.Authorization = Convert.ToBase64String(System.Text.UTF8Encoding.UTF8.GetBytes(documentDetail.UserName + ":" + documentDetail.Password));
            postfileDetail.What = documentDetail.Citation.Title;
            postfileDetail.Who = documentDetail.Citation.Publisher;
            postfileDetail.When = date;
            postfileDetail.Identifier = documentDetail.Citation.Identifier;
            postfileDetail.Id = documentDetail.DocumentId;
            postfileDetail.IsCompressed = !documentDetail.IsPostAsXSL;
            postfileDetail.FileName = documentDetail.DocumentName;
        }
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.