Example #1
0
        private CreationDateData convertCreationDateDataFrom(IDataReader reader)
        {
            Guid             metaDataGuid = new Guid(Convert.ToString(reader[METADATA_ID]));
            CreationDateData result       = new CreationDateData(metaDataGuid, Convert.ToDateTime(reader[METADATA_INHALT]));

            result.ShowInPreview = Convert.ToBoolean(reader[METADATA_SHOWINPREVIEW]);
            return(result);
        }
Example #2
0
        public void AddOrReplace(MetaData metaData, Guid entryID)
        {
            string inhalt;

            switch (metaData.Type)
            {
            case MetaDataType.CreationDate:
                CreationDateData cdd = (CreationDateData)metaData;
                inhalt = cdd.Date.ToString();
                break;

            case MetaDataType.LastChangedDate:
                LastChangeDateData lcd = (LastChangeDateData)metaData;
                inhalt = lcd.Date.ToString();
                break;

            case MetaDataType.Title:
                TitleData td = (TitleData)metaData;
                inhalt = td.Content;
                break;

            case MetaDataType.Author:
                AuthorData ad = (AuthorData)metaData;
                inhalt = string.Empty;
                List <Author> authors = ad.AuthorsCopy;
                foreach (Author author in authors)
                {
                    _authorTable.AddOrReplace(author, metaData.ID);
                }
                break;

            case MetaDataType.Tags:
                TagsData tad = (TagsData)metaData;
                inhalt = string.Empty;
                List <Tag> tags = tad.TagsCopy;
                foreach (Tag tag in tags)
                {
                    _tagsTable.AddOrReplace(tag, metaData);
                }
                break;

            case MetaDataType.Comment:
                CommentData commentData = (CommentData)metaData;
                inhalt = commentData.Content;
                break;

            case MetaDataType.Description:
                DescriptionData descriptionData = (DescriptionData)metaData;
                inhalt = descriptionData.Content;
                break;

            case MetaDataType.PreviewImage:
                PreviewImageData previewData = (PreviewImageData)metaData;
                inhalt = previewData.IsEmpty ? string.Empty : previewData.Uri.AbsoluteUri;
                break;

            default:
                throw new NotImplementedException();
            }
            string command = createAddOrReplaceMetaDataCommand(metaData, inhalt, entryID);

            executeNonQuery(command);
        }