private void BindData()
    {
        hlAdd.NavigateUrl = "AdvertisementsAdd.aspx?LotteryID=" + ddlLotteries.SelectedValue + "&TypeID=" + ddlType.SelectedValue;

        DataTable dt = new DAL.Tables.T_Advertisements().Open("", "LotteryID=" + Shove._Web.Utility.FilteSqlInfusion(ddlLotteries.SelectedValue) + " and [Name]='" + Shove._Web.Utility.FilteSqlInfusion(ddlType.SelectedItem.Text) + "'", "[Order]");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName + "(59)");

            return;
        }

        g.DataSource = dt;
        g.DataBind();
    }
Exemple #2
0
    private void BindData()
    {
        HidID.Value        = Shove._Web.Utility.GetRequest("ID");
        HidLotteryID.Value = Shove._Web.Utility.GetRequest("LotteryID");
        HidTypeID.Value    = Shove._Web.Utility.GetRequest("TypeID");

        int id = Shove._Convert.StrToInt(HidID.Value, 0);

        if (id < 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误或数据被删除", this.Page.GetType().BaseType.FullName);

            return;
        }

        DataTable dt = new DAL.Tables.T_Advertisements().Open("", "ID=" + id.ToString() + "", "");

        if (dt == null)
        {
            PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count == 0)
        {
            PF.GoError(ErrorNumber.Unknow, "参数错误或数据被删除", this.Page.GetType().BaseType.FullName);

            return;
        }

        DataRow dr = dt.Rows[0];

        string[] Title = dr["Title"].ToString().Split(new string[] { "Color" }, StringSplitOptions.None);//格式:标题Color颜色
        tbName.Text      = Title[0];
        tbUrl.Text       = dr["Url"].ToString();
        tbOrder.Text     = dr["Order"].ToString();
        cbisShow.Checked = Shove._Convert.StrToBool(dr["isShow"].ToString(), true);

        if (Title.Length == 2)
        {
            HidColor.Value = Title[1];
        }
    }
