Ejemplo n.º 1
0
    //权限
    protected bool showhide(string p)
    {
        bool b = false;

        b = BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), p);
        return(b);
    }
Ejemplo n.º 2
0
    //del
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "92"))
        {
            BasePage.Alertback("您没有删除的权限!");
            Response.End();
        }
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);
        //检查有无下级
        int exit = new CommonBll().GetRecordCount(datatable, "tid=" + id + " and PageType=0");

        if (exit > 0)
        {
            BasePage.Alertback("请先删除子栏目!");
            Response.End();
        }

        bool b = new CommonBll().Delete(datatable, id);

        if (b)
        {
            BasePage.JscriptPrint(Page, "删除成功!", "diypage.aspx");
        }
    }
Ejemplo n.º 3
0
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        ////检查有没删除的权限
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "cd" + mid))
        {
            BasePage.Alertback(Page, "您没有删除此栏目的权限!");
            return;
        }

        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);

        //检查是否存在子栏目
        int bc = new CommonBll().GetRecordCount("GL_Class", "ParentId=" + id);

        if (bc > 0)
        {
            BasePage.Alertback(Page, "请先删除子栏目!");
            return;
        }
        else
        {
            bool b = new CommonBll().Delete("GL_Class", id);
            if (b)
            {
                BasePage.JscriptPrint(Page, "删除成功!", "back");
            }
        }
    }
Ejemplo n.º 4
0
    //add or edit
    protected void Button1_Click(object sender, EventArgs e)
    {
        BlockModel model = new BlockModel();

        model.Title    = txtPageName.Text;
        model.Contents = txtcontents.Text;
        model.AddDate  = DateTime.Now.ToString();
        model.id       = id;
        if (id == 0)
        {
            if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
            {
                BasePage.Alertback("您没有删除的权限!");
                Response.End();
            }
            int i = new BlockBll().Add(model);
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "block.aspx");
            }
        }
        else
        {
            bool b = new BlockBll().Update(model);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", "block.aspx");
            }
        }
    }
