Esempio n. 1
0
        static void Main(string[] args)
        {
            InternetStore Market1 = new InternetStore("Market1");
            Merchandise   merch1  = new Merchandise(23, "Coffee", 58.00, 56784904, "Masha", Market1);

            Market1.AddProduct(merch1);
            Merchandise merch2 = new Merchandise(10, "Tea", 29.99, 98564901, "Masha", Market1);

            Market1.AddProduct(merch2);
            Klient klient1 = new Klient("Ivan Petrovich", 120, Market1);

            klient1.AddOrder(Market1);
            merch1.FromOrderToSale(Market1);
            klient1.AddOrder(Market1);
            merch1.FromOrderToSale(Market1);
            Console.ReadKey();
        }
Esempio n. 2
0
        public void AddOrder(InternetStore store)
        {
            Console.WriteLine("Введите номер товарa");
            int productType = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Введите количество единиц");
            int pCount = Convert.ToInt32(Console.ReadLine());

            if (productType <= (store.AllProducts).Count && store.AllProducts[productType - 1].ProductCount >= pCount)
            {
                productName  = store.AllProducts[productType - 1].ProductName;
                productCount = pCount;
                (store.allOrders).Add(this);
            }
            else
            {
                Console.WriteLine("Some error");
            }

            // string KlientName; string productName; int productCount;
        }
Esempio n. 3
0
        //не могу добавить в список продаж
        public void FromOrderToSale(InternetStore store)
        {
            var  localklient       = store.allOrders[0];
            bool belongToBlackList = blackList.Exists(e => e.Equals(localklient.KlientName));

            {
                if (belongToBlackList)
                {
                    Console.WriteLine("You could`t add the order");
                }
                else
                {
                    //поиск цены по списку продуктов используя название
                    var localVar  = (store.AllProducts).Where(i => i.ProductName == localklient.ProductName);
                    var localVar1 = (localVar.Select(f => f.Price)).ToList();
                    //проверка на наличия суммы на счете, если нет, то в черный список
                    double localSum = (store.allOrders[0].ProductCount) * localVar1[0];
                    if (localklient.KlientBalance >= localSum)
                    {
                        //добавить в список продаж текущий заказ
                        order order1 = new order();
                        order1.klientName      = localklient.KlientName;
                        order1.merchandiseName = merchandiseName;
                        order1.productCount    = localklient.ProductCount;
                        order1.productName     = localklient.ProductName;
                        order1.saleSum         = localSum;
                        allSales.Add(order1);
                        localklient.KlientBalance = localklient.KlientBalance - localSum;
                        (store.allOrders).RemoveAt(0);
                    }
                    else
                    {
                        AddClientToBlackList(localklient, store);
                        Console.WriteLine("You are at black-list");
                    }
                }
            }
        }
Esempio n. 4
0
 public Klient(string klientName, double klientBalance, InternetStore store)
 {
     this.klientName    = klientName;
     this.KlientBalance = klientBalance;
     store.PrintProductList();
 }
Esempio n. 5
0
 //добавить определенного клиента в черный список
 private void AddClientToBlackList(Klient klient, InternetStore store)
 {
     (store.BlackList).Add(klient.KlientName);
 }
Esempio n. 6
0
 //ввод информации о товаре
 public Merchandise(int productCount, string productName, double price, long barcode, string merchandiseName, InternetStore store) : base(store.StoreName)
 {
     base.productCount    = productCount;
     base.productName     = productName;
     this.price           = price;
     this.barcode         = barcode;
     this.merchandiseName = merchandiseName;
 }
Esempio n. 7
0
 static void Main(string[] args)
 {
     InternetStore Market1 = new InternetStore("Market1");
     Merchandise   merch1  = new Merchandise("Coffee", 58.00, 56784904, "Masha");
 }