Exemple #3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string Title = tbName.Text.Trim();

        if (Title == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入广告标题!");

            return;
        }

        string Url = tbUrl.Text.Trim();

        Regex regex = new Regex(@"^([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        Match m     = regex.Match(Url);

        if (!m.Success)
        {
            Shove._Web.JavaScript.Alert(this, "输入的URL地址格式错误,请仔细检查。");

            return;
        }

        int order = Shove._Convert.StrToInt(tbOrder.Text.Trim(), -1);

        if (order < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "顺序输入非法!");

            return;
        }

        DAL.Tables.T_Advertisements ad = new DAL.Tables.T_Advertisements();

        string color = Shove._Web.Utility.GetRequest("highlight_color");

        if (color == "")
        {
            color = "#000000";
        }

        ad.Order.Value     = order;
        ad.Url.Value       = Url;
        ad.Title.Value     = Title + "Color" + color;
        ad.LotteryID.Value = ddlLotteries.SelectedValue;
        ad.Name.Value      = ddlType.SelectedItem.Text;

        long l = ad.Insert();

        if (l > 0)
        {
            //清除缓存
            string CacheKey = "Advertisements";
            Shove._Web.Cache.ClearCache(CacheKey);

            Shove._Web.JavaScript.Alert(this, "添加成功", "Advertisements.aspx?LotteryID=" + ddlLotteries.SelectedValue + "&TypeID=" + ddlType.SelectedValue);
        }
        else
        {
            Shove._Web.JavaScript.Alert(this, "添加失败");
        }
    }
    private void BindDataForAD()
    {
        lbAd.Text = "&nbsp;";
        string    CacheKey = "Advertisements";
        DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_Advertisements().Open("", "isShow=1", "");

            if (dt == null || dt.Rows.Count < 1)
            {
                return;
            }

            Shove._Web.Cache.SetCache(CacheKey, dt, 600);
        }

        DataRow[] drAd  = dt.Select("LotteryID=61 and [Name] = '广告一'", "[Order]");
        DataRow[] drAd1 = dt.Select("LotteryID=61 and [Name] = '广告二'", "[Order]");
        DataRow[] drAd2 = dt.Select("LotteryID=61 and [Name] = '广告三'", "[Order]");

        if (drAd.Length < 1)
        {
            return;
        }

        StringBuilder sb = new StringBuilder();

        sb.AppendLine("<div id='icefable1'>")
        .AppendLine("<table width='200' border='0' cellpadding='0' cellspacing='0'>")
        .AppendLine("<tbody style='height: 20px;'>");

        foreach (DataRow dr in drAd)
        {
            string[] title = dr["Title"].ToString().Split(new String[] { "Color" }, StringSplitOptions.None);
            sb.Append("<tr><td class='blue'><a style='color:").Append(title.Length == 2 ? title[1] : "#000000").Append(";' href=\"").Append(dr["Url"].ToString().ToLower()).Append("\" target='_blank'>").Append(title[0]).AppendLine("</a></td></tr>");
        }

        sb.AppendLine("</tbody>")
        .AppendLine("</table>")
        .AppendLine("</div>")
        .AppendLine("<script type='text/jscript' language='javascript'>")
        .AppendLine("marqueesHeight=20;")
        .AppendLine("stopscroll=false;")
        .AppendLine("with(icefable1){")
        .AppendLine("style.height=marqueesHeight;")
        .AppendLine("style.overflowX='visible';")
        .AppendLine("style.overflowY='hidden';")
        .AppendLine("noWrap=true;")
        .AppendLine("onmouseover=new Function('stopscroll=true');")
        .AppendLine("onmouseout=new Function('stopscroll=false');")
        .AppendLine("}")
        .AppendLine("preTop=0; currentTop=marqueesHeight; stoptime=0;")
        .AppendLine("icefable1.innerHTML+=icefable1.innerHTML;")
        .AppendLine("")
        .AppendLine("function init_srolltext(){")
        .AppendLine("icefable1.scrollTop=0;")
        .AppendLine("scrollUpInterval = setInterval('scrollUp()',1);")
        .AppendLine("}")
        .AppendLine("")
        .AppendLine("function scrollUp(){")
        .AppendLine("if(stopscroll==true) return;")
        .AppendLine("currentTop+=1;")
        .AppendLine("if(currentTop==marqueesHeight+1)")
        .AppendLine("{")
        .AppendLine("stoptime+=1;")
        .AppendLine("currentTop-=1;")
        .AppendLine("if(stoptime==300) ")
        .AppendLine("{")
        .AppendLine("currentTop=0;")
        .AppendLine("stoptime=0;  		")
        .AppendLine("}")
        .AppendLine("}")
        .AppendLine("else {  	")
        .AppendLine("preTop=icefable1.scrollTop;")
        .AppendLine("icefable1.scrollTop+=1;")
        .AppendLine("if(preTop==icefable1.scrollTop){")
        .AppendLine("icefable1.scrollTop=marqueesHeight;")
        .AppendLine("icefable1.scrollTop+=1;")
        .AppendLine("}")
        .AppendLine("}")
        .AppendLine("}")
        .AppendLine("init_srolltext();");

        if (drAd.Length == 1)
        {
            sb.AppendLine("clearInterval(scrollUpInterval);");
        }

        sb.AppendLine("</script>");

        lbAd.Text = sb.ToString();

        sb = new StringBuilder();

        if (drAd1.Length > 0)
        {
            sb.AppendLine("<div id='icefable2'>")
            .AppendLine("<table width='100%' border='0' cellpadding='0' cellspacing='0'>")
            .AppendLine("<tbody style='height: 20px;'>");

            foreach (DataRow dr in drAd1)
            {
                string[] title = dr["Title"].ToString().Split(new String[] { "Color" }, StringSplitOptions.None);
                sb.Append("<tr><td class='blue'><a style='color:").Append(title.Length == 2 ? title[1] : "#000000").Append(";' href=\"").Append(dr["Url"].ToString().ToLower()).Append("\" target='_blank'>").Append(title[0]).AppendLine("</a></td></tr>");
            }

            sb.AppendLine("</tbody>")
            .AppendLine("</table>")
            .AppendLine("</div>")
            .AppendLine("<script type='text/jscript' language='javascript'>")
            .AppendLine("marqueesHeight2=20;")
            .AppendLine("stopscroll2=false;")
            .AppendLine("with(icefable2){")
            .AppendLine("style.height=marqueesHeight2;")
            .AppendLine("style.overflowX='visible';")
            .AppendLine("style.overflowY='hidden';")
            .AppendLine("noWrap=true;")
            .AppendLine("onmouseover=new Function('stopscroll=true');")
            .AppendLine("onmouseout=new Function('stopscroll=false');")
            .AppendLine("}")
            .AppendLine("preTop2=0; currentTop2=marqueesHeight2; stoptime2=0;")
            .AppendLine("icefable2.innerHTML+=icefable2.innerHTML;")
            .AppendLine("")
            .AppendLine("function init_srolltext2(){")
            .AppendLine("icefable2.scrollTop=0;")
            .AppendLine("scrollUpInterval2 = setInterval('scrollUp1()',1);")
            .AppendLine("}")
            .AppendLine("")
            .AppendLine("function scrollUp1(){")
            .AppendLine("if(stopscroll2==true) return;")
            .AppendLine("currentTop2+=1;")
            .AppendLine("if(currentTop2==marqueesHeight2+1)")
            .AppendLine("{")
            .AppendLine("stoptime2+=1;")
            .AppendLine("currentTop2-=1;")
            .AppendLine("if(stoptime2==300) ")
            .AppendLine("{")
            .AppendLine("currentTop2=0;")
            .AppendLine("stoptime2=0;  		")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("else {  	")
            .AppendLine("preTop2=icefable2.scrollTop;")
            .AppendLine("icefable2.scrollTop+=1;")
            .AppendLine("if(preTop==icefable2.scrollTop){")
            .AppendLine("icefable2.scrollTop=marqueesHeight2;")
            .AppendLine("icefable2.scrollTop+=1;")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("init_srolltext2();");

            if (drAd1.Length == 1)
            {
                sb.AppendLine("clearInterval(scrollUpInterval2);");
            }

            sb.AppendLine("</script>");
        }

        lbAd1.Text = sb.ToString();

        sb = new StringBuilder();

        if (drAd2.Length > 0)
        {
            sb.AppendLine("<div id='icefable3'>")
            .AppendLine("<table width='100%' border='0' cellpadding='0' cellspacing='0'>")
            .AppendLine("<tbody style='height: 20px;'>");

            foreach (DataRow dr in drAd2)
            {
                string[] title = dr["Title"].ToString().Split(new String[] { "Color" }, StringSplitOptions.None);
                sb.Append("<tr><td class='blue'><a style='color:").Append(title.Length == 2 ? title[1] : "#000000").Append(";' href=\"").Append(dr["Url"].ToString().ToLower()).Append("\" target='_blank'>").Append(title[0]).AppendLine("</a></td></tr>");
            }

            sb.AppendLine("</tbody>")
            .AppendLine("</table>")
            .AppendLine("</div>")
            .AppendLine("")
            .AppendLine("<script type='text/jscript' language='javascript'>")
            .AppendLine("marqueesHeight3=20;")
            .AppendLine("stopscroll3=false;")
            .AppendLine("with(icefable3){")
            .AppendLine("style.height=marqueesHeight3;")
            .AppendLine("style.overflowX='visible';")
            .AppendLine("style.overflowY='hidden';")
            .AppendLine("noWrap=true;")
            .AppendLine("onmouseover=new Function('stopscroll=true');")
            .AppendLine("onmouseout=new Function('stopscroll=false');")
            .AppendLine("}")
            .AppendLine("preTop3=0; currentTop3=marqueesHeight; stoptime3=0;")
            .AppendLine("icefable3.innerHTML+=icefable3.innerHTML;")
            .AppendLine("")
            .AppendLine("function init_srolltext3(){")
            .AppendLine("icefable3.scrollTop=0;")
            .AppendLine("scrollUpInterval3 = setInterval('scrollUp3()',1);")
            .AppendLine("}")
            .AppendLine("")
            .AppendLine("function scrollUp3(){")
            .AppendLine("if(stopscroll3==true) return;")
            .AppendLine("currentTop3+=1;")
            .AppendLine("if(currentTop3==marqueesHeight3+1)")
            .AppendLine("{")
            .AppendLine("stoptime3+=1;")
            .AppendLine("currentTop3-=1;")
            .AppendLine("if(stoptime3==300) ")
            .AppendLine("{")
            .AppendLine("currentTop3=0;")
            .AppendLine("stoptime3=0;  		")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("else {  	")
            .AppendLine("preTop3=icefable3.scrollTop;")
            .AppendLine("icefable3.scrollTop+=1;")
            .AppendLine("if(preTop3==icefable3.scrollTop){")
            .AppendLine("icefable3.scrollTop=marqueesHeight;")
            .AppendLine("icefable3.scrollTop+=1;")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("}")
            .AppendLine("init_srolltext3();");

            if (drAd2.Length == 1)
            {
                sb.AppendLine("clearInterval(scrollUpInterval3);");
            }

            sb.AppendLine("</script>");
        }

        lbAd2.Text = sb.ToString();
    }
