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


C# Data.CountAd方法代码示例

本文整理汇总了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();
        }
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:32,代码来源:Ad1.ascx.cs

示例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
            {
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:BigAd.ascx.cs

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


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