Esempio n. 1
0
 /// <summary>
 /// Creates a new feedback into the database
 /// </summary>
 /// <param name="rating"></param>
 /// <param name="comment"></param>
 /// <param name="timeStamp"></param>
 /// <param name="user"></param>
 /// <param name="ad"></param>
 public Feedback(short rating, string comment, DateTime timeStamp, PrimaryUser user, Advertisement ad)
 {
     this.rating    = rating;
     this.comment   = comment;
     this.timeStamp = timeStamp;
     this.user      = user;
     this.ad        = ad;
 }
Esempio n. 2
0
 /// <summary>
 /// Pay security security fee and returns a token to be used for the auction
 /// </summary>
 /// <param name="bidder">Who is going to pay security fee</param>
 /// <returns></returns>
 public Token PaySecurity(PrimaryUser bidder)
 {
     if (!IsSecurityPaid(bidder))
     {
         return(new Token(Token.GetHash(bidder.UserId.ToString() + "_" + id.ToString()), bidder, this));
     }
     return(null);
 }
Esempio n. 3
0
 /// <summary>
 /// Method to verify a token for a bidder against an auction
 /// </summary>
 /// <param name="hashKey"></param>
 /// <param name="auction"></param>
 /// <param name="bidder"></param>
 /// <returns></returns>
 public bool VerifyToken(string hashKey, Auction auction, PrimaryUser bidder)
 {
     if (hashKey == this.hashKey && auction.Id == this.auction.Id && bidder.UserId == this.bidder.UserId)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Esempio n. 4
0
 internal Token(string hashKey, PrimaryUser bidder, Auction auction)
 {
     this.hashKey = hashKey;
     this.bidder = bidder;
     this.auction = auction;
 }
Esempio n. 5
0
        /// <summary>
        /// Static method to create an advertisement
        /// </summary>
        /// <param name="user">who is creating the advertisement</param>
        /// <param name="title"></param>
        /// <param name="description"></param>
        /// <param name="startingPrice">price from which the auction will start</param>
        /// <param name="additionalAttibutes">additional attibutes from the category</param>
        /// <returns></returns>
        public static Advertisement CreateAdvertisement(PrimaryUser user, string title, string description, decimal startingPrice, List <AdditionalAttributes.AttributeValue> additionalAttibutes)
        {
            DateTime postingTime = DateTime.Now;

            return(null);
        }
Esempio n. 6
0
 /// <summary>
 /// Sell item(s) to a buyer
 /// </summary>
 /// <param name="buyer"></param>
 /// <param name="price"></param>
 public void SellItem(PrimaryUser buyer, decimal price)
 {
 }
Esempio n. 7
0
 /// <summary>
 /// A user gives rating anfd feedback after the successful buying process
 /// </summary>
 /// <param name="user"></param>
 /// <param name="rating"></param>
 /// <param name="comment"></param>
 public void GiveFeedback(PrimaryUser user, short rating, string comment = null)
 {
     new Feedback(rating, comment, DateTime.Now, user, this);
 }
Esempio n. 8
0
 /// <summary>
 /// A user adds an advertisement to his interest list
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool AddToInterest(PrimaryUser user)
 {
     return(true);
 }
Esempio n. 9
0
        /// <summary>
        /// Returns a list of feedbacks received by a seller(user) on different auctions
        /// </summary>
        /// <param name="seller"></param>
        /// <returns></returns>
        public static List <Feedback> GetFeedback(PrimaryUser seller)
        {
            List <Feedback> lstFeedback = new List <Feedback>();

            return(lstFeedback);
        }
Esempio n. 10
0
 public Bid(Auction auction, PrimaryUser bidder, decimal price, DateTime timeStamp)
 {
     this.auction = auction;
     this.bidder  = bidder;
     this.price   = price;
 }
Esempio n. 11
0
 /// <summary>
 /// Finat Payment for the auction
 /// </summary>
 /// <param name="buyer"></param>
 /// <returns></returns>
 public bool Pay(PrimaryUser buyer)
 {
     return(true);
 }
Esempio n. 12
0
 /// <summary>
 /// Returns true if security fee for this auction is paid or not
 /// </summary>
 /// <param name="bidder">User who paid the security fee</param>
 /// <returns></returns>
 public bool IsSecurityPaid(PrimaryUser bidder)
 {
     return(Token.GetToken(bidder.UserId + "_" + id).Auction == this);
 }