Пример #1
0
        public static void Main(string[] args)
        {
            List <Item> items   = new List <Item>();
            Auction     auction = new Auction();
            String      command;

            command = Console.ReadLine();
            while (command.ToUpper() != "EXIT")
            {
                // Check for input.
                if (command.Length > 0)
                {
                    // Convert to upper case so any case works.
                    command = command.ToUpper();

                    switch (command)
                    {
                    case "START": auction.Start();
                        break;

                    case "STOP": auction.Stop();
                        break;

                    case "PAUSE": auction.Pause();
                        break;

                    case "LIST": auction.List();
                        break;

                    case "RESET": auction.Reset();
                        break;

                    default: Console.WriteLine("Unknown command.");
                        break;
                    }
                }
                command = Console.ReadLine();
            }
        }
Пример #2
0
 /// <summary>
 /// Constructor that passes the auction object as a parameter.
 /// </summary>
 /// <param name="auction">Auction object to be transitioned to INACTIVE state.</param>
 public AuctionPausedState(Auction auction)
 {
     this.Name    = "PAUSED";
     this.Auction = auction;
     Console.WriteLine("Auction is paused.");
 }
Пример #3
0
        static void Main(string[] args)
        {
            using (var context = new AuctionPortalDbContext())
            {
                List <Account> accs = new List <Account>(context.Accounts);
                List <AccountAuctionRelation> relations = new List <AccountAuctionRelation>(context.AccountAuctionRelations);
                foreach (var VARIABLE in relations)
                {
                    Console.WriteLine(VARIABLE.Id + ";" + VARIABLE.AccountId.ToString() + "; " + VARIABLE.AuctionId);
                }
                foreach (var VARIABLE in accs)
                {
                    Console.WriteLine(VARIABLE.Id + ";" + VARIABLE.IsAdministrator.ToString());
                }

                List <Product> asd = new List <Product>(context.Products);
                foreach (var VARIABLE in asd)
                {
                    Console.WriteLine(VARIABLE.ToString());
                }
                List <Category> cat = new List <Category>(context.Categories);
                foreach (var VARIABLE in cat)
                {
                    Console.WriteLine(VARIABLE.Name);
                }

                Console.ReadKey();

                Category parent = new Category
                {
                    Id       = Guid.Parse("835b8aee-6883-4a4c-9e75-950fc90c3f03"),
                    Name     = "Parent",
                    Parent   = null,
                    ParentId = null
                };

                Category child = new Category
                {
                    Id       = Guid.Parse("d527ffa7-0b6c-48f2-8e42-90c6b18f7b81"),
                    Name     = "NoCategory",
                    Parent   = null,
                    ParentId = null
                };

                Auction auction = new Auction
                {
                    Id          = Guid.Parse("7ad0b015-5651-441c-9879-44b322d03986"),
                    ActualPrice = 100,
                    Category    = child,
                    CategoryId  = child.Id,
                    ClosingTime = new DateTime(2020, 1, 1),
                    Description = "asd0",
                    IsOpened    = true,
                    Name        = "MyAuction"
                };

                Product product = new Product
                {
                    Id            = Guid.Parse("0cf65f4d-a568-481d-b73f-fdc026a75cce"),
                    Auction       = auction,
                    AuctionId     = auction.Id,
                    Name          = "MyProduct",
                    ProductImgUrl = "asdsd"
                };

                Account acctoun = new Account
                {
                    Address           = "asd",
                    BirthDate         = DateTime.Today,
                    Email             = "asd@asd",
                    FirstName         = "admin",
                    LastName          = "admin",
                    Id                = new Guid("0cf65f4d-a568-481d-b73f-fdc026a75cce"),
                    IsAdministrator   = true,
                    MobilePhoneNumber = "123",
                    Password          = "******"
                };

                //context.Categories.Add(parent);
                //context.Categories.Add(child);
                //context.Auctions.Add(auction);
                //context.Products.Add(product);
                //context.Accounts.Add(acctoun);
                //context.SaveChanges();
            }
            Console.ReadKey();
        }
 /// <summary>
 /// Constructor that passes the auction object as a parameter.
 /// </summary>
 /// <param name="auction">Auction object to be transitioned to ACTIVE state.</param>
 public AuctionActiveState(Auction auction)
 {
     Name         = "ACTIVE";
     this.Auction = auction;
     Console.WriteLine("Auction is active.");
 }
 /// <summary>
 /// Constructor that passes the auction object as a parameter.
 /// </summary>
 /// <param name="auction">Auction object to be transitioned to INACTIVE state.</param>
 public AuctionInactiveState(Auction auction)
 {
     this.Name    = "INACTIVE";
     this.Auction = auction;
     Console.WriteLine("Auction is inactive.");
 }