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); }
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; } }
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; } }
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); }
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); } }
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; }
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; }