Example #1
0
 /// <summary>
 /// Verifies the exists.
 /// </summary>
 private void VerifyExists()
 {
     if (!Buyers.Exists(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerDob, _buyerDLic, out _errOut))
     {
         bool value = Buyers.Add(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerPhone, _buyerCountry, _buyerEMail, _buyerLic, _buyerWebSite, _buyerFax, _buyerDob, _buyerDLic, _buyerResident, out _errOut);
     }
 }
Example #2
0
        public void AddTest()
        {
            VerifyDoesntExist();
            bool value = Buyers.Add(_databasePath, _buyerName, _buyerAddress1, _buyerAddress2, _buyerCity, _buyerState, _buyerZipCode, _buyerPhone, _buyerCountry, _buyerEMail, _buyerLic, _buyerWebSite, _buyerFax, _buyerDob, _buyerDLic, _buyerResident, out _errOut);

            General.HasTrueValue(value, _errOut);
        }
Example #3
0
        public void BuyerAdded(Buyer buyer)
        {
            var viewModel = new BuyerViewModel(buyer.Snapshot.ItemId, buyer.Snapshot);

            Buyers.Add(viewModel);
            buyer.AddBuyerListener(this);
        }
Example #4
0
 public void AddBuyers(uint amount, double initCash, uint initStorage, uint maxStorage)
 {
     for (int i = 0; i < amount; i++)
     {
         Buyers.Add(new Buyer(this, initCash, initStorage, maxStorage));
     }
 }
Example #5
0
        private void Join()
        {
            IStockItemConnection itemConnection = _connection.ConnectToItem(NewItemId);
            var viewModel = new BuyerViewModel(NewItemId, NewItemMaximumPrice, NumberToBuy,
                                               _buyerName, itemConnection, _repository);

            Buyers.Add(viewModel);
        }
Example #6
0
        public OrderServiceForm()
        {
            InitializeComponent();

            Buyer buyer_1 = new Buyer("GZ");
            Buyer buyer_2 = new Buyer("JP");

            Buyers.Add(buyer_1);
            Buyers.Add(buyer_2);

            Item ns   = new Item("switch", 2000);
            Item game = new Item("Animal Crossing", 400);

            Items.Add(ns);
            Items.Add(game);

            OrderItem oi_1 = new OrderItem(ns, 1);
            OrderItem oi_2 = new OrderItem(game, 1);
            OrderItem oi_3 = new OrderItem(game, 2);

            Order order_1 = new Order(buyer_1);

            order_1.AddOrderItem(oi_1);
            order_1.AddOrderItem(oi_2);

            Order order_2 = new Order(buyer_2);

            order_2.AddOrderItem(oi_3);
            Thread.Sleep(1);
            //OrderID与时间有关,预计每一单处理超过一毫秒会得到不同的ID

            orderService.AddOrder(order_1);
            orderService.AddOrder(order_2);

            orderBindingSource.DataSource = orderService.GetAllOrders();
        }
Example #7
0
        public void FillTestData(int n)
        {
            //Admins
            for (int i = 1; i <= n; i++)
            {
                Admin newA = new Admin()
                {
                    Name     = $"Admin_{i}",
                    Password = "******",
                };
                Admins.Add(newA);
            }
            // Cars
            Cars.Clear();
            for (int i = 0; i < n; i++)
            {
                Cars.Add(new Car()
                {
                    Features    = "nope",
                    ID          = i + 1,
                    MaksSpeed   = (i * 10) % 180 + 100 + 5 * (i % 2),
                    Price       = (i * 1000) % 20000 + 6000,
                    ProdCountry = coun[i % coun.Length],
                    Model       = mar[i % mar.Length],
                    TechState   = (3 * i + 20) % 100 + 1,
                    YearOfIssue = 2000 + i % 20
                });
            }
            // Buyers
            for (int i = 1; i <= n; i++)
            {
                int   numb = 80042900 + i % 100000;
                Buyer newB = new Buyer()
                {
                    Contacts          = $"+{numb}",
                    FinancialOpp      = ((i * i + 1) * 1000) % 50000 + 7000,
                    MaksSpeedRequired = (i * 10) % 140 + 60,
                    ModelRequired     = mar[(i + 3) % mar.Length],
                    Name               = $"Buyer_{i}",
                    Password           = "******",
                    PerfomanceRequired = i % 100 + 1
                };
                if (i % 5 == 0)
                {
                    newB.ModelRequired = "nope";
                }
                Buyers.Add(newB);
            }
            // Reports
            int div = 2;//сколько в каждом отчете машин

            for (int t = 0; t < n / div; t++)
            {
                var ps = new List <Car>();
                for (int j = 0; j < div; j++)
                {
                    ps.Add(new Car {
                        Features    = Cars[t * div + j].Features,
                        ID          = Cars[t * div + j].ID,
                        MaksSpeed   = Cars[t * div + j].MaksSpeed,
                        Model       = Cars[t * div + j].Model,
                        Price       = Cars[t * div + j].Price,
                        ProdCountry = Cars[t * div + j].ProdCountry,
                        TechState   = Cars[t * div + j].TechState,
                        YearOfIssue = Cars[t * div + j].YearOfIssue
                    });
                }
                Reports.Add(new Report(ps, Buyers[t].Name, DateTime.Now + TimeSpan.FromDays(t)));
            }
        }
Example #8
0
 //Function 2)AddBuyer
 public void addBuyer(User buyer)
 {
     Buyers.Add(buyer);
 }