Exemplo n.º 1
0
 private void populateControls()
 {
     CustomPageBL customPageBL = new CustomPageBL();
     cmbCustomPageCategory.DataSource = customPageBL.GetCustomPageCategories();
     cmbCustomPageCategory.DataTextField = "name";
     cmbCustomPageCategory.DataValueField = "customPageCategoryID";
     cmbCustomPageCategory.DataBind();
 }
Exemplo n.º 2
0
 private void loadCustomPage(string url)
 {
     CustomPageBL customPageBL = new CustomPageBL();
     CustomPage customPage = customPageBL.GetCustomPage(url);
     Page.Title = customPage.Title;
     ViewState.Add("pageTitle", customPage.Title);
     lblHeading.Text = customPage.Heading;
     divContent.InnerHtml = customPage.Content;
 }
Exemplo n.º 3
0
        protected void dgvCustomPages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "deleteCustomPage")
            {
                CustomPage customPage = new CustomPageBL().GetCustomPage(int.Parse(e.CommandArgument.ToString()));
                new CustomPageBL().Delete(int.Parse(e.CommandArgument.ToString()));

                //Common.RemoveUrlRewrite(customPage.Url);
                loadCustomPages();
            }
        }
Exemplo n.º 4
0
 private void loadCustomPage(int customPageID)
 {
     CustomPageBL customPageBL = new CustomPageBL();
     CustomPage customPage = customPageBL.GetCustomPage(customPageID);
     txtTitle.Text = customPage.Title;
     txtDescription.Text = customPage.Description;
     txtUrl.Text = customPage.Url;
     txtHeading.Text = customPage.Heading;
     txtHead.Text = customPage.Head;
     txtInsertDate.Text = customPage.InsertDate.ToString();
     txtUpdateDate.Text = customPage.UpdateDate.ToString();
     txtContent.Text = customPage.Content;
     ViewState.Add("customPageID", customPage.CustomPageID);
     lblTitleHeading.Text = customPage.Heading;
     ViewState.Add("pageTitle", customPage.Title);
     chkIsActive.Checked = customPage.IsActive;
     cmbCustomPageCategory.SelectedValue = customPage.CustomPageCategoryID.ToString();
 }
Exemplo n.º 5
0
        private void save()
        {
            try
            {
                CustomPage customPage = new CustomPage();
                customPage.CustomPageID = (ViewState["customPageID"] != null) ? int.Parse(ViewState["customPageID"].ToString()) : 0;
                int customPageID = customPage.CustomPageID;
                customPage.Title = txtTitle.Text;
                customPage.Description = txtDescription.Text;
                customPage.Url = txtUrl.Text;
                customPage.Heading = txtHeading.Text;
                customPage.Head = txtHead.Text;
                customPage.InsertDate = DateTime.Now.ToUniversalTime();
                customPage.UpdateDate = DateTime.Now.ToUniversalTime();
                customPage.Content = txtContent.Text;
                customPage.SortIndex = 1;
                customPage.ImageUrl = string.Empty;
                customPage.IsActive = chkIsActive.Checked;
                customPage.CustomPageCategoryID = int.Parse(cmbCustomPageCategory.SelectedValue);

                CustomPageBL customPageBL = new CustomPageBL();
                customPage.CustomPageID = customPageBL.Save(customPage);

                //if (customPageID == 0)
                    //Common.AddUrlRewrite(customPage.Url, "customPage.aspx");

                lblTitleHeading.Text = customPage.Heading;
                ViewState.Add("customPageID", customPage.CustomPageID);
                ViewState.Add("pageTitle", customPage.Title);

                divAlert.Visible = true;
                divAlert.Attributes["class"] = "alert alert-success text-center";
                lblAlert.Text = "Custom page saved";
            }
            catch (Exception ex)
            {
                divAlert.Visible = true;
                divAlert.Attributes["class"] = "alert alert-danger text-center";
                lblAlert.Text = ex.Message;
            }
        }