protected string getUserName(string objid, string objtype) { string name = ""; if (objtype == "0") { name = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModel(int.Parse(objid)).username; } else if (objtype == "1") { name = new wgiAdUnionSystem.BLL.wgi_adhost().GetModel(int.Parse(objid)).username; } return name; }
protected void Page_Load(object sender, EventArgs e) { //预览链接不操作 if (Request["preview"] == "1") { Response.Write("测试成功!请拷贝广告代码至自己的网站合适的位置。"); return; } //step1:得到用户id,用户网站id,广告id,广告主id,广告类型,付费类型 int shopid, adid, siteid, userid, paytype, adtype; if (int.TryParse(Request["shopid"], out shopid) && int.TryParse(Request["adid"], out adid) && int.TryParse(Request["userid"], out userid) && int.TryParse(Request["siteid"], out siteid) && int.TryParse(Request["paytype"], out paytype) && int.TryParse(Request["adtype"], out adtype)) { //写入数据库 wgiAdUnionSystem.Model.wgi_adv_statis model = new wgiAdUnionSystem.Model.wgi_adv_statis(); model.advid = adid; model.advtype = paytype;//广告类型即为付费类型,而不是文字、图片之类的类型 model.companyid = shopid; model.ip = CommonData.GetIp(this.Page); model.recordtime = DateTime.Now; model.siteid = siteid; model.statistype = 2;//1表示点击数 model.userid = userid; try { new wgiAdUnionSystem.BLL.wgi_adv_statis().Add(model); } catch (Exception) { //throw: } finally { //本次点击重定向到广告主自设的cookie记录页,并传过去从广告ID得到的广告地址 string adurl = new wgiAdUnionSystem.BLL.wgi_adv().GetModel(adid).advlink; string destination = new wgiAdUnionSystem.BLL.wgi_adhost().GetModel(shopid).cookiepage; destination += "?union=wgiadunion&siteid=" + siteid + "&userid=" + userid + "&shopid=" + shopid + "&url=" + adurl; Response.Clear(); Response.Redirect(destination); Response.End(); } } else { Response.Redirect("/member/default.aspx"); } }
protected void searchResault(object sender, EventArgs e) { string query = ""; lblsearch.Text = "搜索内容<"; lblsearch.Text += " 发送给:" + ddlobjtype.SelectedItem.Text; query += " and a.objtype=" + ddlobjtype.Text; if (txtobjname.Text.Trim() != "") { lblsearch.Text += " 用户名:" + txtobjname.Text; int uid = -1; if (ddlobjtype.Text.Trim() == "0") { List<wgiAdUnionSystem.Model.wgi_sitehost> o = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModelList(" username='******' "); if (o.Count() > 0) { uid = o.SingleOrDefault().userid; } } else if (ddlobjtype.Text.Trim() == "1") { List<wgiAdUnionSystem.Model.wgi_adhost> o = new wgiAdUnionSystem.BLL.wgi_adhost().GetModelList(" username='******' "); if (o.Count() > 0) { uid = o.SingleOrDefault().companyid; } } query += " and a.objid=" + uid + " "; } if (txttitle.Text.Trim() != "") { lblsearch.Text += "标题:" + txttitle.Text + " "; query = " and a.title like '%" + txttitle.Text + "%' "; } if (txtstart.Text.Trim() != "" || txtend.Text.Trim() != "") { lblsearch.Text += "发布时间:"; if (txtstart.Text.Trim() == "") { lblsearch.Text += txtend.Text + "之前"; query += " and a.pubdate<'" + txtend.Text + "' "; } else if (txtend.Text.Trim() == "") { lblsearch.Text += txtstart.Text + "之后"; query += " and a.pubdate>'" + txtstart.Text + "' "; } else { lblsearch.Text += Convert.ToDateTime(txtstart.Text).ToString("yyyy-MM-dd") + "-" + Convert.ToDateTime(txtend.Text).ToString("yyyy-MM-dd") + "之间"; query += " and a.pubdate > '" + txtstart.Text + "' and a.pubdate < '" + txtend.Text + "' "; } } if (lblsearch.Text == "搜索内容<") { lblsearch.Text = ""; lbtnclear.Visible = false; } else { lblsearch.Text += ">"; lbtnclear.Visible = true; } hidquery.Value = query; initData(); }
private void initData() { string act = Request.QueryString["act"]; //Helper.HelperDropDownList.BindData(ddlobjtype, CommonData.getUsertype(), "name", "value", 0); if (act == "add") { newNotice(); } else if(act=="edit") { editNotice(); } else if (act=="show") { showNotice(); } else { Response.Write("非法进入"); Response.End(); } string uname=""; if (Request.QueryString["objtype"] == "0") { uname = new wgiAdUnionSystem.BLL.wgi_sitehost().GetModel(int.Parse(Request.QueryString["objid"])).username; } else { uname = new wgiAdUnionSystem.BLL.wgi_adhost().GetModel(int.Parse(Request.QueryString["objid"])).username; } lblusername.Text = uname; }