Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"GuestBook.aspx\" class=\"home\">留言管理</a>";
            string checklogin = new AdminBll().CheckLogin("3");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            id = BasePage.GetRequestId(Request.QueryString["id"]);

            string siteconfig = new WebConfigBll().GetModel(1).SiteConfig;
            if (!String.IsNullOrEmpty(siteconfig))
            {
                string[] a = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    showhide     = a[1];
                    showhidelist = a[2];
                }
            }

            if (id != 0)
            {
                GuestBookModel model = new GuestBookBll().GetModel(id);
                bool           b     = new CommonBll().Exists("GL_GuestBook", id);
                if (b)
                {
                    txtTitle.Text     = model.Title;
                    txtUserName.Text  = model.UserName;
                    txtTel.Text       = model.Tel;
                    txtFax.Text       = model.Fax;
                    txtMobile.Text    = model.Mobile;
                    txtCompany.Text   = model.Company;
                    txtAddress.Text   = model.Address;
                    txtEmail.Text     = model.Email;
                    txtSiteUrl.Text   = model.SiteUrl;
                    txtCode.Text      = model.Code;
                    txtAddTime.Text   = model.AddTime.ToString();
                    txtQQ.Text        = model.QQ;
                    txtWangWang.Text  = model.WangWang;
                    txtMSN.Text       = model.MSN;
                    txtContents.Text  = model.Contents;
                    txtIP.Text        = model.IP;
                    txtReply.Text     = model.Reply;
                    txtReplyTime.Text = model.ReplyTime.ToString();
                    if (model.Verific == 0)
                    {
                        txtVerific.Checked = true;
                    }
                    if (model.Sex == 0)
                    {
                        txtsex.Text = "先生";
                    }
                    else if (model.Sex == 1)
                    {
                        txtsex.Text = "女士";
                    }
                }
                else
                {
                    BasePage.Alertback("参数出错。");
                    return;
                }
            }
            else
            {
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页

                ds = new CommonBll().GetListPage("", "GL_GuestBook", "", "id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();
                int totalrecord = new CommonBll().GetRecordCount("GL_GuestBook", "");//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\" class=\"red\">暂无相关留言</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        showhide.Visible   = false;
        showddltid.Visible = false;
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        if (!Page.IsPostBack)
        {
            string bx = "<a class=\"home\" href=\"DIYPage.aspx\">单页管理</a>";
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
            {
                bx += "<a href =\"?Ac=add&tid=" + Request.QueryString["tid"] + "\" class=\"add\">新建单页</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bx;
            string checklogin = new AdminBll().CheckLogin("9");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            string siteconfig = new WebConfigBll().GetModel(1).SiteConfig;
            if (!String.IsNullOrEmpty(siteconfig))
            {
                string[] a = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    if (a[3] == "0")
                    {
                        //隐藏
                        showhide.Visible = true;
                    }
                }
            }

            action = Request.QueryString["Ac"];
            int    tid      = BasePage.GetRequestId(Request.QueryString["tid"]);
            string strwhere = "Tid=" + tid;
            if (String.IsNullOrEmpty(action))
            {
                Repeater1.DataSource = new CommonBll().GetList("", datatable, strwhere, "PageType desc,px desc,id desc");
                Repeater1.DataBind();
            }
            else if (action == "add")
            {
                ddltid.DataSource     = new CommonBll().GetList("", datatable, "PageType=1", "id desc");
                ddltid.DataTextField  = "PageName";
                ddltid.DataValueField = "id";
                ddltid.DataBind();
                ddltid.Items.Insert(0, new ListItem("无上级栏目", "0"));
                if (id != 0)
                {
                    DiyPageModel dm = new DiyPageBll().GetModel(id);
                    txtPageName.Text     = dm.PageName;
                    ddltid.SelectedValue = dm.Tid.ToString();
                    // ddltid.Enabled = false;
                    txtpx.Text = dm.Px.ToString();

                    txtseotitle.Text       = dm.SeoTitle;
                    txtkeyword.Text        = dm.SeoKeyword;
                    txtSeoDescription.Text = dm.SeoDescription;
                    txtcontents.Text       = dm.PageContents;
                    txtPicUrl.Text         = dm.PagePicUrl;
                    Button1.Text           = "确认修改";
                    contentsfield          = dm.PageContentsField;
                    SetCheckedBox.SetChecked(this.txtpagecontentsfield, dm.PageContentsField, ",");
                }
                if (gethide("1"))
                {
                    showddltid.Visible = true;
                }
                if (tid != 0)//从栏目里点新建,则开启所属栏目
                {
                    showddltid.Visible   = true;
                    ddltid.SelectedValue = tid.ToString();
                    txtpagecontentsfield.SelectedValue = "1";
                }
            }
            else if (action == "clone")
            { //克隆数据
                if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
                {
                    string filename = "PageName,ModelName,PageFilename,PageContents,EditTime,SeoTitle,SeoKeyword,SeoDescription,PageType,Px,Tid,PageContentsField,PagePicUrl";
                    int    c        = new CommonBll().CloneData(filename, datatable, "id=" + id);
                    if (c > 0)
                    {
                        BasePage.JscriptPrint(Page, "克隆成功!", "diypage.aspx?tid=" + tid);
                    }
                }
            }
        }
    }