Пример #1
0
        /// <summary>
        /// Compares the specified a.
        /// </summary>
        /// <param name="argFirstMediaModel">
        /// a.
        /// </param>
        /// <param name="argSecondMediaModel">
        /// The b.
        /// </param>
        /// <returns>
        /// </returns>
        public new int Compare(object argFirstMediaModel, object argSecondMediaModel)
        {
            if (argFirstMediaModel is null)
            {
                throw new ArgumentNullException(nameof(argFirstMediaModel));
            }

            if (argSecondMediaModel is null)
            {
                throw new ArgumentNullException(nameof(argSecondMediaModel));
            }

            MediaModel firstMediaModel  = (MediaModel)argFirstMediaModel;
            MediaModel secondMediaModel = (MediaModel)argSecondMediaModel;

            // Compare on date first
            int testFlag = DateTime.Compare(firstMediaModel.GDateValue.SortDate, secondMediaModel.GDateValue.SortDate);

            // If the same then on Description. Usual if there is no Date
            if (testFlag.Equals(0))
            {
                testFlag = string.Compare(firstMediaModel.GDescription, secondMediaModel.GDescription, StringComparison.CurrentCulture);
            }

            return(testFlag);
        }
Пример #2
0
        /// <summary>
        /// Converts from media model.
        /// </summary>
        /// <param name="argMediaModel">
        /// The argument media model.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// argMediaModel
        /// </exception>
        public void ConvertFromMediaModel(MediaModel argMediaModel)
        {
            if (argMediaModel is null)
            {
                throw new ArgumentNullException(nameof(argMediaModel));
            }

            // Copy fields
            GPriv         = argMediaModel.Priv;
            HLinkKey      = argMediaModel.HLinkKey;
            HomeImageType = CommonConstants.HomeImageTypeThumbNail;
        }
Пример #3
0
        public IMediaModel Clone()
        {
            IMediaModel t = new MediaModel
            {
                FileMimeType           = this.FileMimeType,
                GCitationRefCollection = this.GCitationRefCollection,
                GDateValue             = this.GDateValue,
                GDescription           = this.GDescription,
                GNoteRefCollection     = this.GNoteRefCollection,
                GTagRefCollection      = this.GTagRefCollection,
                HomeImageHLink         = this.HomeImageHLink,
                MetaDataHeight         = this.MetaDataHeight,
                OriginalFilePath       = this.OriginalFilePath
            };

            return(t);
        }