コード例 #1
0
    private void EditPage()
    {
        int id = int.Parse(Utils.GetRequest("id", "get", 2, @"^[0-9]\d*$", "ID错误"));

        if (!new BCW.BLL.Advert().Exists(id))
        {
            Utils.Error("不存在的记录", "");
        }
        BCW.Model.Advert model = new BCW.BLL.Advert().GetAdvert(id);

        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("修改广告");
        builder.Append(Out.Tab("</div>", ""));

        string strText = "广告标题:/,广告内容:连接或UBB或WML:/,开始投放时间:/,过期时间:/,点击数:/,会员点击送币:/,送币性质:/,状态:/,,,";
        string strName = "Title,AdUrl,StartTime,OverTime,Click,iGold,adType,Status,id,act,backurl";
        string strType = "text,textarea,date,date,num,num,select,select,hidden,hidden,hidden";
        string strValu = "" + model.Title + "'" + model.AdUrl + "'" + DT.FormatDate(model.StartTime, 0) + "'" + DT.FormatDate(model.OverTime, 0) + "'" + model.Click + "'" + model.iGold + "'" + model.adType + "'" + model.Status + "'" + id + "'editsave'" + Utils.getPage(0) + "";
        string strEmpt = "false,false,false,false,false,false,0|按天送|1|按周送|2|按次(不推荐),0|正常|1|暂停,false,false,false";
        string strIdea = "/";
        string strOthe = "修改广告|reset,advert.aspx,post,1,red|blue";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        builder.Append("温馨提示:<br />广告内容为连接时,统计点击/点广告送币才生效<br />");
        builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?act=del&amp;id=" + id + "") + "\">删除广告</a><br />");
        builder.Append("<a href=\"" + Utils.getPage("advert.aspx") + "\">返回上一级</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
コード例 #2
0
    private void ReloadPage()
    {
        int ptype = int.Parse(Utils.GetRequest("ptype", "all", 1, @"^[1-5]$", "1"));

        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("广告管理");
        builder.Append(Out.Tab("</div>", "<br />"));
        builder.Append(Out.Tab("<div class=\"text\">", ""));
        if (ptype == 1)
        {
            builder.Append("全部广告|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?ptype=1") + "\">全部</a>|");
        }

        if (ptype == 2)
        {
            builder.Append("正在投放|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?ptype=2") + "\">正在</a>|");
        }

        if (ptype == 3)
        {
            builder.Append("即将投放|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?ptype=3") + "\">即将</a>|");
        }

        if (ptype == 4)
        {
            builder.Append("过期广告|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?ptype=4") + "\">过期</a>|");
        }

        if (ptype == 5)
        {
            builder.Append("已暂停");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?ptype=5") + "\">暂停</a>");
        }

        builder.Append(Out.Tab("</div>", "<br />"));

        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "";

        string[] pageValUrl = { "ptype", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }
        //查询条件
        if (ptype == 2)
        {
            strWhere = "StartTime<='" + DateTime.Now + "' and OverTime>='" + DateTime.Now + "'";
        }
        else if (ptype == 3)
        {
            strWhere = "StartTime>'" + DateTime.Now + "'";
        }
        else if (ptype == 4)
        {
            strWhere = "OverTime<'" + DateTime.Now + "'";
        }
        else if (ptype == 5)
        {
            strWhere = "Status=1";
        }

        // 开始读取列表
        IList <BCW.Model.Advert> listAdvert = new BCW.BLL.Advert().GetAdverts(pageIndex, pageSize, strWhere, out recordCount);

        if (listAdvert.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.Advert n in listAdvert)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }

                builder.AppendFormat("{0}.<a href=\"" + Utils.getUrl("advert.aspx?act=edit&amp;id={1}&amp;backurl=" + Utils.PostPage(1) + "") + "\">{2}</a>点击{3}", (pageIndex - 1) * pageSize + k, n.ID, n.Title, n.Click);
                k++;
                builder.Append(Out.Tab("</div>", ""));
            }

            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?act=add") + "\">添加广告</a><br />");
        builder.Append("<a href=\"" + Utils.getUrl("advert.aspx?act=gold") + "\">点广告送币</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
コード例 #3
0
ファイル: adview.aspx.cs プロジェクト: radtek/GitKB288
    protected void Page_Load(object sender, EventArgs e)
    {
        int meid = new BCW.User.Users().GetUsId();
        int id   = int.Parse(Utils.GetRequest("id", "get", 1, @"^[1-9]\d*$", "0"));

        if (id > 0)
        {
            if (!new BCW.BLL.Advert().Exists2(id))
            {
                Utils.Error("不存在的记录", "");
            }
            BCW.Model.Advert model = new BCW.BLL.Advert().GetAdvert(id);
            //按天/按周计算
            if (meid > 0)
            {
                if (model.iGold > 0)
                {
                    if (model.adType <= 1)
                    {
                        int Day = 1;
                        if (model.adType == 1)
                        {
                            Day = 7;
                        }

                        //根据时限清空点击ID
                        string ClickID = model.ClickID;
                        if (string.IsNullOrEmpty(model.ClickTime.ToString()) || DT.TwoDateDiff(DateTime.Now, model.ClickTime) >= Day)
                        {
                            new BCW.BLL.Advert().UpdateClickID(id);
                            ClickID = string.Empty;
                        }

                        if (string.IsNullOrEmpty(ClickID) || ClickID.IndexOf("#" + meid + "#") == -1)
                        {
                            new BCW.BLL.Advert().UpdateClickID(id, ClickID + "#" + meid + "#");
                            //得币
                            new BCW.BLL.User().UpdateiGold(meid, Convert.ToInt64(model.iGold), "点广告得币");
                            //内线
                            if (ub.GetSub("BbsIsAdMsg", xmlPath) == "1")
                            {
                                new BCW.BLL.Guest().Add(meid, new BCW.BLL.User().GetUsName(meid), "支持站长,点击广告!恭喜您获得" + model.iGold + "" + ub.Get("SiteBz") + ",天天点击天天有惊喜~");
                            }
                        }
                    }
                    else//按次计算
                    {
                        new BCW.BLL.Advert().UpdateClickID(id, "");
                        //得币
                        new BCW.BLL.User().UpdateiGold(meid, Convert.ToInt64(model.iGold), "点广告得币");
                        //内线
                        if (ub.GetSub("BbsIsAdMsg", xmlPath) == "1")
                        {
                            new BCW.BLL.Guest().Add(meid, new BCW.BLL.User().GetUsName(meid), "支持站长,点击广告!恭喜您获得" + model.iGold + "" + ub.Get("SiteBz") + ",天天点击天天有惊喜~");
                        }
                    }
                }
            }
            //跳转广告
            new BCW.BLL.Advert().UpdateClick(id);
            Response.Redirect(model.AdUrl.Replace("&amp;", "&"));
        }
        else
        {
            Master.Title = "打工送币";
            builder.Append(Out.Tab("<div class=\"text\">", ""));
            builder.Append("=打工送币=");
            builder.Append(Out.Tab("</div>", "<br />"));
            int      pageIndex;
            int      recordCount;
            int      pageSize   = Convert.ToInt32(ub.Get("SiteListNo"));
            string   strWhere   = "";
            string[] pageValUrl = { "ptype", "backurl" };
            pageIndex = Utils.ParseInt(Request.QueryString["page"]);
            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            //查询条件
            strWhere = "Status=0 and UrlType=0 and StartTime<='" + DateTime.Now + "' and OverTime>='" + DateTime.Now + "'";

            // 开始读取列表
            IList <BCW.Model.Advert> listAdvert = new BCW.BLL.Advert().GetAdverts(pageIndex, pageSize, strWhere, out recordCount);
            if (listAdvert.Count > 0)
            {
                int k = 1;
                foreach (BCW.Model.Advert n in listAdvert)
                {
                    if (k % 2 == 0)
                    {
                        builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                    }
                    else
                    {
                        if (k == 1)
                        {
                            builder.Append(Out.Tab("<div>", ""));
                        }
                        else
                        {
                            builder.Append(Out.Tab("<div>", "<br />"));
                        }
                    }
                    string adType = string.Empty;
                    if (n.adType == 0)
                    {
                        adType = "/天";
                    }
                    else if (n.adType == 1)
                    {
                        adType = "/周";
                    }
                    else
                    {
                        adType = "";
                    }

                    builder.AppendFormat("{0}.<a href=\"" + Utils.getUrl("adview.aspx?id={1}") + "\">{2}</a>(" + n.iGold + "" + ub.Get("SiteBz") + "" + adType + "/次)", (pageIndex - 1) * pageSize + k, n.ID, n.Title);
                    k++;
                    builder.Append(Out.Tab("</div>", ""));
                }

                // 分页
                builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1));
            }
            else
            {
                builder.Append(Out.Div("div", "没有相关记录.."));
            }
            builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
            builder.Append("支持站长,请点击广告,天天送你币!");
            builder.Append(Out.Tab("</div>", ""));
            builder.Append(Out.Tab("<div class=\"title\">", "<br />"));
            builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">首页</a>-");
            builder.Append("<a href=\"" + Utils.getPage("default.aspx") + "\">返回上级</a>");
            builder.Append(Out.Tab("</div>", ""));
        }
    }