예제 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        var page = new WebPage();

        if (IsLoaded)
            page.CopyPropertiesFrom(OriginalPage);

        page.ParentPageId = null;
        if (!String.IsNullOrEmpty(cboParentPages.SelectedValue))
            page.ParentPageId = Convert.ToInt32(cboParentPages.SelectedValue);

        page.Name = txtName.Text;
        page.CompanyId = Company.CompanyId;
        page.Description = txtDescription.Value.Replace("$0", "<br/>");
        page.IsInMenu = chkIsInMenu.Checked;

        page.IsPublished = chkIsPublished.Checked;
        page.CanComment = chkCanComment.Checked;
        page.MasterPage = cboMasterPage.Text;

        if (page.IsPublished)
        {
            if (!page.PublishedDate.HasValue)
                page.PublishedDate = DateTime.Now;
        }
        else
            page.PublishedDate = null;

        page.RedirectUrl = null;
        if (!String.IsNullOrEmpty(txtRedirectUrl.Text))
            page.RedirectUrl = txtRedirectUrl.Text;

        page.ModifiedDate = DateTime.Now;

        if (!page.UserId.HasValue)
            page.UserId = User.Identity.UserId;

        SiteManager.Save(page, txtTags.Text);

        if (((WebControl)sender).ID == "btnSaveAndNew")
        {
            Response.Redirect("WebPage.aspx");
            return;
        }
        //
        //Close the modal popup and redirect for WebPages.aspx
        //
        ClientScript.RegisterStartupScript(this.GetType(), "close", "top.$.LightboxObject.close();", true);

        //Response.Redirect("WebPages.aspx");

    }
예제 #2
0
        public void Save(WebPage page, string tags)
        {
            WebPage originalPage = GetWebPage(page.CompanyId, page.WebPageId).Detach();

            page.ModifiedDate = originalPage.ModifiedDate = DateTime.Now;

            //
            // Save
            //
            if (originalPage.WebPageId == -404)
            {
                DbContext.WebPages.InsertOnSubmit(page);
            }
            else
            {
                originalPage.CopyPropertiesFrom(page);
            }

            DbContext.SubmitChanges();

            string[] list = null;

            //
            // Tags
            //
            if (!String.IsNullOrEmpty(tags))
            {
                list = tags.Split(',');
                DbContext.PageTags.DeleteAllOnSubmit(DbContext.PageTags.Where(p => p.WebPageId == page.WebPageId));
                DbContext.SubmitChanges();

                foreach (string item in list)
                {
                    if (!String.IsNullOrEmpty(item))
                    {
                        DbContext.PageTags.InsertOnSubmit(new PageTag
                        {
                            CompanyId = page.CompanyId,
                            WebPageId = page.WebPageId,
                            Name      = item.Trim()
                        });
                    }
                }
                DbContext.SubmitChanges();
            }


            //
            // Categories
            //
            //if (!String.IsNullOrEmpty(categories))
            //{
            //    list = categories.Split(',');
            //    DbContext.PageCategories.DeleteAllOnSubmit(
            //        DbContext.PageCategories.Where(p => p.WebPageId == page.WebPageId));
            //    DbContext.SubmitChanges();

            //    foreach (string item in list)
            //        if (!String.IsNullOrEmpty(item))
            //            DbContext.PageCategories.InsertOnSubmit(new PageCategory
            //                                                        {
            //                                                            CompanyId = page.CompanyId,
            //                                                            WebPageId = page.WebPageId,
            //                                                            Name = item.Trim()
            //                                                        });
            //    DbContext.SubmitChanges();
            //}

            //
            // Rollup tree with configs
            //
            RollupConfig(originalPage);
        }
예제 #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        var page = new WebPage();

        if (IsLoaded)
        {
            page.CopyPropertiesFrom(OriginalPage);
        }

        page.ParentPageId = null;
        if (!String.IsNullOrEmpty(cboParentPages.SelectedValue))
        {
            page.ParentPageId = Convert.ToInt32(cboParentPages.SelectedValue);
        }

        page.Name        = txtName.Text;
        page.CompanyId   = Company.CompanyId;
        page.Description = txtDescription.Value.Replace("$0", "<br/>");
        page.IsInMenu    = chkIsInMenu.Checked;

        page.IsPublished = chkIsPublished.Checked;
        page.CanComment  = chkCanComment.Checked;
        page.MasterPage  = cboMasterPage.Text;

        if (page.IsPublished)
        {
            if (!page.PublishedDate.HasValue)
            {
                page.PublishedDate = DateTime.Now;
            }
        }
        else
        {
            page.PublishedDate = null;
        }

        page.RedirectUrl = null;
        if (!String.IsNullOrEmpty(txtRedirectUrl.Text))
        {
            page.RedirectUrl = txtRedirectUrl.Text;
        }

        page.ModifiedDate = DateTime.Now;

        if (!page.UserId.HasValue)
        {
            page.UserId = User.Identity.UserId;
        }

        SiteManager.Save(page, txtTags.Text);

        if (((WebControl)sender).ID == "btnSaveAndNew")
        {
            Response.Redirect("WebPage.aspx");
            return;
        }
        //
        //Close the modal popup and redirect for WebPages.aspx
        //
        ClientScript.RegisterStartupScript(this.GetType(), "close", "top.$.LightboxObject.close();", true);

        //Response.Redirect("WebPages.aspx");
    }