Ejemplo n.º 5
0
 //可选字段隐藏
 protected bool gethide(string eid)
 {
     if (BasePage.ArrayExist(ModeContent, eid))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
 //列表
 protected bool gethidelist(string eid)
 {
     if (BasePage.ArrayExist(showhidelist, eid))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
 protected bool GetPower(string cn)
 {
     //编辑添加删除权限
     if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), cn + mid))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        id = BasePage.GetRequestId(Request.QueryString["id"]);
        if (!Page.IsPostBack)
        {
            string btxt = "<a href=\"block.aspx\" class=\"home\">方块碎片</a>";
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
            {
                btxt += "<a href=\"block.aspx?Ac=add\" class=\"add\">添加方块碎片</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = btxt;
            string checklogin = new AdminBll().CheckLogin("17");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            if (!String.IsNullOrEmpty(Request.QueryString["Ac"]))
            {
                action = Request.QueryString["Ac"];
            }
            else
            {
                action = "show";
            }
            //txtModelName.ReadOnly = true;
            if (id != 0)
            {
                BlockModel model = new BlockBll().GetModel(id);
                txtPageName.Text    = model.Title;
                txtPageName.Enabled = false;
                txtcontents.Text    = model.Contents;
                Button1.Text        = "确认修改";
            }
            else
            {
                string  strwhere  = "";
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
                ds = new CommonBll().GetListPage("", datatable, strwhere, "id desc", PageSize, PageIndex);
                Repeater1.DataSource = ds;
                Repeater1.DataBind();

                int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数
                if (totalrecord == 0)
                {
                    txtpage.Text = "<p align=\"center\" class=\"red\">暂无相关数据</p>";
                }
                else if (totalrecord > PageSize)
                {
                    txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
Ejemplo n.º 9
0
    //Power
    protected bool GetPower(string id)
    {
        bool a = false;

        if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), id))
        {
            a = true;
        }
        return(a);
    }
Ejemplo n.º 10
0
 protected bool getmodelclass(string cn)
 {
     if (!String.IsNullOrEmpty(modelclass))
     {
         string[] a = modelclass.Split('`');
         //编辑添加删除权限
         if (BasePage.ArrayExist(a[1], cn))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 11
0
    //列表可选字段
    protected bool showhidelist(string v)
    {
        bool b = false;

        if (!String.IsNullOrEmpty(showhidelistvalue))
        {
            string[] a = showhidelistvalue.Split('|');
            if (BasePage.ArrayExist(a[0], v))
            {
                b = true;
            }
        }
        return(b);
    }
Ejemplo n.º 12
0
    //add or edit
    protected void Button1_Click(object sender, EventArgs e)
    {
        DiyPageModel model = new DiyPageModel();

        model.PageName = txtPageName.Text;

        model.PageContents = txtcontents.Text;
        model.EditTime     = DateTime.Now;
        if (!String.IsNullOrEmpty(txtseotitle.Text))
        {
            model.SeoTitle = txtseotitle.Text;
        }
        else
        {
            model.SeoTitle = txtPageName.Text;
        }
        model.SeoKeyword     = txtkeyword.Text;
        model.SeoDescription = txtSeoDescription.Text;
        model.Px             = BasePage.GetRequestId(txtpx.Text);
        model.Tid            = BasePage.GetRequestId(ddltid.SelectedValue);
        model.PageType       = 0;
        model.PagePicUrl     = txtPicUrl.Text;

        model.PageContentsField = SetCheckedBox.GetChecked(this.txtpagecontentsfield, ",");

        model.id = id;
        if (id == 0)
        {
            if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
            {
                BasePage.Alertback("您没有添加新单页的权限!");
                Response.End();
            }
            int i = new DiyPageBll().Add(model);
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "DiyPage.aspx?tid=" + ddltid.SelectedValue);
            }
        }
        else
        {
            bool b = new DiyPageBll().Update(model);
            if (b)
            {
                BasePage.JscriptPrint(Page, "修改成功!", "DiyPage.aspx?tid=" + ddltid.SelectedValue);
            }
        }
    }
Ejemplo n.º 13
0
    protected string Getchildren(string id, string pagetype)
    {
        string h = "";

        if (pagetype == "0")
        {
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
            {
                h = "<a href=\"?Ac=clone&id=" + id + "\" title=\"克隆数据\">克隆</a> ";
            }
            h += "<a href=\"?Ac=add&id=" + id + "\">编辑</a>";
        }
        else if (pagetype == "1")
        {
            h = "<a href=\"?tid=" + id + "\">查看</a>";
        }
        return(h);
    }
Ejemplo n.º 14
0
    //del
    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "23"))
        {
            BasePage.Alertback("您没有删除的权限!");
            Response.End();
        }
        //当前点击按钮,获取传过来的ID
        LinkButton lb    = (LinkButton)sender;
        string     delid = lb.CommandArgument;
        int        id    = BasePage.GetRequestId(delid);

        bool b = new CommonBll().Delete(datatable, id);

        if (b)
        {
            BasePage.JscriptPrint(Page, "删除成功!", "block.aspx");
        }
    }
Ejemplo n.º 15
0
        /// <summary>
        /// 验证是否登录及权限
        /// </summary>
        /// <param name="ModelPower">权限数组</param>
        /// <returns></returns>
        public string CheckLogin(string ModelPower)
        {
            string meg = "";

            if (!String.IsNullOrEmpty(Cookies.GetCookie("User_Name")))
            {
                string UserName          = Cookies.GetCookie("User_Name").ToString();
                string CookieMD5UserName = Cookies.GetCookie("MD5Name").ToString();
                string UserId            = Cookies.GetCookie("User_Id").ToString();
                string MD5UserName       = FormsAuthentication.HashPasswordForStoringInConfigFile(UserId + UserName + "Cookies?", "MD5");
                if (CookieMD5UserName == MD5UserName)
                {
                    //判断权限
                    if (ModelPower == "no")//为no是表示该页登录即可
                    {
                        meg = "true";
                    }
                    else
                    {
                        if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), ModelPower))
                        {
                            meg = "true";
                        }
                        else
                        {
                            meg = "您没有管理此内容的权限,请与管理员联系!";
                        }
                    }
                }
                else
                {
                    meg = "请不要非法操作!";
                }
            }
            else
            {
                meg = "您还没有登录或登录超时,请重新登录!";
            }
            return(meg);
        }
