本文整理汇总了C#中Data.CountAd方法的典型用法代码示例。如果您正苦于以下问题:C# Data.CountAd方法的具体用法?C# Data.CountAd怎么用?C# Data.CountAd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.CountAd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataBind2
public void DataBind2(DataView dvAds)
{
try
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (Session["AD1Count"] == null)
Session["AD1Count"] = 0;
Session["AD1DV"] = dvAds;
DrawAd((int)Session["AD1Count"], dvAds);
if (Session["User"] != null)
{
dat.CountAd(false, dvAds);
}
//if(Session["User"] != null)
// userLit.Text = "<div id=\"userIDDiv\" style=\"display: none;\">" + Session["User"].ToString() + "</div>";
//else
// userLit.Text = "<div id=\"userIDDiv\" style=\"display: none;\">No User</div>";
//XmlDataSource xmlAds = new XmlDataSource();
//xmlAds.DataFile = Server.MapPath(".") + "\\UserFiles\\categoies1.xml";
//xmlAds.DataBind();
//RadRotator1.DataSource = xmlAds;
//RadRotator1.DataBind();
}
catch (Exception ex)
{
BodyLabel.Text = ex.ToString();
}
}
示例2: DrawAd
protected void DrawAd(int nextAdIndex, DataView dvAds)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
DataView dvAd = dat.GetDataDV("SELECT * FROM Ads WHERE Ad_ID = " + dvAds[nextAdIndex]["Ad_ID"].ToString());
DataView dvUser = dat.GetDataDV("SELECT * FROM Users WHERE User_ID=" + dvAd[0]["User_ID"].ToString());
string templateID = dvAd[0]["Template"].ToString();
string w = "0";
string h = "0";
if (templateID == "1")
{
Template1Panel.Visible = true;
Template2Panel.Visible = false;
CustomerImage.AlternateText = dvAds[nextAdIndex]["Header"].ToString();
if (dvAds[nextAdIndex]["FeaturedPicture"].ToString() == "" || dvAds[nextAdIndex]["FeaturedPicture"] == null)
{
CustomerImage.Visible = false;
TitleLabel.Text = dat.BreakUpString(dvAds[nextAdIndex]["Header"].ToString(), 21);
}
else
{
CustomerImage.Visible = true;
GetAdSize(out w, out h, dvUser[0]["UserName"].ToString() + "\\" +
dvAds[nextAdIndex]["FeaturedPicture"].ToString(), templateID);
CustomerImage.ImageUrl = "../UserFiles/" + dvUser[0]["UserName"].ToString() +
"/" + dvAds[nextAdIndex]["FeaturedPicture"].ToString();
CustomerImage.Width = int.Parse(w);
CustomerImage.Height = int.Parse(h);
TitleLabel.Text = dat.BreakUpString(dvAds[nextAdIndex]["Header"].ToString(), 10);
}
TitleLabel.Text = dvAds[nextAdIndex]["Header"].ToString();
if (windowT)
{
TitleLabel.Attributes.Add("onclick", "CloseWindow('" + "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad" + "');");
ReadMoreLink.Attributes.Add("onclick", "CloseWindow('" + "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad" + "');");
A1.HRef = "javascript:CloseWindow('../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad');";
}
else
{
TitleLabel.NavigateUrl = "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad";
ReadMoreLink.NavigateUrl = "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad";
A1.HRef = "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad";
}
BodyLabel.Text = dat.BreakUpString(dvAds[nextAdIndex]["FeaturedSummary"].ToString(), 21);
}
else
{
Template1Panel.Visible = false;
Template2Panel.Visible = true;
Image1.AlternateText = dvAds[nextAdIndex]["Header"].ToString();
if (dvAds[nextAdIndex]["FeaturedPicture"].ToString() == "" || dvAds[nextAdIndex]["FeaturedPicture"] == null)
{
Image1.Visible = false;
}
else
{
GetAdSize(out w, out h, dvUser[0]["UserName"].ToString() + "\\" +
dvAds[nextAdIndex]["FeaturedPicture"].ToString(), templateID);
Image1.ImageUrl = "../UserFiles/" + dvUser[0]["UserName"].ToString() +
"/" + dvAds[nextAdIndex]["FeaturedPicture"].ToString();
Image1.Width = int.Parse(w);
Image1.Height = int.Parse(h);
}
if (windowT)
{
Image1.Attributes.Add("onclick", "CloseWindow('" + "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad" + "');");
}
else
{
Image1.Attributes.Add("onclick", "window.location = '" + "../" + dat.MakeNiceName(dvAds[nextAdIndex]["Header"].ToString()) +
"_" + dvAds[nextAdIndex]["Ad_ID"].ToString() + "_Ad" + "'");
}
}
if (Request.Url.AbsolutePath.ToLower() == "/group.aspx")
{
dat.CountGroupAds(int.Parse(dvAds[nextAdIndex]["Ad_ID"].ToString()));
}
else
{
if (Session["User"] != null)
{
dat.CountAd(true, dvAds);
}
else
{
//.........这里部分代码省略.........
示例3: Timer1_Tick
protected void Timer1_Tick(object sender, EventArgs e)
{
HttpCookie cookie = Request.Cookies["BrowserDate"];
try
{
Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
if (Session["AD1Count"] == null || Session["AD1DV"] == null)
dat.GetAdSet(1, false);
DataView dvAds = (DataView)Session["AD1DV"];
int currentAdIndex = int.Parse(Session["AD1Count"].ToString());
if (currentAdIndex < dvAds.Count - 1)
{
currentAdIndex++;
}
else
{
currentAdIndex = 0;
}
//Draw the next ad
DrawAd(currentAdIndex, dvAds);
Session["AD1Count"] = currentAdIndex;
//Only count the ad when user is logged in.
//If user not logged in, can't charge for the ads.
if (Session["User"] != null)
{
dat.CountAd(false, dvAds);
}
else
{
dat.CountAdAnonymous(false, dvAds);
}
}
catch (Exception ex)
{
BodyLabel.Text = ex.ToString();
if (Session["testmessage"] != null)
{
BodyLabel.Text += Session["testmessage"].ToString();
}
}
}