Пример #1
0
		private void detach_PageObjects(PageObject entity)
		{
			this.SendPropertyChanging();
			entity.Page = null;
		}
Пример #2
0
		private void attach_PageObjects(PageObject entity)
		{
			this.SendPropertyChanging();
			entity.Page = this;
		}
Пример #3
0
 partial void DeletePageObject(PageObject instance);
Пример #4
0
 partial void UpdatePageObject(PageObject instance);
Пример #5
0
 partial void InsertPageObject(PageObject instance);
Пример #6
0
        public string AddPage(string title, int? parentid)
        {
            Page lastpage;
              if (parentid > 0)
            lastpage = db.Pages.Where(pg => pg.ParentID == parentid).OrderByDescending(pg => pg.MenuOrder).FirstOrDefault();
              else
              {
            lastpage = db.Pages.Where(pg => object.Equals(pg.ParentID, null)).OrderByDescending(pg => pg.MenuOrder).FirstOrDefault();
            parentid = null;
              }

              int? menuOrder = 1;
              if (lastpage != null)
            menuOrder = lastpage.MenuOrder + 1;

              Page p = new Page();
              p.Title = Server.HtmlEncode(title);
              p.MenuTitle = Server.HtmlEncode(title);
              p.Permalink = TitleToPermalink(title);
              p.ParentID = parentid;
              p.MenuOrder = menuOrder;
              p.DisplayInMenu = false;
              p.Locked = 0;
              p.DevelopmentID = 1;
              p.CreatedBy = "admin";
              p.Enabled = true;
              p.Type = "template";
              p.TemplateID = 1;

              PageObject po = new PageObject();
              po.Page = p;
              po.HtmlContent = "";
              po.Type = "{html_content}";

              db.Pages.InsertOnSubmit(p);
              db.PageObjects.InsertOnSubmit(po);
              db.SubmitChanges();

              return p.PageID.ToString();
        }