示例#1
0
 private void AddDocument(IDocumentCommand command, Document document)
 {
     CheckIfDocuemntIsDefault(command, document);
     AddRule(command, document);
     AddAbout(command, document);
     AddGuide(command, document);
     AddInformation(command, document);
     AddSocialMedia(command, document);
 }
 /// <summary>Executes the given command</summary>
 /// <param name="command"></param>
 public void Execute(IDocumentCommand command)
 {
     if (command == null)
     {
         throw new ArgumentNullException("command", "nope");
     }
     command.Document = _document;
     command.Execute();
     _redoCommands.Clear();
     _undoCommands.Push(command);
 }
        private IEnumerable <PictureCommand> AddGuidePicture(IDocumentCommand command)
        {
            var pictures = new List <PictureCommand>();

            if (command.GuideCommand.HttpPostedFileBases != null)
            {
                pictures = PreparePicture(command.AboutCommand.HttpPostedFileBases, DocumentPicturePath);
                command.GuideCommand.PictureCommands = pictures;
            }

            return(pictures);
        }
示例#4
0
 private void CheckIfDocuemntIsDefault(IDocumentCommand command, Document document)
 {
     if (command.StoreId != Guid.Empty)
     {
         var store = _storeRepository.GetById(command.StoreId);
         document.IsDefault = false;
         //document.Stores.Add(store);
     }
     else
     {
         document.IsDefault = true;
     }
 }
示例#5
0
        private static void AddInformation(IDocumentCommand command, Document document)
        {
            if (command.InformationCommand != null)
            {
                var information = new Information
                {
                    Body           = command.AboutCommand.Body,
                    CreationDate   = DateTime.Now,
                    LastUpdateDate = DateTime.Now
                };

                document.Information = information;
            }
        }
示例#6
0
        private static void AddRule(IDocumentCommand command, Document document)
        {
            if (command.RuleCommand != null)
            {
                var rule = new Rule
                {
                    Body           = command.RuleCommand.Body,
                    CreationDate   = DateTime.Now,
                    LastUpdateDate = DateTime.Now,
                };

                document.Rule = rule;
            }
        }
 public UnitOfWorkEntityFramework(FrapperDbContext context)
 {
     _context             = context;
     AssignedRolesCommand = new AssignedRolesCommand(_context);
     RoleCommand          = new RoleCommand(_context);
     UserMasterCommand    = new UserMasterCommand(_context);
     UserTokensCommand    = new UserTokensCommand(_context);
     MenuCategoryCommand  = new MenuCategoryCommand(_context);
     MenuMasterCommand    = new MenuMasterCommand(_context);
     SubMenuMasterCommand = new SubMenuMasterCommand(_context);
     VerificationCommand  = new VerificationCommand(_context);
     ProfileImageCommand  = new ProfileImageCommand(_context);
     NoticeCommand        = new NoticeCommand(_context);
     NoticeDetailsCommand = new NoticeDetailsCommand(_context);
     DocumentCommand      = new DocumentCommand(_context);
 }
示例#8
0
        private static void AddSocialMedia(IDocumentCommand command, Document document)
        {
            if (command.SocialMediaCommands == null)
            {
                return;
            }

            foreach (var socialMedia in command.SocialMedias.Select(item => new SocialMedia
            {
                CreationDate = DateTime.Now,
                LastUpdateDate = DateTime.Now,
                Url = item.Url,
                SocialMediaOption = new SocialMediaOption
                {
                    CreationDate = DateTime.Now,
                    Creator = "sdf",
                    Name = item.SocialMediaOption.Name,
                }
            }))
            {
                document.AddSocialMedia(socialMedia);
            }
        }
示例#9
0
        private static void AddAbout(IDocumentCommand command, Document document)
        {
            if (command.AboutCommand == null)
            {
                return;
            }

            var about = new About
            {
                Body           = command.AboutCommand.Body,
                CreationDate   = DateTime.Now,
                LastUpdateDate = DateTime.Now
            };

            if (command.AboutCommand.PictureCommands != null)
            {
                foreach (var pic in document.About.DocumentPictures)
                {
                    document.About.DocumentPictures.Add(pic);
                }
            }

            document.About = about;
        }
示例#10
0
        private static void AddGuide(IDocumentCommand command, Document document)
        {
            if (command.GuideCommand == null)
            {
                return;
            }

            var guide = new Guide
            {
                Body           = command.GuideCommand.Body,
                CreationDate   = DateTime.Now,
                LastUpdateDate = DateTime.Now
            };

            if (command.GuideCommand.PictureCommands != null)
            {
                foreach (var pic in document.Guide.DocumentPictures)
                {
                    document.Guide.DocumentPictures.Add(pic);
                }
            }

            document.Guide = guide;
        }