protected void PageBind() { Entity.Site site = Logic.Consult.GetWebSite(id); txtwebname.Value = site.SiteName; txtUrl.Value = site.SiteUrl; sitenote.Value = site.SiteNote; txtRange.Value = site.RangeList.Replace("$", ""); this.CreateCheckItem(txtRange.Value, HtmlWebSite.GetAdRang(txtRange.Value)); adTypeSelect.Value = site.AdDisplay.ToString(); ClientScript.RegisterStartupScript(this.GetType(), "Initing", string.Format("attack(\"{0}\");", site.AdDisplay), true); int adid = site.AdId; curscript.Value = site.CurScript; object obj = HtmlWebSite.GetAdvert(site.AdDisplay, site.AdId); switch (site.AdDisplay) { case 1: this.BindGuidecInfo((Guidec)obj); break; case 2: this.BindQQMsnInfo((QQMsn)obj); break; case 3: this.BindQQMsnInfo((QQMsn)obj); break; case 4: this.BindImagesInfo((Images)obj); break; } }
protected override void BindData() { siteid = Common.Util.GetPageParamsAndToInt("siteid"); this.Scripts = HtmlWebSite.GetScripts(siteid); this.Scripts = Common.Util.RemoveScript(this.Scripts); base.BindData(); }
private void BData() { Entity.Site site = Logic.Consult.GetWebSite(id); txtRange.Value = site.RangeList.Replace("$", ""); string[] txt = txtRange.Value.Split(new char[] { ',' }); ArrayList al = new ArrayList(); txtRange.Value = ""; foreach (string t in txt) { if (!al.Contains(t) && !string.IsNullOrEmpty(t)) { al.Add(t); txtRange.Value += t + ","; } } if (txtRange.Value.Length > 0) { txtRange.Value = txtRange.Value.Substring(0, txtRange.Value.Length - 1); } this.CreateCheckItem(txtRange.Value, HtmlWebSite.GetAdRang(txtRange.Value)); }
protected void WebSiteEdit_Click(object sender, EventArgs e) { HtmlWebSite.WebSiteEdit(id); }
protected void GetWebSite(HtmlTable data) { string[] fieldsname = FieldName.Split(new char[] { ',' }); string[] fieldswidth = FieldWidth.Split(new char[] { ',' }); int pageIndex = (Common.Util.GetPageParamsAndToInt("Page") > 0) ? Common.Util.GetPageParamsAndToInt("Page") : 1; using (DataSet ds = this.GetLoggedUserGroupId() >= 8 ? Logic.Consult.GetTable(this.DefaultTable, pageIndex, HtmlPager.PageSize, out recordcount) : Logic.Consult.GetTable(this.GetLoggedMemberId(), this.DefaultTable, pageIndex, HtmlPager.PageSize, out recordcount)) { if (AdvAli.Common.Util.CheckDataSet(ds)) { HtmlTableRow tr = new HtmlTableRow(); tr.Attributes.Add("class", "title"); HtmlTableCell htc = new HtmlTableCell(); htc.InnerHtml = "<span><input onclick=checkall() type=checkbox id=selall></span>"; htc.Width = "30"; tr.Cells.Add(htc); for (int i = 0; i < fieldsname.Length; i++) { HtmlTableCell td = new HtmlTableCell(); td.Width = fieldswidth[i]; td.InnerHtml = fieldsname[i]; tr.Cells.Add(td); } htc = new HtmlTableCell(); htc.InnerHtml = "获取代码"; tr.Cells.Add(htc); data.Rows.Add(tr); Random ro = new Random(DateTime.Now.Millisecond); int startid = ro.Next(1, 100); HtmlInputHidden hih = new HtmlInputHidden(); hih.ID = "startid"; hih.Value = startid.ToString(); Page.Form.Controls.Add(hih); HtmlInputHidden hid = new HtmlInputHidden(); hid.ID = "idlist"; hid.Value = ""; Page.Form.Controls.Add(hid); int runv = 0; foreach (DataRow reader in ds.Tables[0].Rows) { tr = new HtmlTableRow(); htc = new HtmlTableCell(); htc.InnerHtml = "<input value=\"" + reader["id"].ToString() + "\" type=checkbox onclick=\"SetHid('" + reader["id"].ToString() + "');\" id=sel" + (startid + runv).ToString() + " />"; tr.Cells.Add(htc); HtmlTableCell td = new HtmlTableCell(); td.InnerHtml = reader["id"].ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerHtml = string.Format("<a href=\"http://{0}\" target=\"_blank\">{1}</a>", reader["siteurl"].ToString().ToLower().Replace("http://", ""), reader["sitename"].ToString()); tr.Cells.Add(td); int adType = Common.Util.ConvertToInt(reader["addisplay"].ToString()); td = new HtmlTableCell(); td.InnerHtml = Common.Util.GetAdType(adType); tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerHtml = HtmlWebSite.GetAdRang(reader["ranglist"].ToString().Replace("$", "")); tr.Cells.Add(td); td = new HtmlTableCell(); if (this.GetLoggedUserGroupId() >= 8) { td.InnerHtml = string.Format("<a href=\"../website/activity.aspx?siteid={0}\">{1}</a>", reader["id"].ToString(), (Common.Util.ChangeStrToBool(reader["stats"].ToString()) ? "已开启" : "已关闭")); } else { td.InnerHtml = Common.Util.ChangeStrToBool(reader["stats"].ToString()) ? "已开启" : "已关闭"; } tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerHtml = string.Format("<a href=\"../website/GetScript.aspx?siteid={0}\">获取代码</a>", reader["id"].ToString()); tr.Cells.Add(td); data.Rows.Add(tr); runv++; } } } }
protected void SaveStep3_Click(object sender, EventArgs e) { HtmlWebSite.SaveStep3(id); }
protected void WebSiteAdd_Click(object sender, EventArgs e) { HtmlWebSite.WebSiteAdd(); }
protected void BindData() { int hasSearch = 0; string key = string.Empty; int siteid = Common.Util.GetPageParamsAndToInt("siteid");//受访网站编号 if (siteid == -100) { return; } AdvAli.Entity.City city = KeyManage.GetCityFormsSearchEngines(out hasSearch, out key); //获取搜索引擎来的地域名. string ranglist = Logic.Consult.GetWebSiteCountryId(siteid); //受访网站的地域列表 this.IpSearchLocal(); //分析IP数据 int cityId = Logic.Consult.GetCityId(ipCountry); //客户所在的地域编号 HtmlCount.VisitAdd(siteid); //记数器 if (Common.Util.HasString(ranglist, cityId.ToString(), new char[] { ',' })) //判断客户所在的地域是否在受访网站选择的地域中. { citySelect = AdvAli.Logic.CitySelect.LocalDomainCity; Response.Clear(); Response.Write(""); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } else if (hasSearch == 2) //判断客户是否通过搜索引擎进来,并且搜索引擎是否包含地域的关键字 { cityId = city.Id; //直接将地域转为搜索引擎包含的地域 citySelect = AdvAli.Logic.CitySelect.SearchEngineCity; } else if (hasSearch == 1) //通过搜索引擎,但不包括地域关键字 { //if (AdvAli.Keys.KeyManage.GetKeySite(key, cityId.ToString())) // citySelect = AdvAli.Logic.CitySelect.SearchEngineKeyword; //else // citySelect = AdvAli.Logic.CitySelect.LocalDomainCity; citySelect = AdvAli.Logic.CitySelect.SearchEngineKeyword; } else if (!Logic.Consult.CheckAllWebSiteCity(cityId)) //判断是否有网站选择了该地域,如果没有则转给受访网站 { citySelect = AdvAli.Logic.CitySelect.LocalDomainCity; Response.Clear(); Response.Write(""); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } else //客户不在受访网站选择的地域,转给相关地域进行处理. { citySelect = AdvAli.Logic.CitySelect.IPCity; } int adType = 0; int adId = 0; string urls = ""; object obj; if (citySelect == AdvAli.Logic.CitySelect.LocalDomainCity) //只显示受访网站的对话 { AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid); obj = HtmlWebSite.GetAdvert(site.AdDisplay, site.AdId); adType = site.AdDisplay; adId = site.AdId; } else if (citySelect == AdvAli.Logic.CitySelect.SearchEngineKeyword) //轮换显示搜索引擎关键词及地域所在网站的对话 { siteid = Logic.Consult.GetAdKeyWebSiteId(key, cityId); AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid); if (object.Equals(site, null)) //没有该地域没有任何对话,显示受访网站对话 { site = Logic.Consult.GetWebSite(Common.Util.GetPageParamsAndToInt("siteid")); siteid = site.Id; } adType = site.AdDisplay; adId = site.AdId; obj = HtmlWebSite.GetAdvert(adType, adId); } else if (cityId > 0) //根据客户地域,轮换显示不同网站对话 || 轮换显示搜索引擎包含地域所在的网站的对话 { siteid = Logic.Consult.GetAdWebSiteId(cityId); AdvAli.Entity.Site site = Logic.Consult.GetWebSite(siteid); if (object.Equals(site, null)) //没有该地域没有任何对话,显示受访网站对话 { site = Logic.Consult.GetWebSite(Common.Util.GetPageParamsAndToInt("siteid")); siteid = site.Id; } adType = site.AdDisplay; adId = site.AdId; obj = HtmlWebSite.GetAdvert(adType, adId); } string scripts = ""; //adType==0或adId==0即不正常的访问, if (adType == 0 || adId == 0) { return; } if (adType == 1) { urls = Config.Global.__WebSiteUrl + "website/getguidec.aspx?1=1"; } if (adType == 2 || adType == 3) { QQMsn q = (QQMsn)HtmlWebSite.GetAdvert(adType, adId); string baseUrl = Config.Global.__WebSiteUrl + "website/previewQQ.aspx?"; urls += "&isqq=" + (q.IsQQ ? "1" : "0"); urls += "&qqhead=" + q.Header; urls += "&qqbottom=" + q.Bottom; string[] qqnum = q.Account.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); string[] qqs = q.Notes.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); string[] qqtitle = q.Namer.Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < qqnum.Length; i++) { urls += string.Format("&qqnum{0}={1}", i, qqnum[i]); urls += string.Format("&qqs{0}={1}", i, qqs[i]); urls += string.Format("&qqtitle{0}={1}", i, qqtitle[i]); } urls += "&qqn=" + qqnum.Length.ToString(); urls = baseUrl + urls; } if (adType == 4) { string baseUrl = Config.Global.__WebSiteUrl + "website/previewPicture.aspx?"; Images i = (Images)HtmlWebSite.GetAdvert(adType, adId); urls += "&width=" + i.Width.ToString() + "&height=" + i.Height.ToString(); urls += "&picname=" + GlobalObject.escape(i.ImageName); urls += "&picurl=" + GlobalObject.escape(i.ImageUrl); urls += "&piclnk=" + GlobalObject.escape(i.ImageLink); urls = baseUrl + urls; } if (adType == 5) //本地资源,默认访问 { scripts = Logic.Consult.GetScripts(Common.Util.GetPageParamsAndToInt("siteid")); } else { WebClient webclient = new WebClient(); byte[] bytes = webclient.DownloadData(urls + "&isscript=1&siteid=" + Common.Util.GetPageParamsAndToInt("siteid") + "&getsiteid=" + siteid); webclient.Dispose(); scripts = Encoding.UTF8.GetString(bytes); } Response.Clear(); Response.Write("var islocal=true;" + scripts); HttpContext.Current.ApplicationInstance.CompleteRequest(); }