Пример #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!lot.SoldOut)
            {
                if (lot.MinBid < lot.CurrentBid && timeLeft > 0f)
                {
                    timeLeft     -= 0.5f;
                    textBox6.Text = Convert.ToString(timeLeft);
                }
                else if (timeLeft <= 0f)
                {
                    button1.Enabled = false;
                    panel1.Visible  = true;
                    lot.SoldOut     = true;
                    lot.BuyerId     = user.Id;
                    lotRepository.Update(lot);
                    user.Balance -= bid;
                    userRepository.Update(user);

                    auction.Update_User();
                    auction.Update_LotsFromData();
                    auction.Update_AvailableLots();
                    return;
                }

                LotUpdated(this, new EventArgs());

                if (lot.CurrentBidUserId == user.Id)
                {
                    button1.Enabled = false;
                }
                else
                {
                    button1.Enabled = true;
                }
            }
        }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     //  DateTime a =  System.DateTime.Parse(A)
     if (Name_box.Text.Length <= 0)
     {
         MessageBox.Show("Input name for lot", "Error");
     }
     else
     {
         changed_lot.Name        = Name_box.Text;
         changed_lot.Description = Des_box.Text;
         changed_lot.MinBid      = (int)min_bid.Value;
         changed_lot.StartTime   = (int)hours_time.Value * 60 + (int)minutes_time.Value;
         changed_lot.Date        = date.Value.ToString();
         lotRepository.Update(changed_lot);
         Close();
     }
 }
Пример #3
0
        public void LotRepository_Update_UpdatesLot()
        {
            var mockDbSet   = UnitTestHelper.GetMockDbSet <Lot>(GetTestLots());
            var mockContext = GetMockContext(mockDbSet);
            var lotRepo     = new LotRepository(mockContext.Object);
            var lot         = new Lot
            {
                Id           = 1,
                TurnkeyPrice = 5000,
                CarId        = 1
            };

            lotRepo.Update(lot);

            mockDbSet.Verify(
                m => m.Attach(It.Is <Lot>(
                                  l => l.Id == lot.Id &&
                                  l.TurnkeyPrice == lot.TurnkeyPrice &&
                                  l.CarId == lot.CarId)),
                Times.Once);
        }