Пример #1
0
        public void getdata()
        {
            int type = gettype();

            title = NewsTypeService.GetTypeName(type);
            this.uc_breadcrumb.Title = title;
            string s = NewsTypeService.GetNewsTypeById(type).issimple.ToString();

            if (s == "0")
            {
                issimple = false;



                this.rpNewslist.DataSource = pds();
                this.rpNewslist.DataBind();
            }
            else if (s == "1")
            {
                issimple = true;

                this.rpsimple.DataSource = NewsService.GetSimpleNews(type);
                this.rpsimple.DataBind();
            }
            else
            {
                Response.Redirect("news_pic.aspx?type=" + type);
            }
        }
Пример #2
0
        protected void sbEdit_ServerClick(object sender, EventArgs e)
        {
            NewsType ob = NewsTypeService.GetNewsTypeById(int.Parse(Request["edit"]));


            if (ob != null)
            {
                ob.typename = tbTitle.Text.Trim();
                ob.issimple = int.Parse(rbIssimple.SelectedValue);
                ob.sort     = int.Parse(tbSord.Text);
                NewsTypeService.UpdateNewsType(ob);
            }
            ShowJs.ShowAndRedirect("修改成功!", hdUrl.Value, this.Page);
        }
Пример #3
0
        public string geturl(string type)
        {
            string t = NewsTypeService.GetNewsTypeById(int.Parse(type)).issimple.ToString();

            switch (t)
            {
            case "0":
            case "1": return("news_list.aspx?type=" + type);

            case "2": return("news_pic.aspx?type=" + type);

            default: return("news_list.aspx?type=" + type);
            }
        }
Пример #4
0
        public string getlisttype(int id)
        {
            string s = NewsTypeService.GetNewsTypeById(id).issimple.ToString();

            switch (s)
            {
            case "0": return("列表页");

            case "1": return("内容页");

            case "2": return("图片页");

            default: return("未知");
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!LJH.Rank.IsModuleRank(1401))
            // {
            //    Response.Write("<div style='width:100%;margin-top:200px;text-align:center;color:red;'>您没有本模块的操作权限! 请与管理员联系!</div>");
            //     Response.End();
            // }
            if (Request["edit"] != null)
            {
                sbEdit.Visible  = true;
                Submit1.Visible = false;
                btBack.Visible  = true;
            }
            else
            {
                sbEdit.Visible  = false;
                Submit1.Visible = true;
                btBack.Visible  = false;
            }
            if (Request["del"] != null)
            {
                NewsTypeService.DeleteNewsType(int.Parse(Request["del"]));
                Response.Redirect(Request["reUrl"].Replace("|", "&"));
            }
            if (!IsPostBack)
            {
                if (Request["edit"] != null)
                {
                    hdUrl.Value = Request.UrlReferrer.ToString();
                    NewsType n = NewsTypeService.GetNewsTypeById(int.Parse(Request["edit"]));

                    if (n != null)
                    {
                        tbTitle.Text             = n.typename;
                        rbIssimple.SelectedValue = n.issimple.ToString();
                        tbSord.Text = n.sort.ToString();
                        if (n.p_id == 0)
                        {
                            trIssimple.Visible = false;
                            hlBack.Text        = "顶级分类";
                        }
                        else
                        {
                            trIssimple.Visible = true;
                            hlBack.NavigateUrl = "news_type.aspx?id=" + n.p_id.ToString();
                            hlBack.Text        = NewsTypeService.GetTypeName(n.p_id);
                        }
                    }
                }
                else if (Request["id"] != null)
                {
                    trIssimple.Visible = true;

                    NewsType n = NewsTypeService.GetNewsTypeById(int.Parse(Request["id"]));


                    if (n != null)
                    {
                        hlBack.Text = n.typename;
                        if (n.p_id != 0)
                        {
                            hlBack.NavigateUrl = "news_type.aspx?id=" + n.p_id.ToString();
                        }
                        else
                        {
                            hlBack.NavigateUrl = "news_type.aspx";
                        }
                    }
                }

                else
                {
                    trIssimple.Visible = false;
                    hlBack.Text        = "顶级分类";
                }

                if (Request["isdefault"] != null && Request["eid"] != null)
                {
                    bool isdefault = Request["isdefault"] == "0" ? false : true;
                    NewsTypeService.SetIsDefault(isdefault, int.Parse(Request["eid"]));

                    Response.Redirect(Request.UrlReferrer.ToString());
                }
            }
            Bind();
        }