Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = Convert.ToInt64(Request.QueryString["id"]);

            if (id == 0)
            {
                Response.Redirect("/");
            }

            if (!IsPostBack)
            {
                AdvertItem = AdvertsDataHelper.GetAdvert(id);

                if (User != null)
                {
                    WatchedDataHelper.AddWatched(User.UserId, id);
                }
                else
                {
                    if (Request.Cookies["uid"] != null)
                    {
                        string value = Request.Cookies["uid"].Value;

                        WatchedDataHelper.AddWatchedByCookies(value, id);
                    }
                }
            }

            string tempId = Page.RouteData.Values["id"] as string;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = Convert.ToInt64(Request.QueryString["id"]);

            advId = (int)id;


            ItemLikes    = DataHelper.GetItemLikes(0, advId);
            ItemDislikes = DataHelper.GetItemDisLikes(0, advId);



            if (id == 0)
            {
                Response.Redirect("/");
            }


            AdvertItem  = AdvertsDataHelper.GetAdvert(id);
            AnotherUser = DataHelper.GetUser(AdvertItem.CreatedUserId);

            if (!IsPostBack)
            {
                ViewsCount = DataHelper.GetUserViewsCount((int)id, StructsHelper.ViewedType["product"]);

                if (User != null)
                {
                    // if user didnt authorised, it will be null
                    UserViews userViews = new UserViews()
                    {
                        Date     = DateTime.Now,
                        UserId   = User.UserId,
                        Type     = StructsHelper.ViewedType["product"],
                        ObjectId = (int)id
                    };

                    DataHelper.TryAddUserView(userViews);
                }



                if (User != null)
                {
                    WatchedDataHelper.AddWatched(User.UserId, id);
                }
                else
                {
                    if (Request.Cookies["uid"] != null)
                    {
                        string value = Request.Cookies["uid"].Value;

                        WatchedDataHelper.AddWatchedByCookies(value, id);
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Users user = DataHelper.GetUser(User.UserId);
                if (User != null)
                {
                    ListItems = WatchedDataHelper.GetWatchedByUser(User.UserId);
                }
                else
                {
                    if (Request.Cookies["uid"] != null)
                    {
                        string value = Request.Cookies["uid"].Value;

                        ListItems = WatchedDataHelper.GetWatchedByCookies(value);
                    }
                }

                ListCount = ListItems.Count;
            }
        }