コード例 #1
0
        public IAuctionControlView SetControl(IAuctionControlView ac, int j)
        {
            ac.TitleField = auctions[j].Title;


            ac.ImageUrl = "image?auctionId=" + auctions[j].AuctionId +
                          "&width=" + ac.ImageWidth + "&height=" + ac.ImageHeight;

            if (auctions[j].BuyItNowPrice > 0)
            {
                ac.BuyItNowField          = currencyRepo.Exchange(auctions[j].BuyItNowPrice, currencyCode);
                ac.BuyItNowVisiblity      = true;
                ac.BuyItNowLabelVisiblity = true;
            }


            if (auctions[j].MinimumPrice != -1)
            {
                ac.BidField          = currencyRepo.Exchange(auctions[j].MinimumPrice, currencyCode);
                ac.BidVisiblity      = true;
                ac.BidLabelVisiblity = true;
            }

            ac.SellerField = auctions[j].SellerName;

            ac.ShipmentField = auctions[j].ShipmentName + " " + currencyRepo.Exchange(auctions[j].ShipmentPrice, currencyCode);

            var leftDateTime = (auctions[j].EndDate.Subtract(DateTime.Now));

            if (leftDateTime.TotalMinutes < 0)
            {
                ac.TimeLeftLabelText = "Zakończono: ";//view.ResFinished;
                ac.TimeLeftField     = auctions[j].EndDate.ToString("dd.MM.yyyy hh:mm");
            }
            else if (leftDateTime.TotalDays > 1)
            {
                ac.TimeLeftField = (int)leftDateTime.TotalDays + " dni"; // + view.ResDays;
            }
            else
            {
                ac.TimeLeftField = string.Format("{0:hh\\:mm\\:ss}", leftDateTime);
            }

            ac.OffersNumField = auctions[j].OffersNum.ToString();
            ac.ViewsField     = auctions[j].Views.ToString();

            ac.AuctionUrl   += auctions[j].AuctionId;
            ac.SellerNavUrl += auctions[j].SellerId;
            return(ac);
        }
コード例 #2
0
        public void LoadControls(ListView listView)
        {
            var auctionControls = new List <AuctionControl>();

            for (int i = 0; i < presenter.GetAuctionsNum(); i++)
            {
                auctionControls.Add(new AuctionControl());
            }
            listView.DataSource = auctionControls;
            listView.DataBind();

            int j = 0;

            foreach (var item in listView.Items)
            {
                IAuctionControlView ac = (IAuctionControlView)item.FindControl("AuctionControl");
                ac.AuctionUrl   = (HttpContext.Current.Handler as Page).ResolveUrl("~/PublicPages/Auction/AuctionPage?id=");
                ac.SellerNavUrl = (HttpContext.Current.Handler as Page).ResolveUrl("~/PublicPages/User/UserProfile?id=");
                presenter.SetControl(ac, j);
                j++;
            }
        }
コード例 #3
0
 public AuctionControlPresenter(IAuctionControlView view, string currencyCode)
 {
     this.view         = view;
     this.currencyCode = currencyCode;
 }