public void Fill()
    {
        dm.Id = decimal.Parse(Request.QueryString["ID_Page"].ToString());


        DataTable dt = ac.Select_page_One(dm);

        if (dt.Rows.Count > 0)
        {
            if (bool.Parse(dt.Rows[0]["Show_Page"].ToString()))
            {
                update_number_view();

                Label1.Text        = dt.Rows[0]["title"].ToString();
                Label1.NavigateUrl = "~/index.aspx?ID_Page=" + dm.Id.ToString();

                Label12.Text = dt.Rows[0]["text"].ToString();
                Label3.Text  = (int.Parse(dt.Rows[0]["page_view"].ToString()) + 1).ToString();
                Label4.Text  = dt.Rows[0]["date_send"].ToString();

                SetMetaTags(dt.Rows[0]["title"].ToString(),
                            dt.Rows[0]["MetaDescription"].ToString(),
                            dt.Rows[0]["MetaKeyword"].ToString());
            }
            else
            {
                Response.Redirect("~/index.aspx?Type=404");
            }
        }
        else
        {
            Response.Redirect("~/index.aspx?Type=404");
        }
    }
    //----------------------------------------------------------------------------------------------

    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        dm.Id = decimal.Parse(((Label)(GridView1.Rows[e.NewEditIndex].FindControl("lblID"))).Text);
        DataTable dt = ac.Select_page_One(dm);

        TextTitle.Text          = dt.Rows[0]["Title"].ToString();
        TextBox1.Text           = dt.Rows[0]["MetaKeyword"].ToString();
        TextBox2.Text           = dt.Rows[0]["MetaDescription"].ToString();
        FCKeditor1.Value        = dt.Rows[0]["text"].ToString();
        CheckBox1.Checked       = bool.Parse(dt.Rows[0]["Show_Page"].ToString());
        LblHidden.ToolTip       = dm.Id.ToString();
        GridView1.SelectedIndex = e.NewEditIndex;
        Button1.Text            = "ویرایش";
    }
示例#3
0
    private void FillPath()
    {
        lblPath.Text = "";
        if (Request.QueryString["ID_Root"] != null && Request.QueryString["ID_Root"].Length > 0)
        {
            if (Request.QueryString["ID_Root"] != "-1")
            {
                dm.Id = int.Parse(Request.QueryString["ID_Root"]);
                DataTable dt = ac.SelectOne(dm);

                string    delimitedInfo = dt.Rows[0]["Path"].ToString();
                string[]  discreteInfo  = delimitedInfo.Split(new char[] { ',' });
                string    title         = "";
                DataTable dt2           = new DataTable();
                foreach (string Data in discreteInfo)
                {
                    if (Data == "-1")
                    {
                        title = "صفحه اصلی";
                    }
                    else
                    {
                        dm.Id = int.Parse(Data);
                        dt2   = ac.SelectOne(dm);
                        if (dt2.Rows.Count > 0)
                        {
                            title = dt2.Rows[0]["Title"].ToString();
                        }
                    }
                    lblPath.Text = lblPath.Text + "<a href='./index.aspx?Type=ProductCategory&ID_Root=" +
                                   Data + "'>" + title + "</a>" + "<img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
                }
                lblPath.Text = lblPath.Text + "<a href='./index.aspx?Type=ProductCategory&ID_Root=" +
                               dt.Rows[0]["ID"].ToString() + "'>" + dt.Rows[0]["Title"].ToString() + "</a>" + "<img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
            }
            else
            {
                lblPath.Text = lblPath.Text + "<a href='./index.aspx'>صفحه اصلی</a><img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
            }
        }
        else
        {
            lblPath.Text = lblPath.Text + "<a href='./index.aspx'>صفحه اصلی</a><img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
        }

        if (Request.QueryString["ID_Product"] != null)
        {
            Product      ac3 = new Product();
            ProductDatum dm3 = new ProductDatum();
            dm3.Id = decimal.Parse(Request.QueryString["ID_Product"]);
            DataTable dt3 = ac3.Select_Product_One(dm3);
            if (dt3.Rows.Count > 0)
            {
                lblPath.Text = lblPath.Text + "<a href='./index.aspx?ID_Product=" + Request.QueryString["ID_Product"] +
                               "&ID_Root=" + dt3.Rows[0]["id_group"].ToString() + "'>" + dt3.Rows[0]["Title"].ToString() + "</a><img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
            }
            else
            {
                Response.Redirect("~/index.aspx?Type=404");
            }
        }
        if (Request.QueryString["ID_Page"] != null)
        {
            Page_Manage      ac4 = new Page_Manage();
            Page_ManageDatum dm4 = new Page_ManageDatum();
            dm4.Id = decimal.Parse(Request.QueryString["ID_Page"]);
            DataTable dt4 = ac4.Select_page_One(dm4);
            if (dt4.Rows.Count > 0)
            {
                lblPath.Text = lblPath.Text + "<a href='./index.aspx?Type=PageArchive'>آرشیو صفحات</a><img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>" +
                               "<a href='./index.aspx?ID_Page=" + Request.QueryString["ID_Page"] +
                               "'>" + dt4.Rows[0]["Title"].ToString() + "</a><img src='./Administrator/files/Design/arrow_rtl.png' class='PathArrow'/>";
            }
            else
            {
                Response.Redirect("~/index.aspx?Type=404");
            }
        }
    }