public void DeletePage(int id) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == id select x).First(); mc.PageSet.DeleteObject(page); mc.SaveChanges(); }
public void CreatePage(string name) { ModelContainer1 mc = new ModelContainer1(); var newPage = new Page(); newPage.Name = name; newPage.Content = "<li class='editable'>Welcome to the new site!</li><li> </li>"; mc.AddToPageSet(newPage); mc.SaveChanges(); }
public void CreatePage(string name) { ModelContainer1 mc = new ModelContainer1(); var newPage = new Page(); newPage.Name = name; newPage.Content = "<li class='editable'>Witaj na nowej stronie!</li>"; mc.AddToPageSet(newPage); mc.SaveChanges(); }
public void DeleteMarker(int siteId) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == siteId select x).First(); page.Marker_x = null; page.Marker_y = null; page.Marker_comment = null; mc.SaveChanges(); }
public void AddMarker(int siteId, string markerX, string markerY, string comment) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == siteId select x).First(); page.Marker_x = markerX; page.Marker_y = markerY; page.Marker_comment = comment; mc.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { ClientScriptManager cs = Page.ClientScript; ModelContainer1 mc = new ModelContainer1(); var contentForAllPages = (from x in mc.AllPagesSet select x).First(); PageLogo = contentForAllPages.Logo; cs.RegisterStartupScript(this.GetType(), "changecColor", "changeColor(" + contentForAllPages.ColorR + "," + contentForAllPages.ColorG + "," + contentForAllPages.ColorB + ");", true); var defaultPage = (from x in mc.PageSet select x).First(); PagesCollection = ""; var pageCollection = (from x in mc.PageSet orderby x.Id ascending select x); foreach (Model.Page p in pageCollection) { PagesCollection += "<li><a class='hovGradient' id='pageId" + p.Id + "' href='?pageId=" + p.Id + "'>" + p.Name + "</a></li>"; } string pageId = Request.QueryString["pageId"]; if (pageId != null) { int id = int.Parse(pageId); Model.Page page = null; try { page = (from x in mc.PageSet where x.Id == id select x).First(); } catch(Exception) { } if (page == null) { page = (Model.Page)defaultPage; Response.Redirect("Default.aspx?pageId="+page.Id); } PageId = id; PageContent = page.Content; } else { PageId = defaultPage.Id; PageContent = defaultPage.Content; } }
public string GetLogo() { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.AllPagesSet select x).First(); return page.Logo; }
public int GetLastPage() { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet orderby x.Id ascending select x).First(); return page.Id; }
public string GetContent(int id) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == id select x).First(); return page.Content; }
public void UpdatePage(int id, string name) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == id select x).First(); page.Name = name; mc.SaveChanges(); }
public void UpdateLogo(string html) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.AllPagesSet select x).First(); page.Logo = html; mc.SaveChanges(); }
public void UpdateColor(int red, int green ,int blue) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.AllPagesSet select x).First(); page.ColorR = red; page.ColorG = green; page.ColorB = blue; mc.SaveChanges(); }
public void SaveContent(string html, int id) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == id select x).First(); page.Content = html; mc.SaveChanges(); }
public string GetMarker(int id) { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.PageSet where x.Id == id select x).First(); string value = page.Marker_x + ";;;" + page.Marker_y + ";;;" + page.Marker_comment; return value; }
public int GetColorR() { ModelContainer1 mc = new ModelContainer1(); var page = (from x in mc.AllPagesSet select x).First(); return page.ColorR; }