public static void ConvertPwgAlbumToPwgAlbumWPF(PwgAlbum aPwgAlbum, ref PwgAlbumWPF aPwgAlbumWPF) { if (aPwgAlbum != null) { if (aPwgAlbumWPF == null) { aPwgAlbumWPF = new PwgAlbumWPF(); } aPwgAlbumWPF.DeepImagesCount = aPwgAlbum.DeepImagesCount; aPwgAlbumWPF.Id = aPwgAlbum.Id; aPwgAlbumWPF.ImagesCount = aPwgAlbum.ImagesCount; aPwgAlbumWPF.LastDate = aPwgAlbum.LastDate; aPwgAlbumWPF.Name = aPwgAlbum.Name; aPwgAlbumWPF.SubAlbumsCount = aPwgAlbum.SubAlbumsCount; aPwgAlbumWPF.Url = aPwgAlbum.Url; if (aPwgAlbumWPF.UpperAlbumsId == null) { aPwgAlbumWPF.UpperAlbumsId = new System.Collections.ObjectModel.ObservableCollection<Int32>(); } else { aPwgAlbumWPF.UpperAlbumsId.Clear(); } foreach (Int32 i in aPwgAlbum.UpperAlbumsId) { aPwgAlbumWPF.UpperAlbumsId.Add(i); } } }
public static void AddPwgAlbumToList( PwgAlbum aPwgAlbum, ref PwgAlbumListWPF aPwgAlbumListWPF) { if (aPwgAlbum != null) { if (aPwgAlbumListWPF == null) { aPwgAlbumListWPF = new PwgAlbumListWPF(); } PwgAlbumWPF pwgCat = new PwgAlbumWPF(); PwgAlbumWPFHelper.ConvertPwgAlbumToPwgAlbumWPF(aPwgAlbum, ref pwgCat); aPwgAlbumListWPF.Add(pwgCat); } }
/// <summary> /// convert response to dto object /// </summary> /// <param name="response"></param> /// <param name="session"></param> internal static PwgAlbum ConvertProxyResponseToDTO(PwgAlbumProxyResponse response) { PwgAlbum returnValue = new PwgAlbum(); try { returnValue.Id = response.Id; returnValue.Name = response.Name; returnValue.DeepImagesCount = response.DeepImagesCount; returnValue.ImagesCount = response.ImagesCount; returnValue.SubAlbumsCount = response.SubAlbumsCount; returnValue.UpperAlbumsId = new List<Int32>(); if (response.UpperAlbumId != null) { foreach (String StringId in response.UpperAlbumId.Split(',')) { returnValue.UpperAlbumsId.Add(Int32.Parse(StringId)); } } if (response.LastDate != null) { DateTime tryDate; if (DateTime.TryParse(response.LastDate, out tryDate)) { returnValue.LastDate = tryDate; } } if (String.IsNullOrEmpty(response.Url)) { returnValue.Url = null; } else { returnValue.Url = (new UriBuilder(response.Url)).Uri; } } catch (Exception ex) { throw new PwgServiceException("ConvertProxyResponseToDTO : a error is raised when converting PwgTagProxyResponse.", ex); } return returnValue; }