示例#1
0
        public Text AddToFooter(Guid footerId, Text text)
        {
            if (FooterRepository.Exists(footerId))
            {
                Footer footer = FooterRepository.GetById(footerId);
                footer.StyleClass = null;

                Footer footerForText = footer;

                Content            contentOfFooter = footerForText.Content;
                IEnumerable <Text> footerTexts     = TextRepository.GetByContent(contentOfFooter);
                if (footerTexts.Count() == 0)
                {
                    text.Id                 = Guid.NewGuid();
                    text.Position           = 0;
                    text.ContentThatBelongs = contentOfFooter;
                    TextRepository.Add(text);

                    return(text);
                }
                else
                {
                    throw new ExistingTextException("There is an existing text in the selected footer.");
                }
            }
            else
            {
                throw new MissingFooterException("This footer does not exist in the database");
            }
        }
 public void LogModificationToFooter(Guid footerId)
 {
     if (FooterRepository.Exists(footerId))
     {
         Footer footerOfModdedDocument = FooterRepository.GetById(footerId);
         LogModificationToDocument(footerOfModdedDocument.DocumentThatBelongs.Id);
     }
     else
     {
         throw new MissingFooterException("This footer is not in the database.");
     }
 }
示例#3
0
 public void Update(Guid footerId, Footer newFooterData)
 {
     if (FooterRepository.Exists(footerId))
     {
         Footer footerToUpdate = FooterRepository.GetById(footerId);
         if (newFooterData.StyleClass != null && !StyleClassRepository.Exists(newFooterData.StyleClass.Name))
         {
             newFooterData.StyleClass = null;
         }
         footerToUpdate.StyleClass = newFooterData.StyleClass;
         FooterRepository.Update(footerToUpdate);
     }
     else
     {
         throw new MissingFooterException("The footer is not in the database.");
     }
 }
示例#4
0
 public Text GetByFooter(Guid footerId)
 {
     if (FooterRepository.Exists(footerId))
     {
         Footer             footerForText   = FooterRepository.GetById(footerId);
         Content            contentOfFooter = footerForText.Content;
         IEnumerable <Text> footerTexts     = TextRepository.GetByContent(contentOfFooter);
         if (footerTexts.Count() != 0)
         {
             return(footerTexts.First());
         }
         else
         {
             throw new MissingTextException("This text is not in the database");
         }
     }
     else
     {
         throw new MissingFooterException("This footer does not exist in the database");
     }
 }