public ActionResult CreateForPresentation(int id, Slide s) { s.CreationDate = DateTime.Now; s.ModificationDate = DateTime.Now; if (ModelState.IsValid) { db.Slides.AddObject(s); db.SaveChanges(); System.Diagnostics.Debug.Print("slide has id of {0}", s.ID); PresentationSlide ps = new PresentationSlide(); ps.PresentationID = id; ps.SlideID = s.ID; int slideCount = db.PresentationSlides.Where(pslide => pslide.PresentationID == id).Count(); ps.OrderNum = slideCount; db.PresentationSlides.AddObject(ps); s.PresentationSlides.Add(ps); db.SaveChanges(); return(RedirectToAction("Edit", "Presentation", new { id = id })); } return(View(s)); }
public ActionResult CreateDlgPost(Slide s, int id, string div) { s.CreatedBy = CurrentUserID; s.CreationDate = DateTime.Now; s.ModifiedBy = CurrentUserID; s.ModificationDate = DateTime.Now; s.Content = ""; // fill with model/template perhaps? if (ModelState.IsValid) { db.Slides.AddObject(s); db.SaveChanges(); PresentationSlide ps = new PresentationSlide(); ps.OrderNum = db.PresentationSlides.Where(x => x.PresentationID == id).Count(); ps.PresentationID = id; ps.SlideID = s.ID; db.PresentationSlides.AddObject(ps); db.SaveChanges(); return(JavaScript("closeDialog(); refreshQueuedSlides(" + id + ", " + "'Edit'" + ");")); } return(PartialView()); }
private void OnShapeChanged(int slidePosition, String slideName, int shapePosition, String shapeValue, SlideItemType type, String shapeName) { PresentationEditorItem page = (PresentationEditorItem)getPresentationEditor().getActivePage(); if (page == null) { return; } bool added = false; PresentationSlide presentationSlide = page.EditedObject.getSlide(slidePosition); if (presentationSlide == null) { presentationSlide = new PresentationSlide(slidePosition, slideName); added = true; } if (added) { page.EditedObject.AddSlide(presentationSlide); } else { page.EditedObject.UpdateSlide(presentationSlide); } PresentationSlideItem item = presentationSlide.getShape(shapePosition); added = false; if (item == null) { item = new PresentationSlideItem(); added = true; } item.index = shapePosition; item.value = shapeValue; item.type = type; item.name = shapeName; if (added) { presentationSlide.AddShape(item); } else { presentationSlide.UpdateShape(item); } Change(); }
public JsonResult SlideDelete(int id, int slideID) { PresentationSlide ps = db.PresentationSlides.Include("Slide").Single(p => p.PresentationID == id && p.SlideID == slideID); db.PresentationSlides.DeleteObject(ps); int cnt = db.PresentationSlides.Where(p => p.SlideID == slideID).Count(); if (cnt == 0) { db.Slides.DeleteObject(ps.Slide); } db.SaveChanges(); return(this.Json(new { result = true })); }
public JsonResult Slide(int id, string Title) { var presentation = db.Presentations.Single(p => p.CreatedBy == CurrentUser.ID && p.ID == id); if (presentation != null) { Slide s = new Slide(); s.Content = ""; s.CreatedBy = CurrentUserID; s.CreationDate = DateTime.Now; s.ModificationDate = DateTime.Now; s.ModifiedBy = CurrentUserID; s.Title = Title; db.Slides.AddObject(s); db.SaveChanges(); PresentationSlide ps = new PresentationSlide(); ps.PresentationID = presentation.ID; ps.SlideID = s.ID; ps.OrderNum = db.PresentationSlides.Where(x => x.PresentationID == id).Count() + 1; db.PresentationSlides.AddObject(ps); db.SaveChanges(); return(this.Json(new { ID = ps.ID, PresentationID = ps.PresentationID, SlideID = ps.SlideID, OrderNum = ps.OrderNum, Slide = new { ID = ps.Slide.ID, HtmlContentString = ps.Slide.HtmlContentHtmlString.ToHtmlString(), Title = ps.Slide.Title, Layout = ps.Slide.Layout, ModificationDate = ps.Slide.ModificationDate.ToString(), ModifiedBy = ps.Slide.ModifiedBy, CreationDate = ps.Slide.CreationDate.ToString(), CreatedBy = ps.Slide.CreatedBy } })); } return(this.Json(new { result = false })); }
private void OnShapeDeleted(int slidePosition, String slideName, int shapePosition, String shapeValue, SlideItemType type, String shapeName) { PresentationEditorItem page = (PresentationEditorItem)getPresentationEditor().getActivePage(); if (page == null) { return; } PresentationSlide presentationSlide = page.EditedObject.getSlide(slidePosition); if (presentationSlide == null) { return; } PresentationSlideItem item = presentationSlide.getShape(shapePosition); if (item == null) { return; } presentationSlide.DeleteShape(item); page.EditedObject.UpdateSlide(presentationSlide); Change(); }
/// <summary> /// This method for close or open slide /// </summary> /// <param name="slide">the selected slide to turn on or off</param> /// <param name="isOpen">the state of the slide</param> private void Turn_On_Off_Slide(PresentationSlide slide, bool isOpen) { slide.gameObject.SetActive(isOpen); }