protected void btnEdit_Click(object sender, EventArgs e) { string str = this.tbName.Text.Trim(); if (str == "") { JavaScript.Alert(this.Page, "请输入广告标题!"); } else { string input = this.tbUrl.Text.Trim(); Regex regex = new Regex(@"([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (!regex.Match(input).Success) { JavaScript.Alert(this, "输入的URL地址格式错误,请仔细检查。"); } else { int num = _Convert.StrToInt(this.tbOrder.Text.Trim(), -1); if (num < 0) { JavaScript.Alert(this.Page, "顺序输入非法!"); } else { Tables.T_Advertisements advertisements = new Tables.T_Advertisements(); string request = Utility.GetRequest("highlight_color"); if (request == "") { request = "#000000"; } advertisements.Title.Value = str + "Color" + request; advertisements.Order.Value = num; advertisements.Url.Value = input; advertisements.isShow.Value = this.cbisShow.Checked; advertisements.LotteryID.Value = this.HidLotteryID.Value; advertisements.Name.Value = (this.HidTypeID.Value == "1") ? "广告一" : ((this.HidTypeID.Value == "2") ? "广告二" : ((this.HidTypeID.Value == "3") ? "广告三" : ((this.HidTypeID.Value == "4") ? "广告四" : ((this.HidTypeID.Value == "5") ? "广告五" : ((this.HidTypeID.Value == "6") ? "广告六" : "广告七"))))); if (advertisements.Update("ID = " + Utility.FilteSqlInfusion(this.HidID.Value)) > 0L) { string key = "Advertisements"; Shove._Web.Cache.ClearCache(key); JavaScript.Alert(this, "修改成功", "Advertisements.aspx?LotteryID=" + this.HidLotteryID.Value + "&TypeID=" + this.HidTypeID.Value); } else { JavaScript.Alert(this, "修改失败"); } } } } }
protected void btnAdd_Click(object sender, EventArgs e) { string str = this.tbName.Text.Trim(); if (str == "") { JavaScript.Alert(this.Page, "请输入广告标题!"); } else { string input = this.tbUrl.Text.Trim(); Regex regex = new Regex(@"^([\w-]+\.)+[\w-]+.([^a-z])(/[\w- ./?%&=]*)?|[a-zA-Z0-9\-\.][\w-]+.([^a-z])(/[\w- ./?%&=]*)?", RegexOptions.Compiled | RegexOptions.IgnoreCase); if (!regex.Match(input).Success) { JavaScript.Alert(this, "输入的URL地址格式错误,请仔细检查。"); } else { int num = _Convert.StrToInt(this.tbOrder.Text.Trim(), -1); if (num < 0) { JavaScript.Alert(this.Page, "顺序输入非法!"); } else { Tables.T_Advertisements advertisements = new Tables.T_Advertisements(); string request = Utility.GetRequest("highlight_color"); if (request == "") { request = "#000000"; } advertisements.Order.Value = num; advertisements.Url.Value = input; advertisements.Title.Value = str + "Color" + request; advertisements.LotteryID.Value = this.ddlLotteries.SelectedValue; advertisements.Name.Value = this.ddlType.SelectedItem.Text; if (advertisements.Insert() > 0L) { string key = "Advertisements"; Shove._Web.Cache.ClearCache(key); JavaScript.Alert(this, "添加成功", "Advertisements.aspx?LotteryID=" + this.ddlLotteries.SelectedValue + "&TypeID=" + this.ddlType.SelectedValue); } else { JavaScript.Alert(this, "添加失败"); } } } } }
private void BindData() { this.hlAdd.NavigateUrl = "AdvertisementsAdd.aspx?LotteryID=" + this.ddlLotteries.SelectedValue + "&TypeID=" + this.ddlType.SelectedValue; DataTable table = new Tables.T_Advertisements().Open("", "LotteryID=" + Utility.FilteSqlInfusion(this.ddlLotteries.SelectedValue) + " and [Name]='" + Utility.FilteSqlInfusion(this.ddlType.SelectedItem.Text) + "'", "[Order]"); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", base.GetType().BaseType.FullName + "(59)"); } else { this.g.DataSource = table; this.g.DataBind(); } }
private void BindData() { this.HidID.Value = Utility.GetRequest("ID"); this.HidLotteryID.Value = Utility.GetRequest("LotteryID"); this.HidTypeID.Value = Utility.GetRequest("TypeID"); int num = _Convert.StrToInt(this.HidID.Value, 0); if (num < 0) { PF.GoError(1, "参数错误或数据被删除", this.Page.GetType().BaseType.FullName); } else { DataTable table = new Tables.T_Advertisements().Open("", "ID=" + num.ToString(), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", this.Page.GetType().BaseType.FullName); } else if (table.Rows.Count == 0) { PF.GoError(1, "参数错误或数据被删除", this.Page.GetType().BaseType.FullName); } else { DataRow row = table.Rows[0]; string[] strArray2 = row["Title"].ToString().Split(new string[] { "Color" }, StringSplitOptions.None); this.tbName.Text = strArray2[0]; this.tbUrl.Text = row["Url"].ToString(); this.tbOrder.Text = row["Order"].ToString(); this.cbisShow.Checked = _Convert.StrToBool(row["isShow"].ToString(), true); if (strArray2.Length == 2) { this.HidColor.Value = strArray2[1]; } } } }
private void BindDataForAD() { this.lbAd.Text = " "; string key = "Advertisements"; DataTable cacheAsDataTable = Shove._Web.Cache.GetCacheAsDataTable(key); if (cacheAsDataTable == null) { cacheAsDataTable = new Tables.T_Advertisements().Open("", "isShow=1", ""); if ((cacheAsDataTable == null) || (cacheAsDataTable.Rows.Count < 1)) { return; } Shove._Web.Cache.SetCache(key, cacheAsDataTable, 600); } DataRow[] rowArray = cacheAsDataTable.Select("LotteryID=6 and [Name] = '广告一'", "[Order]"); DataRow[] rowArray2 = cacheAsDataTable.Select("LotteryID=6 and [Name] = '广告二'", "[Order]"); DataRow[] rowArray3 = cacheAsDataTable.Select("LotteryID=6 and [Name] = '广告三'", "[Order]"); if (rowArray.Length >= 1) { StringBuilder builder = new StringBuilder(); builder.AppendLine("<div id='icefable1'>").AppendLine("<table width='200' border='0' cellpadding='0' cellspacing='0'>").AppendLine("<tbody style='height: 20px;'>"); foreach (DataRow row in rowArray) { string[] strArray2 = row["Title"].ToString().Split(new string[] { "Color" }, StringSplitOptions.None); builder.Append("<tr><td class='blue'><a style='color:").Append((strArray2.Length == 2) ? strArray2[1] : "#000000").Append(";' href=\"").Append(row["Url"].ToString()).Append("\" target='_blank'>").Append(strArray2[0]).AppendLine("</a></td></tr>"); } builder.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; \t\t").AppendLine("}").AppendLine("}").AppendLine("else { \t").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 (rowArray.Length == 1) { builder.AppendLine("clearInterval(scrollUpInterval);"); } builder.AppendLine("</script>"); this.lbAd.Text = builder.ToString(); builder = new StringBuilder(); if (rowArray2.Length > 0) { builder.AppendLine("<div id='icefable2'>").AppendLine("<table width='100%' border='0' cellpadding='0' cellspacing='0'>").AppendLine("<tbody style='height: 20px;'>"); foreach (DataRow row2 in rowArray2) { string[] strArray4 = row2["Title"].ToString().Split(new string[] { "Color" }, StringSplitOptions.None); builder.Append("<tr><td class='blue'><a style='color:").Append((strArray4.Length == 2) ? strArray4[1] : "#000000").Append(";' href=\"").Append(row2["Url"].ToString()).Append("\" target='_blank'>").Append(strArray4[0]).AppendLine("</a></td></tr>"); } builder.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; \t\t").AppendLine("}").AppendLine("}").AppendLine("else { \t").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 (rowArray2.Length == 1) { builder.AppendLine("clearInterval(scrollUpInterval2);"); } builder.AppendLine("</script>"); } this.lbAd1.Text = builder.ToString(); builder = new StringBuilder(); if (rowArray3.Length > 0) { builder.AppendLine("<div id='icefable3'>").AppendLine("<table width='100%' border='0' cellpadding='0' cellspacing='0'>").AppendLine("<tbody style='height: 20px;'>"); foreach (DataRow row3 in rowArray3) { string[] strArray6 = row3["Title"].ToString().Split(new string[] { "Color" }, StringSplitOptions.None); builder.Append("<tr><td class='blue'><a style='color:").Append((strArray6.Length == 2) ? strArray6[1] : "#000000").Append(";' href=\"").Append(row3["Url"].ToString()).Append("\" target='_blank'>").Append(strArray6[0]).AppendLine("</a></td></tr>"); } builder.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; \t\t").AppendLine("}").AppendLine("}").AppendLine("else { \t").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 (rowArray3.Length == 1) { builder.AppendLine("clearInterval(scrollUpInterval3);"); } builder.AppendLine("</script>"); } this.lbAd2.Text = builder.ToString(); } }