public ActionResult Index() { var model = LayoutRepository.LoadFooterDefaul(); SetCurrentMenu(); return(View(model)); }
public virtual async Task <Layout> SeedLayoutAsync( string name, string path, string displayName, Guid dataId, PlatformType platformType = PlatformType.None, string redirect = "", string description = "", Guid?tenantId = null, CancellationToken cancellationToken = default) { var layout = await LayoutRepository.FindByNameAsync(name, cancellationToken : cancellationToken); if (layout == null) { layout = new Layout( GuidGenerator.Create(), path, name, displayName, dataId, platformType, redirect, description, tenantId); layout = await LayoutRepository.InsertAsync(layout, cancellationToken : cancellationToken); } return(layout); }
public IHttpActionResult Get() { var layoutRepository = new LayoutRepository(); var model = layoutRepository.Load(); return(Ok(model)); }
public void GetLayoutSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } var id = layouts.First().Id; //Act var result = layoutRepository.GetLayout(id); //Assert Assert.NotNull(result); Assert.NotEqual(result.Id, Guid.Empty); Assert.True(!string.IsNullOrEmpty(result.Name)); Assert.True(!string.IsNullOrEmpty(result.Config)); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }
public Page.Elements.PageComposition CreatePageComposition(CmsPage cmsPage) { var pageBuilder = new PageComposerTools(_cmsPageContentActivator); var page = new Page.Elements.PageComposition(); page.RootElement = new UndefinedLayoutPageCompositionElement(); if (cmsPage.LayoutId != Guid.Empty) { var layoutRepository = new LayoutRepository(); var layoutToApply = layoutRepository.GetById(cmsPage.LayoutId); pageBuilder.AddLayoutContent(page, GetLayoutStructure(layoutToApply)); } var pageSpecificContent = cmsPage.PageContent; var d = page.GetPartialPageRenderingByLayoutBuilderId(); foreach (var contentItem in pageSpecificContent) { var placementLayoutBuilderId = contentItem.PlacementLayoutBuilderId ?? SpecialRenderingFragmentContentIds.PageRoot; var root = d[placementLayoutBuilderId]; var presentationElement = contentItem.ToPresentationElement(); pageBuilder.AddAdHocContent(presentationElement, root); } return(page); }
public ActionResult Participants() { string partiesName = Request.Cookies["PartiesName"]; LayoutRepository.AddParties(partiesName); return(View(paticipantsRepository.Read(partiesName))); }
public ActionResult Index(OrderModel model) { SetCurrentMenu(); if (ModelState.IsValid) { var result = _orderRepository.Saving(model.Order); if (result) { SetSuccessMessage("Bạn vừa đặt phòng thành công. Chúng tôi sẽ liên hệ lại ngay với bạn sớm nhất."); } else { AddFailedMessage("Đã có lỗi xảy ra xin vui lòng thử lại."); } } else { foreach (var item in ModelState.Values) { foreach (var error in item.Errors) { SetFailedNotification(error.ErrorMessage); } } } model.RoomTypes = LayoutRepository.FetchRoomTypes(); model.Footer = LayoutRepository.LoadFooterDefaul(); return(View(model)); }
public void UpdateLayoutSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } var layoutToUpdate = layoutRepository.GetLayouts().First(); //Act layoutToUpdate.IsDeleted = true; layoutToUpdate.Name = "NewName"; layoutToUpdate.Config = "[{\"Id\":\"0fcf04a2 - 3d71 - 26b0 - c371 - 6d936c6c65d8\",\"Type\":\"container\",\"LayoutTemplate\":\"container\"]"; var result = layoutRepository.UpdateLayout(layoutToUpdate); //Assert Assert.NotNull(result); Assert.True(result.Name == layoutToUpdate.Name); Assert.True(result.Config == layoutToUpdate.Config); Assert.True(result.IsDeleted == layoutToUpdate.IsDeleted); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }
public IHttpActionResult Post([FromBody] IEnumerable <Models.LayoutModel> layout) { var layoutRepository = new LayoutRepository(); layoutRepository.Save(layout); return(Ok()); }
private static void CreatePap720Layout() { var xjfFileName = @"c:\Work\Tasks\XpressoGoodbye\base_job.xjf"; var xjf = XpressoRepository.GetFromFile(xjfFileName); var layout = Pap720Generator.BuildPap720(720, xjf); LayoutRepository.Save(layout); }
public LayoutController(LayoutRules rules, MerlinReadContext readContext, LayoutService service, MerlinReadStore readStore, LayoutRepository layoutRepository) { this.rules = rules; this.service = service; this.readContext = readContext; this.readStore = readStore; this.layoutRepository = layoutRepository; }
public ActionResult About() { SetCurrentMenu(); var model = LayoutRepository.LoadDefaultIntroduction(); return(View(model)); }
// gets XJF files, downloaded by Xpresso, generates layouts // for each layout adds vendor logo element from XJF and creates new Pressview (measure color strip) element from hardcoded values private static void CreateLayoutsWithColorStripFromXjf() { var codes = new[] { 403, 404, 405, 408, 409, 410, 411, 412, 413, 414, 415, 417, 418, 420, 421, 422, 423, 424, 425, 426, 427, 428 }; foreach (var code in codes) { var xjf = XjfRepository.GetUntouched(code); var layout = CanvasGenerator.BuildFromXjf(code, xjf); LayoutRepository.Save(layout); } }
// takes existing XJF files, adds there Pressview (measure color strip) from existing layout and saves modified XJF file to a separate place // pretty useless method, must be replaced with something based on CustomizationsGenerator private static void AddPressviewToXjfsFromLayouts() { var layouts = LayoutRepository.GetAll(); foreach (var layout in layouts) { var xjf = XjfRepository.GetUntouched(layout.PapCode); xjf = XjfModifier.AddMeasureColorStrip(xjf, layout); XjfRepository.Save(xjf, layout.PapCode); } }
public void CreateLayoutFail() { //Arrange var layoutRepository = new LayoutRepository(_container); Layout layout = null; //Act var result = layoutRepository.CreateLayout(layout); //Assert Assert.Null(result); }
public OutbreakController(MerlinReadStore readStore, MerlinReadContext readContext, OutbreakRules rules, OutbreakService service, LayoutRepository layoutRepository, AuthenticationService authenticationService, IConfiguration config, EpicomRepository epicomRepository, OutbreakRepository outbreakEventsRepository) { this.readStore = readStore; this.readContext = readContext; this.rules = rules; this.service = service; this.layoutRepository = layoutRepository; this.authenticationService = authenticationService; this.config = config; this.epicomRepository = epicomRepository; this.outbreakRepository = outbreakEventsRepository; }
public ActionResult Booking(Order order) { SetCurrentMenu(); var model = new OrderModel { RoomTypes = LayoutRepository.FetchRoomTypes(), Order = order, Footer = LayoutRepository.LoadFooterDefaul() }; return(View("Index", model)); }
public void GetLayoutsFail() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); dbContext.Layout.RemoveRange(dbContext.Layout); //Act var result = layoutRepository.GetLayouts(); //Assert Assert.NotNull(result); Assert.True(result.Count == 0); }
public ActionResult Index() { SetCurrentMenu(); var model = new OrderModel { RoomTypes = LayoutRepository.FetchRoomTypes(), Order = new Order { CheckIn = DateTime.UtcNow, CheckOut = DateTime.UtcNow.AddDays(1) }, Footer = LayoutRepository.LoadFooterDefaul() }; return(View(model)); }
public void CreateLayoutSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var layouts = TestDataRepository.GetLayouts(); var layout = layouts.First(); //Act var result = layoutRepository.CreateLayout(layout); //Assert Assert.NotNull(result); Assert.NotEqual(result.Id, Guid.Empty); Assert.False(result.IsDeleted); Assert.True(!string.IsNullOrEmpty(result.Config)); Assert.True(!string.IsNullOrEmpty(result.Name)); }
public SurveyController( MerlinReadContext readContext, LayoutRepository layoutRepository, SurveyService service, SurveyRules rules, SurveyAnswerRules answerRules, MerlinReadStore readStore, SurveyAnswerRepository surveyAnswerRepository) { this.readContext = readContext; this.layoutRepository = layoutRepository; this.service = service; this.rules = rules; this.answerRules = answerRules; this.readStore = readStore; this.surveyAnswerRepository = surveyAnswerRepository; }
public static PageLayout GetLayoutStructure(Layout layout) { var layoutRepo = new LayoutRepository(); PageLayout ln = null; if (layout.ParentLayoutId != null) { var parentLayout = layoutRepo.GetById(layout.ParentLayoutId.Value); ln = GetLayoutStructure(parentLayout); } return(new PageLayout { AllContent = layout.PageContent.Select(x => PresentationElementHelpers.ToPresentationElement(x)).ToList(), MasterPagePath = layout.MasterPagePath, Name = layout.Name, ParentLayout = ln }); }
public UnitOfWork(ApplicationDbContext db, IOptions <AppSettings> appSettings) { _db = db; Menu = new MenuRepository(_db); MenuAdjustment = new MenuAdjustmentRepository(_db); Layout = new LayoutRepository(_db); HomePageBanner = new HomePageBannerRepository(_db); HomePage = new HomePageRepository(_db); Project = new ProjectRepository(_db); ProjectCategory = new ProjectCategoryRepository(_db); CultureLayout = new CultureLayoutRepository(_db); CultureSection = new CultureSectionRepository(_db); CulturePost = new CulturePostRepository(_db); CulturePicture = new CulturePictureRepository(_db); CultureAlbum = new CultureAlbumRepository(_db); News = new NewsRepository(_db); VisionMission = new VisionMissionRepository(_db); Partners = new PartnerRespository(_db); PartnerTypes = new PartnerTypeRespository(_db); Footer = new FooterRepository(_db); Menu = new MenuRepository(_db); SolutionContent = new SolutionContentRepository(_db); SolutionCategory = new SolutionCategoryRepository(_db); SolutionPicture = new SolutionPictureRepository(_db); RecruitmentBanner = new RecruitmentBannerRepository(_db); RecruitmentCareers = new RecruitmentCareersRepository(_db); RecruitmentJob = new RecruitmentJobRepository(_db); VisionMission = new VisionMissionRepository(_db); Footer = new FooterRepository(_db); FooterAdjustment = new FooterAdjustmentRepository(_db); AppUser = new AppUserRepository(_db, appSettings); NewsCategory = new NewsCategoryRepository(_db); ColorPage = new ColorPageRepository(_db); }
public void GetLayoutFail() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } var id = Guid.Empty; //Act var result = layoutRepository.GetLayout(id); //Assert Assert.Null(result); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }
public void GetLayoutsSuccess() { //Arrange var layoutRepository = new LayoutRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var layouts = TestDataRepository.GetLayouts(); foreach (var item in layouts) { layoutRepository.CreateLayout(item); } //Act var result = layoutRepository.GetLayouts(); //Assert Assert.NotNull(result); Assert.True(result.Count > 0); //Clean dbContext.Layout.RemoveRange(dbContext.Layout); }
public ActionResult Send(Contact contact) { var model = LayoutRepository.LoadFooterDefaul(); SetCurrentMenu(); if (contact == null) { SetFailedNotification("Có lỗi xảy ra. Vui lòng thử lại"); return(RedirectToAction("Index")); } if (!ModelState.IsValid) { foreach (var item in ModelState.Values) { foreach (var error in item.Errors) { SetFailedNotification(error.ErrorMessage); } } return(RedirectToAction("Index")); } var message = contact.Id > 0 ? "Cập nhật" : "Thêm"; if (_contactRepository.Save(contact)) { SetSuccessNotification($"{message} liên hệ thành công"); } else { SetFailedNotification("Đã có lỗi xảy ra. Xin vui lòng thử lại"); } return(RedirectToAction("Index")); }
// creates a file with input for a SQL script that replaces customizations private static void SaveCustomizationsFromXjfs() { var codes = new[] { 403, 404, 405, 408, 409, 410, 411, 412, 413, 414, 415, 417, 418, 420, 421, 422, 423, 424, 425, 426, 427, 428 }; var customizationsFilename = @"c:\Projects\Albumprinter\Files\Xpresso\Customizations\PressView.txt"; var layouts = LayoutRepository.GetAll(); if (File.Exists(customizationsFilename)) { File.Delete(customizationsFilename); } var lines = codes.Select(code => { //var xjf = XjfRepository.Get(code); //var customization = CustomizationsGenerator.GetCustomizations(xjf); var customization = CustomizationsGenerator.GetCustomizations(layouts.Single(l => l.PapCode == code)); return($"('pap_{code}','{customization}')"); }) .ToArray(); var customizationsToSave = string.Join($",{Environment.NewLine}", lines); File.WriteAllText(customizationsFilename, customizationsToSave); }
public ActionResult Reviews() { var model = LayoutRepository.FetchTopCustomer(3); return(PartialView("_Reviews", model)); }
public ActionResult Footer() { var model = LayoutRepository.LoadFooterDefaul(); return(PartialView("_Footer", model)); }
private static void CreatePap402Layout() { var layout = Pap402Generator.Generate(); LayoutRepository.SaveV2(layout); }