Ejemplo n.º 16
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        DiyPageModel model = new DiyPageModel();

        model.PageName = txtpagename1.Text;
        model.PageType = 1;
        model.EditTime = DateTime.Now;
        int i = new DiyPageBll().Add(model);

        if (!BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "91"))
        {
            BasePage.Alertback("您没有添加新单页的权限!");
            Response.End();
        }
        else
        {
            if (i > 0)
            {
                BasePage.JscriptPrint(Page, "添加成功!", "DiyPage.aspx");
            }
        }
    }
Ejemplo n.º 17
0
    private string showhidelistvalue = "";    //列表可选字段值
    protected void Page_Load(object sender, EventArgs e)
    {
        mid = BasePage.GetRequestId(Request.QueryString["mid"]);
        tid = BasePage.GetRequestId(Request.QueryString["tid"]);
        if (mid == 0)
        {
            mid = 1;
        }
        if (!String.IsNullOrEmpty(Request.QueryString["language"]))
        {
            Language = BasePage.GetRequestId(Request.QueryString["language"]).ToString();
            lansql   = " and Languagen=" + BasePage.GetRequestId(Language);
        }
        ac = Request.QueryString["ac"];
        ModelModel mo = new ModelBll().GetModel(mid);

        datatable = mo.ModelTable;
        ItemName  = mo.ItemName;

        if (!Page.IsPostBack)
        {
            string checklogin = new AdminBll().CheckLogin("m" + mid);
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }

            verific = BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "ms" + mid);//不需要审核的管理员,显示审核,审核其它需要审核的文章
            del     = BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "md" + mid);

            if (!String.IsNullOrEmpty(mo.ModeContent))
            {
                //0模型内容可选字段`1模型栏目可选字段`2内容字段名称`3模型列表可选字段`4提示语`5发表审核选择
                string[] a = mo.ModeContent.Split('`');

                //下拉属性
                if (BasePage.ArrayExist(a[0], "9"))
                {
                    //推荐属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("推荐", "1"));
                }
                if (BasePage.ArrayExist(a[0], "11"))
                {
                    //热门属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("热门", "2"));
                }
                if (BasePage.ArrayExist(a[0], "12"))
                {
                    //最新属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("最新", "3"));
                }
                if (sxddl)
                {
                    ddlshuxi.Items.Insert(0, new ListItem("按属性查看", ""));
                }
                showhidelistvalue = a[3];
                if (!BasePage.ArrayExist(a[0], "19"))
                {
                    //按栏目查看
                    ddlclassname.Visible = false;
                }
                if (a[5] == "0")//模型不需要审核,隐藏审核链接
                {
                    verific = true;
                }
            }

            DrLanguage.SelectedValue = Language;

            int sh = BasePage.GetRequestId(Request.QueryString["sh"]);; //审核
            int sx = BasePage.GetRequestId(Request.QueryString["sx"]);  //属性
            ddlshuxi.SelectedValue = sx.ToString();
            string keywords = Request.QueryString["keywords"];
            string strwhere = "id is not null ";

            if (String.IsNullOrEmpty(ac))
            {
                strwhere += " and IsDel=0 and Verific=0";
            }
            else if (ac == "del") //回收站
            {
                strwhere += " and IsDel=1";
                //actxt.InnerHtml = ItemName + "回收站列表";
            }
            else if (ac == "sh")//审核
            {
                strwhere += " and Verific=1";
                //actxt.InnerHtml = ItemName + "审核列表";
            }
            if (tid != 0)
            {
                strwhere += " and (Tid=" + tid + "";
                //读取所有子级
                if (showhidelist("8"))
                {
                    DataTable dt    = new ClassBll().GetListTree(mid, tid, "");
                    string    allid = "";
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow drt in dt.Rows)
                        {
                            allid += drt["id"].ToString() + ",";
                        }
                        allid     = allid.Substring(0, allid.Length - 1);
                        strwhere += " or Tid in (" + allid + ")";
                    }
                }
                strwhere += ")";
            }
            else
            {
                strwhere += lansql;//按栏目查看了就不需要语言了
            }
            if (sx != 0)
            {
                string sht = "";
                switch (sx)
                {
                case 1:
                    sht = "IsRecommend=1";
                    break;

                case 2:
                    sht = "IsPopular=1";
                    break;

                case 3:
                    sht = "IsNew=1";
                    break;
                }
                strwhere += " and " + sht + "";
            }
            if (!String.IsNullOrEmpty(keywords))
            {
                strwhere += " and Title like '%" + keywords + "%'";
            }

            //列出所有栏目
            //string allclass = "ParentId=" + tid + " and ModelId=" + mid + lansql;
            //Repeater2.DataSource = new CommonBll().GetList("", "GL_Class", allclass, "Languagen asc,px desc,id desc");
            //Repeater2.DataBind();

            //批量处理时列出栏目
            ClassTreeBind(0, "请选择栏目", mid, this.ddlclassforall, "ClassType=0" + lansql);

            //按栏目查看下拉
            ClassTreeBind(0, "所有栏目", mid, this.ddlclassname, "ClassType=0" + lansql);
            ddlclassname.SelectedValue = tid.ToString();
            int pagesize  = 25;
            int pageindex = BasePage.GetRequestId(Request.QueryString["page"]);
            int all       = new CommonBll().GetRecordCount(datatable, strwhere);
            Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "px desc,id desc", pagesize, pageindex);
            Repeater1.DataBind();

            if (all > pagesize)
            {
                txtpage.Text = GetPage.GetAspxPager(all, pagesize, pageindex);
            }
            if (all == 0)
            {
                txtpage.Text = "<p align=\"left\" class=red>暂无相关内容</p>";
            }
            //txtpage.Text = strwhere;

            string bx = "<a href=\"Article.aspx?mid=" + mid + "\" class=\"home\">" + ItemName + "管理</ a > ";
            bx += "<a href=\"ArticleAdd.aspx?mid=" + mid + "&language=" + Language + "\" class=\"add\">添加" + ItemName + "</a>";
            if (del)
            {
                bx += "<a href=\"Article.aspx?ac=del&mid=" + mid + "&language=" + Language + "\" class=\"del\">" + ItemName + "回收站</a>";
            }
            if (!verific)
            {
                bx += "<a href=\"Article.aspx?mid=" + mid + "&language=" + Language + "&ac=sh\" class=\"sh\">审核" + ItemName + "</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bx;
        }
    }
