protected void Page_Load(object sender, EventArgs e)
    {
        string WebBannerID = Context.Items["bannerid"].ToString();



        Banner banner = Banner.GetBannerByWebBannerID(WebBannerID);
        banner.TotalClicks++;
        banner.Save();

        BannerClick bannerClick = new BannerClick();
        bannerClick.BannerID = banner.BannerID;
        bannerClick.IPAddress = Request.ServerVariables["REMOTE_ADDR"];
        // use the member id if available
        Member member = (Member)Session["Member"];
        bannerClick.MemberClickID = (member != null) ? member.MemberID : 0;

        bannerClick.Save();

        Response.Redirect(banner.ClickThroughURL);
    }
Esempio n. 2
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of BannerClicks
        /// </summary>
        public static List<BannerClick> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<BannerClick> arr = new List<BannerClick>();

            BannerClick obj;

            while (dr.Read())
            {
                obj = new BannerClick();
                if (list.IsColumnPresent("BannerClickID")) { obj._bannerClickID = (int)dr["BannerClickID"]; }
                if (list.IsColumnPresent("BannerID")) { obj._bannerID = (int)dr["BannerID"]; }
                if (list.IsColumnPresent("MemberClickID")) { obj._memberClickID = (int)dr["MemberClickID"]; }
                if (list.IsColumnPresent("IPAddress")) { obj._iPAddress = (string)dr["IPAddress"]; }
                if (list.IsColumnPresent("ClickedDT")) { obj._clickedDT = (DateTime)dr["ClickedDT"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }