コード例 #1
0
ファイル: searchkey.aspx.cs プロジェクト: 337547038/asp.net
 protected void Page_Load(object sender, EventArgs e)
 {
     ac = Request.QueryString["ac"];
     id = BasePage.GetRequestId(Request.QueryString["id"]);
     if (!Page.IsPostBack)
     {
         ((Literal)Master.FindControl("breadcrumbs")).Text = "<a href=\"searchkey.aspx\" class=\"home\">搜索关键词</a>";
         string checklogin = new AdminBll().CheckLogin("no");
         if (checklogin != "true")
         {
             BasePage.Alertback(checklogin);
             Response.End();
         }
         if (id != 0)
         {
             SearchModel s = new SearchBll().GetModel(id);
             txtkey.Text = s.keyword;
             txtnum.Text = s.num.ToString();
             txtpx.Text  = s.px.ToString();
         }
         else
         {
             int    PageSize  = 30;
             int    PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]);
             string strwhere  = "";
             int    all       = new CommonBll().GetRecordCount(datatable, strwhere);
             if (all > 0)
             {
                 Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "px desc,num desc", PageSize, PageIndex);
                 Repeater1.DataBind();
                 if (all > PageSize)
                 {
                     fy.InnerHtml = GetPage.GetAspxPager(all, PageSize, PageIndex);
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: AD.aspx.cs プロジェクト: 337547038/asp.net
    protected int tid; //广告位id
    protected void Page_Load(object sender, EventArgs e)
    {
        action = Request.QueryString["ac"];
        id     = BasePage.GetRequestId(Request.QueryString["id"]);
        string checklogin = new AdminBll().CheckLogin("15");

        if (checklogin != "true")
        {
            BasePage.Alertback(checklogin);
            Response.End();
        }
        if (!Page.IsPostBack)
        {
            string bread = "<a href=\"AD.aspx\" class=\"home\">广告列表</a>";
            if (showhide("22"))
            {
                bread += "<a href=\"AD.aspx?ac=add1\" class=\"add\">添加广告位</a>";
            }
            if (showhide("18"))
            {
                bread += "<a class=\"add\" href=\"AD.aspx?ac=add&tid =" + tid + "\">添加新广告</a>";
            }
            ((Literal)Master.FindControl("breadcrumbs")).Text = bread;
            tid = BasePage.GetRequestId(Request.QueryString["tid"]);
            if (String.IsNullOrEmpty(action)) //取得列表
            {
                string strwhere = "Tid=0";    //显示广告位和单条广告Tid都为0
                if (tid != 0)
                {
                    strwhere    = "Tid=" + tid;
                    txttxt.Text = "<span class=\"red\">查看广告位下的广告</span>";
                }
                int pagesize  = 20;
                int pageindex = BasePage.GetRequestId(Request.QueryString["Page"]);
                Repeater1.DataSource = new CommonBll().GetListPage("", datatable, strwhere, "ADShowHide asc,isad desc,px desc,id desc", pagesize, pageindex);
                Repeater1.DataBind();
                int all = new CommonBll().GetRecordCount(datatable, strwhere);
                if (all > pagesize)
                {
                    txtfy.Text = GetPage.GetAspxPager(all, pagesize, pageindex);
                }
                else if (all <= 0)
                {
                    txtfy.Text = "<p class=\"red\" align=\"center\">无记录</p>";
                }
            }
            else if (action == "add")//添加广告
            {
                //已有广告列表
                ddltid.DataSource     = new CommonBll().GetList("", datatable, "IsAD=1", "px desc,id desc");
                ddltid.DataTextField  = "ADtitle";
                ddltid.DataValueField = "id";
                ddltid.DataBind();
                ddltid.Items.Insert(0, new ListItem("无广告位", "0"));
                ddltid.SelectedValue = tid.ToString();
                if (id != 0)//修改广告时
                {
                    ADModel ad = new ADBll().GetModel(id);
                    txtttile.Text            = ad.ADtitle;
                    ddltid.SelectedValue     = ad.Tid.ToString();
                    rashowhide.SelectedValue = ad.ADShowHide.ToString();
                    Rdtype.SelectedValue     = ad.ADtype.ToString();
                    txtfile.Text             = ad.ADurl;
                    txthttp.Text             = ad.ADhttpurl;
                    txtheight1.Text          = ad.ADheight.ToString();
                    txtwidth1.Text           = ad.ADwidth.ToString();
                    txtpx.Text       = ad.Px.ToString();
                    txtcontents.Text = ad.ADcontents;
                    Button2.Text     = "修改广告";
                }
            }
            else if (action == "add1" && id != 0)//修改广告位时
            {
                ADModel ame = new ADBll().GetModel(id);
                txtwtitle.Text          = ame.ADtitle;
                Rshowhide.SelectedValue = ame.ADShowHide.ToString();
                txtwwidth.Text          = ame.ADwidth.ToString();
                txtwheight.Text         = ame.ADheight.ToString();
                txtwcontents.Text       = ame.ADcontents;
                txtadpx.Text            = ame.Px.ToString();
                Button1.Text            = "修改广告位";
            }
            else if (action == "del" && id != 0)
            { //删除
                bool b = false;
                //检查是否为广告位,如果是广告位则检查有没广告
                int i = new CommonBll().GetRecordCount(datatable, "id=" + id + " and IsAD=1");
                if (i > 0)
                {
                    //是广告位,检查有没广告
                    int ii = new CommonBll().GetRecordCount(datatable, "Tid=" + id);
                    if (ii > 0)
                    {
                        BasePage.Alertback("请先删除此广告位下的广告。");
                        Response.End();
                    }
                    else
                    {
                        //检查有没广告位管理权
                        if (showhide("22"))
                        {                                              //广告位管理
                            b = new CommonBll().Delete(datatable, id); //删除广告位
                        }
                        else
                        {
                            BasePage.Alertback("删除失败,您不能删除此广告位!");
                            Response.End();
                        }
                    }
                }
                else
                {
                    //非广告位
                    if (showhide("19"))
                    {                                              //删除广告权限
                        b = new CommonBll().Delete(datatable, id); //删除广告位
                    }
                    else
                    {
                        BasePage.Alertback("删除失败,您不能删除此广告!");
                        Response.End();
                    }
                }
                if (Request.UrlReferrer != null)
                {
                    ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                }
                if (b)
                {
                    BasePage.JscriptPrint(Page, "删除成功!", ViewState["UrlReferrer"].ToString());
                }
            }
            else if (action == "clone" && id != 0)
            {
                //克隆一条广告
                if (showhide("18"))
                {
                    string filename  = "ADtitle,Tid,IsAD,ADtype,ADurl,ADhttpurl,ADcontents,Px,ADheight,ADwidth,ADShowHide";
                    string cstrwhere = "id=" + id;
                    int    ci        = new CommonBll().CloneData(filename, datatable, cstrwhere);
                    if (ci > 0)
                    {
                        if (Request.UrlReferrer != null)
                        {
                            ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                        }
                        BasePage.JscriptPrint(Page, "克隆成功!", ViewState["UrlReferrer"].ToString());
                    }
                }
            }
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ((Literal)Master.FindControl("breadcrumbs")).Text = "<a class=\"home\" href=\"User.aspx\">会员管理</a><a class=\"add\" href=\"?action=Add\">添加会员</a>";
            string checklogin = new AdminBll().CheckLogin("7");
            if (checklogin != "true")
            {
                BasePage.Alertback(checklogin);
                Response.End();
            }
            if (!String.IsNullOrEmpty(Request.QueryString["action"]))
            {
                action = Request.QueryString["action"];
            }
            else
            {
                action = "show";
            }
            id = BasePage.GetRequestId(Request.QueryString["id"]);

            DataSet dsUserGroup = new CommonBll().GetList("", "GL_UserGroup", "", "id asc");
            if (action == "Add")
            {
                //用户组
                ddlGroupID.DataSource     = dsUserGroup;
                ddlGroupID.DataTextField  = "GroupName";
                ddlGroupID.DataValueField = "id";
                ddlGroupID.DataBind();

                if (id != 0)
                {
                    //编辑修改
                    Literal1.Text = "修改用户信息";
                    Literal2.Text = "不修改请留空";
                    UserModel model = new UserBll().GetModel(id);
                    ddlGroupID.SelectedValue = model.GroupID.ToString();
                    txtUserName.Text         = model.UserName;
                    HiddenField1.Value       = model.PassWord;
                    txtLocked.SelectedValue  = model.Locked.ToString();
                    txtEmail.Text            = model.Email;
                    txtQQ.Text = model.QQ;
                    string city = model.City;
                    if (city != "")
                    {
                        string[] v = city.Split(',');
                        ddlp = v[0];
                        ddlc = v[1];
                        ddla = v[2];
                    }
                    txtAddress.Text       = model.Address;
                    txtSex.SelectedValue  = model.Sex.ToString();
                    txtregDate.Text       = BasePage.formatDateTime(model.RegDate.ToString());
                    txtlastLoginTime.Text = BasePage.formatDateTime(model.LastLoginTime.ToString());
                    txtlastLoginIP.Text   = model.LastLoginIP;
                    txtloginTimes.Text    = model.LoginTimes.ToString();
                    txtCompany.Text       = model.Company;
                    txtTel.Text           = model.Tel;
                    txtWenXin.Text        = model.WenXin;
                    txtSource.Text        = model.Source;


                    Button4.Text = "确认修改";
                }
            }
            else
            {
                //列表
                //绑定快速查看下拉
                ddlUserGroup.DataSource     = dsUserGroup;
                ddlUserGroup.DataTextField  = "GroupName";
                ddlUserGroup.DataValueField = "id";
                ddlUserGroup.DataBind();
                ddlUserGroup.Items.Insert(0, new ListItem("所有会员组", ""));

                string keywords = Request.QueryString["keywords"];
                string strwhere = "id is not null";
                int    GroupId  = 0;
                if (!String.IsNullOrEmpty(Request.QueryString["GroupId"]))
                {
                    GroupId   = int.Parse(Request.QueryString["GroupId"]);
                    strwhere += " and GroupId=" + GroupId;
                }
                if (!String.IsNullOrEmpty(Request.QueryString["keywords"]))
                {
                    strwhere += " and UserName like '%" + keywords + "%'";
                }
                ddlUserGroup.SelectedValue = GroupId.ToString();
                DataSet ds        = new DataSet();
                int     PageSize  = 25;
                int     PageIndex = BasePage.GetRequestId(Request.QueryString["Page"]); //当前第几页
                ds = new CommonBll().GetListPage("", datatable, strwhere, "LastLoginTime 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 = GetPage.GetAspxPager(totalrecord, PageSize, PageIndex);
                }
            }
        }
    }
コード例 #4
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;
        }
    }