/// <summary> /// private: convert response to dto object /// </summary> /// <param name="response"></param> /// <param name="session"></param> internal static PwgImageInfo ConvertProxyResponseToDTO(PwgImageInfoImageProxyResponse response) { PwgImageInfo returnValue = null; try { PwgImage pwgImg = ConvertProxyResponseToDTO(response as PwgImageProxyResponse as PwgImageProxyResponse); returnValue = new PwgImageInfo(){ Id = pwgImg.Id, Width = pwgImg.Width, Height = pwgImg.Height, File = pwgImg.File , UrlThunb = pwgImg.UrlThunb, UrlElement = pwgImg.UrlElement, UrlHighDef = pwgImg.UrlHighDef, Counter = pwgImg.Counter, CreatingDate = pwgImg.CreatingDate, AvailableDate= pwgImg.AvailableDate, Tags = pwgImg.Tags, Albums = pwgImg.Albums}; returnValue.ExtThumbail = response.ExtThumbail ; returnValue.Author = response.Author ; returnValue.ImageFileSize = response.ImageFileSize ; returnValue.hasHighDef = response.hasHighDef ; returnValue.HighDefFileSize = response.HighDefFileSize ; returnValue.ConfidentialLevel = response.ConfidentialLevel ; returnValue.md5Sum = response.md5Sum ; returnValue.UserIdAddedBy = response.UserIdAddedBy ; returnValue.Name = response.Name ; if (response.DateUpdateMetaData != null) { DateTime tryDate; if (DateTime.TryParse(response.DateUpdateMetaData, out tryDate)) { returnValue.DateUpdateMetaData = tryDate; } } if (response.ImageRate != null) { returnValue.ImageRate = ConvertProxyResponseToDTO(response.ImageRate); } if (response.ImageComments != null) { returnValue.ImageComments = ConvertProxyResponseToDTO(response.ImageComments); } if (response.PostCommentSecurityData != null) { returnValue.PostCommenSecurityData = ConvertProxyResponseToDTO(response.PostCommentSecurityData); } } catch (Exception ex) { throw new PwgServiceException("ConvertProxyResponseToDTO : a error is raised when converting PwgTagProxyResponse.", ex); } return returnValue; }
public PwgImageInfo getImageInfo(Int32 imageId, Int32? commentPage, Int32? commentsPerPage) { PwgImageInfo returnValue = new PwgImageInfo(); try { PwgImageInfoProxyResponse response = PwgImagesProxy.pwg_images_getInfos(imageId, commentPage, commentsPerPage); if (response.Retour != PwgBaseProxyReponseRetourEnum.Ok) { if (response.Erreur != null) { throw new PwgServiceException("RateImage, the server has return the error.", response.Erreur.Code, response.Erreur.Message); } else { throw new PwgServiceException("RateImage : a error occurs during server process."); } } else { returnValue = ConvertProxyResponseToDTO(response.ImageInfo); } } catch (PwgProxyException ex) { throw new PwgServiceException("RateImage : a error is raised by proxy.", ex); } return returnValue; }