Ejemplo n.º 1
0
        internal void RefundPayment()
        {
            DateTime localTime = Util.LocalDateTimeNow;

            //Get all unclosed auction
            List <Auction> unclosedAuctions = _auctionRepository.FindBy(x => x.AuctionOver != true &&
                                                                        x.EndDate <= localTime &&
                                                                        x.CurrentBid != null).ToList();

            foreach (Auction auction in unclosedAuctions)
            {
                // If 30 days has passed without receiving the item
                if (auction.EndDate.AddDays(30) > localTime && !auction.SellerSent)
                {
                    //Send refund email
                    string body = @"<p>The seller did not deliver the item.</p>

                                        <p>You will receive full refund and your information will be deleted.</p>

                                        <p>Thank you,</p>
                              
                                        <p>AnonymousBidder Team</p>

                                        <p>AnonymousBidder Pte. Ltd.</p>
                                
                                        <p><i>This is a system auto-generated email. Please do not reply to this email. </i></p>";

                    EmailHelper.SendMail("*****@*****.**", auction.CurrentBid.Bidder.Email, "The seller did not deliver", body, "", "smtp_anonymousbidder");
                    //Delete all related info
                    _auctionRepository.Delete(auction);
                }
            }
            Commit();
        }
        public void GetById()
        {
            try
            {
                var options = CreateNewContextOptions();
                using (var db = new AuctionContext(options))
                {
                    AuctionTestHelper.PopulateDefaultData(db);
                }
                using (var db = new AuctionContext(options))
                {
                    var repository = new AuctionRepository(db);

                    var item = GenerateModel();
                    Assert.DoesNotThrow(() => repository.Save(item));

                    Assert.DoesNotThrow(() => item = repository.GetById(item.Id));
                    Assert.DoesNotThrow(() => repository.Delete(item));
                    Assert.NotNull(item);
                    Assert.Greater(item.Id, 0);
                }
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex);
                throw;
            }
        }
        public void Activate()
        {
            try
            {
                var options = CreateNewContextOptions();
                using (var db = new AuctionContext(options))
                {
                    AuctionTestHelper.PopulateDefaultData(db);
                }


                using (var db = new AuctionContext(options))
                {
                    var repository = new AuctionRepository(db);
                    var item       = GenerateModel();
                    item.IsActive = false;
                    Assert.DoesNotThrow(() => repository.Save(item));
                    Assert.DoesNotThrow(() => repository.Activate(item));
                    Assert.DoesNotThrow(() => repository.Delete(item));
                    Assert.IsTrue(item.IsActive);
                }
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex);
                throw;
            }
        }
Ejemplo n.º 4
0
        internal void DeleteAuctionData(string email)
        {
            ABUser  user    = _abUserRepository.FindBy(x => x.Email == email).FirstOrDefault();
            Auction auction = user.Auction;

            if (auction != null)
            {
                if (auction.CurrentBid.Bidder.Email == email)
                {
                    auction.Auction_BidGUID = null;
                    var bidList = _bidRepository.FindBy(x => x.Bid_AuctionGUID == auction.AuctionGUID).ToList();
                    if (bidList != null && bidList.Count > 0)
                    {
                        foreach (var item in bidList)
                        {
                            _bidRepository.Delete(item);
                        }
                    }
                    _unitOfWork.Commit();
                    var userList = _abUserRepository.FindBy(x => x.ABUser_AuctionGUID == auction.AuctionGUID).ToList();
                    if (userList != null && userList.Count > 0)
                    {
                        foreach (var item in userList)
                        {
                            _abUserRepository.Delete(item);
                        }
                    }
                    _unitOfWork.Commit();
                    _auctionRepository.Delete(auction);
                    _unitOfWork.Commit();
                }
            }
        }
Ejemplo n.º 5
0
        // GET: Auction/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                AuctionRepository repository = new AuctionRepository();
                repository.Delete(id);

                return(RedirectToAction("GetAll"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 6
0
        //Delete auction List
        public bool Delete(DateTime aucDate)
        {
            AuctionRepository repo = new AuctionRepository();

            return(repo.Delete(aucDate));
        }