Exemple #5
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        string Title = tbName.Text.Trim();

        if (Title == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入广告标题!");

            return;
        }

        string Url = tbUrl.Text.Trim();

        Regex regex = new Regex(@"([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        Match m     = regex.Match(Url);

        if (!m.Success)
        {
            Shove._Web.JavaScript.Alert(this, "输入的URL地址格式错误,请仔细检查。");

            return;
        }

        int order = Shove._Convert.StrToInt(tbOrder.Text.Trim(), -1);

        if (order < 0)
        {
            Shove._Web.JavaScript.Alert(this.Page, "顺序输入非法!");

            return;
        }

        DAL.Tables.T_Advertisements ad = new DAL.Tables.T_Advertisements();

        string color = Shove._Web.Utility.GetRequest("highlight_color");

        if (color == "")
        {
            color = "#000000";
        }

        ad.Title.Value     = Title + "Color" + color;
        ad.Order.Value     = order;
        ad.Url.Value       = Url;
        ad.isShow.Value    = cbisShow.Checked;
        ad.LotteryID.Value = HidLotteryID.Value;
        ad.Name.Value      = (HidTypeID.Value == "1" ? "广告一" :
                              HidTypeID.Value == "2" ? "广告二" :
                              HidTypeID.Value == "3" ? "广告三" :
                              HidTypeID.Value == "4" ? "广告四" :
                              HidTypeID.Value == "5" ? "广告五" :
                              HidTypeID.Value == "6" ? "广告六" :
                              "广告七");

        long l = ad.Update("ID = " + Shove._Web.Utility.FilteSqlInfusion(HidID.Value));

        if (l > 0)
        {
            //清除缓存
            string CacheKey = "Advertisements";
            Shove._Web.Cache.ClearCache(CacheKey);

            Shove._Web.JavaScript.Alert(this, "修改成功", "Advertisements.aspx?LotteryID=" + HidLotteryID.Value + "&TypeID=" + HidTypeID.Value);
        }
        else
        {
            Shove._Web.JavaScript.Alert(this, "修改失败");
        }
    }