当前位置: 首页>>代码示例>>C#>>正文


C# Data.CountAdAnonymous方法代码示例

本文整理汇总了C#中Data.CountAdAnonymous方法的典型用法代码示例。如果您正苦于以下问题:C# Data.CountAdAnonymous方法的具体用法?C# Data.CountAdAnonymous怎么用?C# Data.CountAdAnonymous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


在下文中一共展示了Data.CountAdAnonymous方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawAd


//.........这里部分代码省略.........

        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
            {
                dat.CountAdAnonymous(true, dvAds);
            }
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:BigAd.ascx.cs

示例2: 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();
            }
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:48,代码来源:Ad1.ascx.cs


注:本文中的Data.CountAdAnonymous方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。