Ejemplo n.º 18
0
    //add or edit
    protected void Button1_Click(object sender, EventArgs e)
    {
        ArticleModel ma = new ArticleModel();

        ma.Title = txtTitle.Text.Trim();
        int ctid = BasePage.GetRequestId(Request.Form["txtTid"]);

        ma.Tid       = ctid;
        ma.FullTitle = txtFullTitle.Text;
        ma.Px        = BasePage.GetRequestId(txtPx.Text);
        ma.Author    = txtAuthor.Text;
        ma.Origin    = txtOrigin.Text;
        ma.Hits      = BasePage.GetRequestId(txtHist.Text);
        if (!String.IsNullOrEmpty(txtAddDate.Text))
        {
            ma.AddDate = DateTime.Parse(txtAddDate.Text);
        }
        else
        {
            ma.AddDate = DateTime.Now;
        }
        ma.EditDate   = DateTime.Now;
        ma.PicUrl     = txtPicUrl.Text;
        ma.SeoKeyword = txtKeyWord.Text;
        ma.Intro      = txtIntro.Text;
        string contents1 = txtcontents.Text;

        if (txtspanfont.Checked)//过滤span font
        {
            contents1 = Regex.Replace(contents1, "(<span[^>]+>)|(</span>)", "");
            contents1 = Regex.Replace(contents1, "(<font[^>]+>)|(</font>)", "");//font
        }
        if (txthtml.Checked)
        {
            contents1 = BasePage.HtmlFilter(contents1);
        }
        ma.Contents       = contents1;
        ma.Contents2      = txtcontents2.Text;
        ma.Contents3      = txtcontents3.Text;
        ma.Owner          = Cookies.GetCookie("User_Name");
        ma.SeoDescription = txtDescription.Text;
        if (!String.IsNullOrEmpty(txtseotitle.Text))
        {
            ma.SeoTitle = txtseotitle.Text;
        }
        else
        {
            ma.SeoTitle = txtTitle.Text;
        }
        ma.Languagen    = int.Parse(Drlanguage.SelectedValue);
        ma.IsPopular    = txtPopular.Checked ? 1 : 0;
        ma.IsRecommend  = txtRecommend.Checked ? 1 : 0;
        ma.IsNew        = txtNew.Checked ? 1 : 0;
        ma.FilesUrl     = filesurl.Text;
        ma.TitltColor   = colortxt.Value;
        ma.AllowComment = int.Parse(rallowcomment.SelectedValue);
        if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "ms" + mid))
        {
            ma.Verific = 1;
        }
        else
        {
            ma.Verific = 0;
        }
        ma.id = id;
        //扩展字段
        string _sql       = "";
        int    modeexists = new CommonBll().GetRecordCount("GL_ModelField", "FieldOnOff=0 and Modeid=" + mid);

        if (modeexists > 0)
        {
            string[] _atype     = Request.Params.GetValues("hideFieldType");  //类型
            string[] _atitle    = Request.Params.GetValues("hideFieldTitle"); //
            string[] _bcontents = Request.Params.GetValues("txtFieldContent");
            if (_atype != null && _atitle != null && _bcontents != null)
            {
                for (int i = 0; i < _atitle.Length; i++)
                {
                    string vv = "'" + _bcontents[i] + "'";
                    if (_atype[i].ToString() == "1")
                    { //数值
                        vv = _bcontents[i];
                    }
                    if (String.IsNullOrEmpty(_sql))
                    {
                        _sql += _atitle[i] + "=" + vv;
                    }
                    else
                    {
                        _sql += "," + _atitle[i] + "=" + vv;
                    }
                }
            }
        }


        if (id == 0)
        {
            ma.IsDel = 0;
            int i = new ArticleBll().Add(datatable, ma);
            if (i > 0)
            {
                //更新自定义
                if (modeexists > 0)
                {
                    bool bb = new ArticleBll().Updatezd(datatable, _sql, i);
                }
                BasePage.JscriptPrint(Page, "添加成功!", "Article.aspx?mid=" + mid + "&tid=" + ctid + "&language=" + Language);//添加成功返回当前栏目
            }
        }
        else
        {
            bool b = new ArticleBll().Update(datatable, ma);
            if (b)
            {
                ////更新自定义
                if (modeexists > 0)
                {
                    bool bb = new ArticleBll().Updatezd(datatable, _sql, id);
                }

                BasePage.JscriptPrint(Page, "修改成功!", hiddenbackurl.Value.ToString());
            }
        }
    }
Ejemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        shsiteconfig.Visible = false;

        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<span class=\"home\">系统基本设置</span>";
            string checklogin = new AdminBll().CheckLogin("0");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            if (BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "6"))
            {
                shsiteconfig.Visible = true;
            }
            WebConfigModel wm = new WebConfigBll().GetModel(1);
            txtSiteName.Text    = wm.SiteName;
            txtsitetitle.Text   = wm.SiteTitle;
            txtsitetitleen.Text = wm.SiteTitleEn;
            txtSiteUrl.Text     = wm.SiteUrl;
            txticp.Text         = wm.SiteICP;

            txtSiteKeyword.Text       = wm.SiteKeyword;
            txtSiteKeyworden.Text     = wm.SiteKeywordEn;
            txtSiteDescription.Text   = wm.SiteDescription;
            txtSiteDescriptionen.Text = wm.SiteDescriptionEn;
            txtsiteemail.Text         = wm.SiteMail;
            txtEmailsmtp.Text         = wm.EmailSMTP;
            txtSmtpName.Text          = wm.EmailName;
            txtsitecnzz.Text          = wm.Sitecnzz;
            txtfax.Text     = wm.SiteFax;
            txttel.Text     = wm.SiteTel;
            txtaddress.Text = wm.SiteAddress;
            txtqq.Text      = wm.SiteQQ;
            txtaddress.Text = wm.SiteAddress;
            txtother.Text   = wm.Other;
            txtSmtpPassword.Attributes.Add("value", wm.EmailPassword);
            txtidnum.Text = BasePage.SiteId();
            if (!String.IsNullOrEmpty(wm.SiteConfig))
            {
                string   siteconfig = wm.SiteConfig;
                string[] a          = siteconfig.Split('|');
                if (a.Length > 0)
                {
                    SetCheckedBox.SetChecked(this.CheckBoxList1, a[0], ","); //基本配置
                    SetCheckedBox.SetChecked(this.CheckBoxList2, a[1], ","); //留言内容
                    SetCheckedBox.SetChecked(this.CheckBoxList3, a[2], ","); //留言列表
                    RadioButtonList1.SelectedValue = a[3];                   //单页显示可选
                    showhide = a[0];
                }
            }
            //序列号
            //string word = GreateFiles.Read_File(Server.MapPath("~/id.txt"));
            //if (!String.IsNullOrEmpty(word))
            //{
            //    txtidnum.Text = word.Trim();
            //}
        }
    }
Ejemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        mid = BasePage.GetRequestId(Request.QueryString["mid"]);
        if (mid == 0)
        {
            mid = 2;
        }
        //根据模型找出数据表名
        ModelModel mo = new ModelBll().GetModel(mid);

        datatable = mo.ModelTable;
        ItemName  = mo.ItemName;


        if (!Page.IsPostBack)
        {
            string checklogin = new AdminBll().CheckLogin("m" + mid);
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            ac      = Request.QueryString["ac"];
            verific = BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "ms" + mid);
            del     = BasePage.ArrayExist(Cookies.GetCookie("ModelPower"), "md" + mid);
            cid     = BasePage.GetRequestId(Request.QueryString["cid"]);

            string company   = Request.QueryString["company"];//按公司搜索
            int    companyId = BasePage.GetRequestId(Request.QueryString["companyid"]);
            txtCompany.Text = company;

            if (!String.IsNullOrEmpty(mo.ModeContent))
            {
                //0模型内容可选字段`1模型栏目可选字段`2(以后添加)`3(以后添加)`4提示语`5发表审核选择
                string[] a = mo.ModeContent.Split('`');
                //下拉属性
                if (BasePage.ArrayExist(a[0], "4"))
                {
                    //推荐属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("推荐", "1"));
                }
                if (BasePage.ArrayExist(a[0], "11"))
                {
                    //热卖属性
                    sxddl = true;
                    //ddlshuxi.Items.Insert(0, new ListItem("热门", "2"));
                    ddlshuxi.Items.Insert(0, new ListItem("热门", "2"));
                }
                if (BasePage.ArrayExist(a[0], "26"))
                {
                    //最新属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("最新", "3"));
                }
                if (BasePage.ArrayExist(a[0], "27"))
                {
                    //最新属性
                    sxddl = true;
                    ddlshuxi.Items.Insert(0, new ListItem("特价", "4"));
                }
                if (sxddl)
                {
                    ddlshuxi.Items.Insert(0, new ListItem("按属性查看", ""));
                }
                showhidelistvalue = a[3]; //0录入3添加时间4修改时间5属于6点击7优先
                if (a[5] == "0")          //模型不需要审核,隐藏审核链接
                {
                    verific = true;
                }
            }

            if (!String.IsNullOrEmpty(Request.QueryString["language"]))
            {
                Language = BasePage.GetRequestId(Request.QueryString["language"]).ToString();
                lansql   = " and Languagen=" + BasePage.GetRequestId(Language);
            }
            string strwhere = "id is not null";
            int    sx       = BasePage.GetRequestId(Request.QueryString["sx"]);//属性
            ddlshuxi.SelectedValue = sx.ToString();

            DrLanguage.SelectedValue = Language.ToString();
            string keywords = Request.QueryString["keywords"];

            if (String.IsNullOrEmpty(ac))
            {
                strwhere += " and IsDel=0 and Verific=0";
            }
            else if (ac == "del")
            {
                //回收站
                strwhere += " and IsDel=1";
                // actxt.InnerHtml = ItemName + "回收站列表";
            }
            else if (ac == "sh")
            {
                strwhere += " and Verific=1";
                //actxt.InnerHtml = ItemName + "审核列表";
            }
            if (cid != 0)
            {
                strwhere += " and (Tid=" + cid;
                //读取所有子级
                if (showhidelist("8"))
                {
                    DataTable dt    = new ClassBll().GetListTree(mid, cid, "");
                    string    allid = "";
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow drt in dt.Rows)
                        {
                            allid += drt["id"].ToString() + ",";
                        }
                        allid     = allid.Substring(0, allid.Length - 1);
                        strwhere += " or Tid in (" + allid + ")";
                    }
                }
                strwhere += ")";
            }
            else
            {
                strwhere += lansql;
            }
            if (sx != 0)
            {
                string sht = "";
                switch (sx)
                {
                case 1:
                    sht = "IsRecommend=1";
                    break;

                case 2:
                    sht = "IsPopular=1";
                    break;

                case 3:
                    sht = "IsNew=1";
                    break;

                case 4:
                    sht = "IsSpecial='1'";
                    break;
                }
                strwhere += " and " + sht + "";
            }
            //按公司查看
            if (companyId != 0)
            {
                strwhere += " and ShopId=" + companyId;
            }
            if (!String.IsNullOrEmpty(keywords))
            {
                strwhere += " and Title like '%" + keywords + "%'";
            }
            ////列出所有栏目
            //string allclass = "ParentId=" + cid + " and ModelId=" + mid + lansql;
            //Repeater2.DataSource = new CommonBll().GetList("", "GL_Class", allclass, "px desc,id desc");
            //Repeater2.DataBind();

            // Response.Write(strwhere);
            //Response.End();

            //绑定栏目下拉
            ClassTreeBind(0, "所有栏目", mid, this.ddlclassname, "ClassType=0" + lansql);
            ClassTreeBind(0, "请选择栏目", mid, this.changclass, "ClassType=0" + lansql);
            if (!string.IsNullOrEmpty(Request.Params["Cid"]))
            {
                ddlclassname.SelectedValue = Request.Params["Cid"].Trim();
            }
            //批量处理的ID
            articleid.Text = Request.QueryString["allid"];
            int PageSize  = 20;
            int PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页

            Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "px desc,EditDate desc", PageSize, PageIndex);
            Repeater1.DataBind();

            int totalrecord = new CommonBll().GetRecordCount(datatable, strwhere);//总记录数
            if (totalrecord == 0)
            {
                txtpage.Text = "<p align=\"left\" class=\"red\">暂无产品</p>";
            }
            else if (totalrecord > PageSize)
            {
                txtpage.Text = GL.Utility.GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
            }


            string bx = "<a href=\"Products.aspx?mid=" + mid + "\" class=\"home\">" + ItemName + "管理</a>";
            bx += "<a href=\"ProductsAdd.aspx?mid=" + mid + "&language=" + Language + "\" class=\"add\">添加" + ItemName + "</a>";
            if (!verific)
            {
                bx += "<a href=\"?mid=" + mid + "&language=" + Language + "&ac=sh\" class=\"sh\">审核" + ItemName + "</a>";
            }
            if (del)
            {
                bx += "<a href=\"?ac=del&mid=" + mid + "&language=" + Language + "\" class=\"del\">" + ItemName + "回收站</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bx;
        }
    }
Ejemplo n.º 21
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);
                    }
                }
            }
        }
    }