Example #1
0
        public async Task <IActionResult> AddEmployee(string id, [FromHeader] double salary)
        {
            var user = await _userRepository.GetUserById(id);

            var employeeExists = await _employeeRepository.GetEmployeeFromUserId(id);

            if (employeeExists != null)
            {
                return(BadRequest());
            }

            var employee = new Employee()
            {
                Id     = Guid.NewGuid(),
                Salary = salary,
                User   = user
            };

            var cashDesk = new CashDesk()
            {
                Id       = Guid.NewGuid(),
                Cash     = 0,
                Employee = employee
            };

            _employeeRepository.Create(employee);
            _cashDeskRepository.Create(cashDesk);

            var employees = await _employeeRepository.GetEmployees();

            return(Ok(new { employees }));
        }
Example #2
0
        private void ButtonPay_Click(object sender, EventArgs e)
        {
            if (customer != null)
            {
                cashDesk = new CashDesk(1, SetRandomSeller(), dbContext)
                {
                    IsModel = false
                };

                cashDesk.Enqueue(cusrtomerCart);
                var price = cashDesk.Dequeue();
                CartList.Items.Clear();
                cusrtomerCart = new Cart(customer);
                SetFullPrice();
                ButtonPay.Enabled = false;

                MessageBox.Show("Покупка выполнена успешно." +
                                $" Сумма: {price} руб.", "Покупка выполнена",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Авторизуйтесь, пожалуйста!", "Ошибка авторизации",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            //bronze card
            ICart      bronzeShopCart   = new StoreCart();
            IItem      remote           = new Item("LG", 150);
            CardHolder cardHolderBronze = new CardHolder("Anthony", "Hopkins");

            bronzeShopCart.AddItem(remote);
            IDiscountCard bronzeCard = new BronzeCard(0, cardHolderBronze);
            string        billBronze = CashDesk.Pay(bronzeShopCart, bronzeCard);

            Console.WriteLine(billBronze + Environment.NewLine);
            //silver card
            ICart silverShopCart = new StoreCart();
            IItem playStation    = new Item("PlayStation 5", 850);

            silverShopCart.AddItem(playStation);
            CardHolder    cardHolderSilver = new CardHolder("Jake", "Gyllenhaal");
            IDiscountCard silverCard       = new SilverCard(600, cardHolderSilver);
            string        billSilver       = CashDesk.Pay(silverShopCart, silverCard);

            Console.WriteLine(billSilver + Environment.NewLine);
            //gold car
            ICart goldShopCart = new StoreCart();

            goldShopCart.AddItem(new Item("Toy", 300));
            goldShopCart.AddItem(new Item("Cooker", 700));
            goldShopCart.AddItem(new Item("Pack-man", 300));
            CardHolder    cardHolderGold = new CardHolder("Christian", "Bale");
            IDiscountCard goldenCard     = new GoldCard(1300, cardHolderGold);
            string        billGold       = CashDesk.Pay(goldShopCart, goldenCard);

            Console.WriteLine(billGold + Environment.NewLine);
            Console.ReadLine();
        }
Example #4
0
 public static void Menu(string s, CashDesk desk)
 {
     Console.WriteLine("Welcome To The Cash Desk!");
     Console.WriteLine("Input !menu to use the cash desk features. You can type exit at any point to !exit the cash desk.");
     s = Console.ReadLine();
     if (s == "!menu")
     {
         Console.WriteLine("The cash desk feature are:\n 1) Input money into the cash desk\n 2) Show the total amount of money you currently have\n 3)Show the your money in the cash desk in more detail");
         Console.WriteLine("Please input 1) to put money into the desk 2) for showing the total amount or 3) for showing in details");
         s = Console.ReadLine();
         while ((s != "1)" && s != "2)" && s != "3)" && Exit(s) == false))
         {
             Console.WriteLine("Invalid input. Retry or write !exit to exit");
             s = Console.ReadLine();
         }
         if (s == "1)")
         {
             Console.WriteLine("Currently you can input a bill or a whole batch of bills into this cash desk");
             Console.WriteLine("To input a single bill please write !bill");
             Console.WriteLine("The input a whole batch please write !batch");
             s = Console.ReadLine();
             while (Exit(s) == false && s != "!bill" && s != "!batch")
             {
                 Console.WriteLine("Invalid input.Retry or write !exit to exit");
                 s = Console.ReadLine();
             }
             if (s == "!bill")
             {
                 Console.WriteLine("Input the bill you want. The desk will reject the bills that are not 2,5,10,20,50,100$");
                 int  b    = Int32.Parse(Console.ReadLine());
                 Bill bill = new Bill(b);
                 desk.TakeMoney(bill);
             }
             if (s == "!batch")
             {
                 Console.WriteLine("Input the bills into the batch.The desk will reject the bills that are not 2,5,10,20,50,100$.Input 0 to stop putting bills in");
                 List <int> batch = new List <int>();
                 int        a     = Int32.Parse(Console.ReadLine());
                 while (a != 0)
                 {
                     batch.Add(a);
                     a = Int32.Parse(Console.ReadLine());
                 }
                 BatchBill bach = new BatchBill(batch.ToArray());
                 desk.TakeMoney(bach);
             }
             Menu(s, desk);
         }
         else if (s == "2)")
         {
             desk.Total();
             Menu(s, desk);
         }
         else if (s == "3)")
         {
             desk.Inspect();
             Menu(s, desk);
         }
     }
 }
Example #5
0
        static void Main(string[] args)
        {
            string   s    = "";
            CashDesk desk = new CashDesk();

            Menu(s, desk);
            Exit(s);
        }
Example #6
0
        public Main()
        {
            InitializeComponent();
            db = new CrmContext();

            cart     = new Cart(customer);
            cashDesk = new CashDesk(1, db.Sellers.FirstOrDefault(), db);
        }
Example #7
0
        public void EnqueueTest()
        {
            // Arrange
            var customer1 = new Customer()
            {
                Id   = 1,
                Name = "testuser1"
            };

            var customer2 = new Customer()
            {
                Id   = 2,
                Name = "testuser2"
            };

            var seller = new Seller()
            {
                Id   = 1,
                Name = "sellerTest",
            };

            var product1 = new Product()
            {
                Id    = 1,
                Name  = "pr1",
                Price = 100,
                Count = 10
            };

            var product2 = new Product()
            {
                Id    = 2,
                Name  = "prod2",
                Price = 200,
                Count = 20
            };
            var cart1 = new Cart(customer1);

            cart1.Add(product1);
            cart1.Add(product1);
            cart1.Add(product2);

            var cart2 = new Cart(customer2);

            cart2.Add(product2);
            cart2.Add(product1);
            cart2.Add(product2);
            var cashdesk = new CashDesk(1, seller, null, 2);

            // Act
            cashdesk.Enqueue(cart1);
            cashdesk.Enqueue(cart2);
            cashdesk.Enqueue(cart2);

            // Assert
            Assert.AreEqual(2, cashdesk.Queue.Count);
            Assert.AreEqual(1, cashdesk.ExitCustomer);
        }
Example #8
0
 public Main()
 {
     InitializeComponent();
     context          = new CrmContext();
     customer         = new Customer();// TODO: Добавил отсебятина
     cart             = new Cart(customer);
     cashDesk         = new CashDesk(1, context.Sellers.FirstOrDefault(), context);
     cashDesk.IsModel = false;
 }
Example #9
0
 public Main()
 {
     InitializeComponent();
     _db       = new CrmContext();
     _cart     = new Cart(_customer); // TODO: допилить.
     _cashDesk = new CashDesk(1, _db.Sellers.FirstOrDefault(), _db)
     {
         IsModel = false
     };
 }
Example #10
0
 public MainForm()
 {
     InitializeComponent();
     database = new CrmContext();
     cart     = new Cart(customer);
     desk     = new CashDesk(database.Sellers.FirstOrDefault(), 1, database)
     {
         isModel = false
     };
 }
Example #11
0
 public Form1()
 {
     InitializeComponent();
     db       = new CRMcontext();
     cart     = new Cart(customer);
     cashDesk = new CashDesk(1, db.Sellers.FirstOrDefault(), db)
     {
         Ismodel = false
     };
 }
        public void CashDeskTest()
        {
            //arrange
            var customer1 = new Customer()
            {
                Name       = "TestUser1",
                CustomerID = 1
            };
            var customer2 = new Customer()
            {
                Name       = "TestUser2",
                CustomerID = 2
            };
            var seller = new Seller()
            {
                Name     = "TestSeller",
                SellerID = 1
            };
            var product1 = new Product()
            {
                Name = "TestPR1", Price = 5, Count = 5, ProductID = 1
            };
            var product2 = new Product()
            {
                Name = "TestPR2", Price = 10, Count = 10, ProductID = 2
            };
            var cart1 = new Cart(customer1);
            var cart2 = new Cart(customer2);

            cart1.Add(product1);
            cart1.Add(product1);
            cart1.Add(product2);

            cart2.Add(product2);
            cart2.Add(product2);
            var cashDesk = new CashDesk(1, seller);

            cashDesk.MaxQueueLenght = 10;
            cashDesk.Enqueue(cart1);
            cashDesk.Enqueue(cart2);

            var cart1Res = 20;
            var cart2Res = 20;
            //act
            var cart1ActualResult = cashDesk.Dequeue();
            var cart2ActualResult = cashDesk.Dequeue();


            //assert
            Assert.AreEqual(cart1Res, cart1ActualResult);
            Assert.AreEqual(cart2Res, cart2ActualResult);

            Assert.AreEqual(3, product1.Count);
            Assert.AreEqual(7, product2.Count);
        }
Example #13
0
        public CashBoxView(CashDesk cashDesk, int number, int x, int y)
        {
            this.cashDesk = cashDesk;

            CashDeskName        = new Label();
            Price               = new NumericUpDown();
            QueueLenght         = new ProgressBar();
            LeaveCustomersCount = new Label();
            ServedCustomer      = new Label();
            TotalCustomer       = new Label();

            CashDeskName.AutoSize = true;
            CashDeskName.Location = new System.Drawing.Point(x, y + 40);
            CashDeskName.Name     = "label" + number;
            CashDeskName.Size     = new System.Drawing.Size(35, 13);
            CashDeskName.TabIndex = number;
            CashDeskName.Text     = cashDesk.ToString();


            Price.Location = new System.Drawing.Point(x + 70, y + 40);
            Price.Name     = "numericUpDown" + number;
            Price.Size     = new System.Drawing.Size(120, 20);
            Price.TabIndex = number;
            Price.Maximum  = 1000000000000000;

            QueueLenght.Location = new System.Drawing.Point(x + 240, y + 40);
            QueueLenght.Maximum  = cashDesk.MaxQueueLenght;
            QueueLenght.Name     = "progressBar" + number;
            QueueLenght.Size     = new System.Drawing.Size(100, 23);
            QueueLenght.TabIndex = number;
            QueueLenght.Value    = 0;

            LeaveCustomersCount.AutoSize = true;
            LeaveCustomersCount.Location = new System.Drawing.Point(x + 430, y + 40);
            LeaveCustomersCount.Name     = "label2" + number;
            LeaveCustomersCount.Size     = new System.Drawing.Size(35, 13);
            LeaveCustomersCount.TabIndex = number;
            LeaveCustomersCount.Text     = "";

            ServedCustomer.AutoSize = true;
            ServedCustomer.Location = new System.Drawing.Point(x + 570, y + 40);
            ServedCustomer.Name     = "ServedCustomer" + number;
            ServedCustomer.Size     = new System.Drawing.Size(35, 13);
            ServedCustomer.TabIndex = number;
            ServedCustomer.Text     = "";

            TotalCustomer.AutoSize = true;
            TotalCustomer.Location = new System.Drawing.Point(x + 700, y + 40);
            TotalCustomer.Name     = "TotalCustomer" + number;
            TotalCustomer.Size     = new System.Drawing.Size(35, 13);
            TotalCustomer.TabIndex = number;
            TotalCustomer.Text     = "";

            cashDesk.CheckClosed += CashDesk_CheckClosed;
        }
Example #14
0
        public Main()
        {
            InitializeComponent();
            _dbContext = new CrmContext();

            cart     = new Cart(customer);
            cashDesk = new CashDesk(1, _dbContext.Sellers.FirstOrDefault(), _dbContext)
            {
                isModel = false,
            };
        }
Example #15
0
        public void CheckPrice()
        {
            //Add the products
            Laptop   macBook  = new Laptop("MacBook Pro", 420.00, 2, "Mac");
            CashDesk cashDesk = new CashDesk();

            cashDesk.addToCart(macBook);
            cashDesk.addToCart(macBook);

            Assert.Equal(840.00, cashDesk.calculatePrice());
        }
        public CashBoxView(CashDesk cashDesk, int number, int x, int y)
        {
            this.cashDesk = cashDesk;

            Label1Create(number, x, y);
            Label2Create(number, x, y);
            NumericUpDownCreate(number, x, y);
            ProgressBarCreate(number, x, y);

            cashDesk.CheckClosed += CashDesk_CheckClosed;
        }
        public SelfPurchase()
        {
            dataBase = new VeredContext();
            InitializeComponent();
            cart     = new Cart();
            cashDesk = new CashDesk();

            clientLabel.Content    = $"Hello, guest";
            clientLabel.FontSize   = 16;
            clientLabel.FontFamily = new FontFamily("SegoePrint");
            clientLabel.FontWeight = FontWeights.Bold;
        }
Example #18
0
        public void CashDeskTest()
        {
            // arrange

            VeredContext dataBase = new VeredContext();

            var client1 = dataBase.Clients.Where(i => i.ClientId == 1).FirstOrDefault();

            var client2 = dataBase.Clients.Where(i => i.ClientId == 2).FirstOrDefault();

            var seller = dataBase.Sellers.Where(i => i.SellerId == 3).FirstOrDefault();

            var product1 = dataBase.Products.Where(i => i.ProductId == 4).FirstOrDefault();

            var product2 = dataBase.Products.Where(i => i.ProductId == 5).FirstOrDefault();

            var cart1 = new Cart(client1);

            cart1.Add(product1);
            cart1.Add(product1);
            cart1.Add(product2);

            var cart2 = new Cart(client2);

            cart2.Add(product1);
            cart2.Add(product2);
            cart2.Add(product2);

            var cashdesk1 = new CashDesk(seller, client1);
            var cashdesk2 = new CashDesk(seller, client2);


            decimal cart1ExpectedResult = 18.50M;
            decimal cart2ExpectedResult = 13.00M;


            // act

            decimal cart1ActualResult = cashdesk1.buyThroughPos(cart1);
            decimal cart2ActualResult = cashdesk2.buyThroughPos(cart2);

            //  assert

            Assert.AreEqual(cart1ExpectedResult, cart1ActualResult);
            Assert.AreEqual(cart2ExpectedResult, cart2ActualResult);
            VeredContext dataBase2 = new VeredContext();
            var          product3  = dataBase2.Products.Where(i => i.ProductId == 4).FirstOrDefault();
            var          product4  = dataBase2.Products.Where(i => i.ProductId == 5).FirstOrDefault();

            Assert.AreEqual(31, product3.CountOnShelf);
            Assert.AreEqual(74, product4.CountOnShelf);
        }
        public SelfPurchase(Client client)
        {
            dataBase = new VeredContext();
            InitializeComponent();
            Client   = client;
            cart     = new Cart(Client);
            cashDesk = new CashDesk(Client);

            clientLabel.Content    = $"Hello, {client.FirstName}";
            clientLabel.FontSize   = 16;
            clientLabel.FontFamily = new FontFamily("SegoePrint");
            clientLabel.FontWeight = FontWeights.Bold;
        }
Example #20
0
        public Main()
        {
            InitializeComponent();
            db = new CrmContext();

            cart     = new Cart(customer);
            cashDesk = new CashDesk(1, db.Sellers.FirstOrDefault(), db)
            {
                IsModel = false
            };
            dataGridView1.DataSource = db.Products.ToList();
            dataGridView1.Columns["ProductId"].Visible = false;
            dataGridView1.Columns["Sells"].Visible     = false;
        }
Example #21
0
        public CashDeskView(CashDesk cashDesk, int number, int x, int y)
        {
            this.cashDesk = cashDesk;

            CashDeskName       = new Label();
            CashDeskSum        = new NumericUpDown();
            QueueLengthProgres = new ProgressBar();
            ExitCustomer       = new Label();


            //
            // modelLabel
            //
            CashDeskName.AutoSize = true;
            CashDeskName.Location = new System.Drawing.Point(x, y + 33);
            CashDeskName.Name     = "labelCashDeskName" + number;
            CashDeskName.Size     = new System.Drawing.Size(35, 13);
            CashDeskName.TabIndex = number;
            CashDeskName.Text     = cashDesk.ToString();
            //
            // modelNumericUpDown
            //
            CashDeskSum.Location = new System.Drawing.Point(x + 70, y + 31);
            CashDeskSum.Name     = "NumericUpDownCashDeskSum" + number;
            CashDeskSum.Size     = new System.Drawing.Size(120, 20);
            CashDeskSum.TabIndex = number;
            CashDeskSum.Maximum  = 100000000000000000;

            //
            // progressBar
            //
            QueueLengthProgres.Location = new System.Drawing.Point(x + 225, y + 31);
            QueueLengthProgres.Maximum  = cashDesk.MaxQueueLenght;
            QueueLengthProgres.Name     = "progressBarQueueLengthProgres" + number;
            QueueLengthProgres.Size     = new System.Drawing.Size(100, 23);
            QueueLengthProgres.TabIndex = number;
            QueueLengthProgres.Value    = 0;

            //
            // modelLabel
            //
            ExitCustomer.AutoSize = true;
            ExitCustomer.Location = new System.Drawing.Point(x + 400, y + 33);
            ExitCustomer.Name     = "labelExitCustomer" + number;
            ExitCustomer.Size     = new System.Drawing.Size(35, 13);
            ExitCustomer.TabIndex = number;
            ExitCustomer.Text     = "";

            cashDesk.CheckClosed += CashDesk_CheckClosed;
        }
Example #22
0
        public void CashDeskTest()
        {
            //Arrange
            Customer customer1 = new Customer()
            {
                Name = "test1", CustomerId = 1
            };
            Customer customer2 = new Customer()
            {
                Name = "test2", CustomerId = 2
            };
            Product product1 = new Product()
            {
                Name = "pr1", Count = 10, Price = 1, ProductId = 1
            };
            Product product2 = new Product()
            {
                Name = "pr2", Count = 10, Price = 2, ProductId = 2
            };
            Cart   cart1  = new Cart(customer1);
            Cart   cart2  = new Cart(customer2);
            Seller seller = new Seller()
            {
                Name = "seller1", SellerId = 1
            };
            CashDesk cashDesk = new CashDesk(seller, 1);

            cashDesk.maxLenght = 10;
            cashDesk.isModel   = true;
            //Act
            cart1.Add(product1);
            cart1.Add(product1);
            cart1.Add(product2);

            cart2.Add(product2);
            cart2.Add(product2);
            cart2.Add(product1);

            cashDesk.Enqueue(cart1);
            cashDesk.Enqueue(cart2);

            decimal result1 = cashDesk.Dequeue();
            decimal result2 = cashDesk.Dequeue();

            //Assert
            Assert.AreEqual(4, result1);
            Assert.AreEqual(5, result2);
            Assert.AreEqual(7, product1.Count);
            Assert.AreEqual(7, product2.Count);
        }
Example #23
0
        public void TestDoCount()
        {
            var cashDesk = new CashDesk();

            GetValuesForCashDesk(cashDesk);
            var activity            = new ResultActivity();
            var exceptedResult      = new int[] { 1, 1, 2, 10, 17, 1, 1, 1, 0, 1, 0, 1 };
            var bankNotes           = new int[] { 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5 };
            var bankNotesInCashDesk = new int[] { cashDesk.AmountOf20000Ft, cashDesk.AmountOf10000Ft, cashDesk.AmountOf5000Ft, cashDesk.AmountOf2000Ft, cashDesk.AmountOf1000Ft, cashDesk.AmountOf500Ft, cashDesk.AmountOf200Ft, cashDesk.AmountOf100Ft, cashDesk.AmountOf50Ft, cashDesk.AmountOf20Ft, cashDesk.AmountOf10Ft, cashDesk.AmountOf5Ft };

            var ActualResult = activity.IShouldRemoveXCashFromDesk(cashDesk.ClosingBalance, bankNotes, bankNotesInCashDesk);

            Assert.AreEqual(exceptedResult, ActualResult);
        }
Example #24
0
        /// <summary>
        /// Генерирует визуальную состовляющую (кассы)
        /// </summary>
        /// <param name="cashDesk">кассы</param>
        /// <param name="number">кол-во касс</param>
        /// <param name="x">х</param>
        /// <param name="y">у</param>
        public CashBoxView(CashDesk cashDesk, int number, int x, int y)
        {
            //инициализация
            this.cashDesk       = cashDesk;
            CashDeskName        = new Label();
            Price               = new NumericUpDown();
            QueueLenght         = new ProgressBar();
            LeaveCustomersCount = new Label();

            CashDeskName.AutoSize = true;
            CashDeskName.Location = new System.Drawing.Point(x, y);
            CashDeskName.Name     = "label" + number;
            CashDeskName.Size     = new System.Drawing.Size(35, 13);
            CashDeskName.TabIndex = number;
            CashDeskName.Text     = cashDesk.ToString();

            //
            // numericUpDown
            //
            Price.Location = new System.Drawing.Point(x + 90, y);
            Price.Name     = "numericUpDown" + number;
            Price.Size     = new System.Drawing.Size(120, 20);
            Price.TabIndex = number;
            Price.Maximum  = 1000000000000000;


            //
            // progressBar1
            //
            QueueLenght.Location = new System.Drawing.Point(x + 300, y);
            QueueLenght.Maximum  = cashDesk.MaxQueueLenght;
            QueueLenght.Name     = "progressBar" + number;
            QueueLenght.Size     = new System.Drawing.Size(100, 23);
            QueueLenght.TabIndex = number;
            QueueLenght.Value    = 0;

            //
            // label
            //
            LeaveCustomersCount.AutoSize = true;
            LeaveCustomersCount.Location = new System.Drawing.Point(x + 400, y);
            LeaveCustomersCount.Name     = "label2" + number;
            LeaveCustomersCount.Size     = new System.Drawing.Size(35, 13);
            LeaveCustomersCount.TabIndex = number;
            LeaveCustomersCount.Text     = "";
            //делегат
            cashDesk.CheckClosed += CashDesk_CheckClosed;
        }
Example #25
0
 private void GetValuesForCashDesk(CashDesk cashDesk)
 {
     cashDesk.OpeningBalance  = 20000;
     cashDesk.ClosingBalance  = 97825;
     cashDesk.AmountOf5Ft     = 25;
     cashDesk.AmountOf10Ft    = 30;
     cashDesk.AmountOf20Ft    = 20; //+3
     cashDesk.AmountOf50Ft    = 60;
     cashDesk.AmountOf100Ft   = 25; //+2
     cashDesk.AmountOf200Ft   = 30;
     cashDesk.AmountOf500Ft   = 11;
     cashDesk.AmountOf1000Ft  = 20; //+1
     cashDesk.AmountOf2000Ft  = 10; //+1
     cashDesk.AmountOf5000Ft  = 2;
     cashDesk.AmountOf10000Ft = 1;
     cashDesk.AmountOf20000Ft = 1;
 }
        private void txbxClientId_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                if (int.Parse(txbxClientId.Text) > 0)
                {
                    int clientId = Convert.ToInt32(txbxClientId.Text);

                    client = dataBase.Clients.Where(i => i.ClientId == clientId).FirstOrDefault();

                    cashDesk = new CashDesk(Seller, client);
                }
            }
            catch
            {
                txbxClientId.Clear();
            }
        }
Example #27
0
        public CashDeckView(CashDesk cashDesk, int number, int x, int y)
        {
            this.cashDesk = cashDesk;
            // label1
            //
            CashDeskName = new Label();
            CashDeskName.AutoSize = true;
            CashDeskName.Location = new System.Drawing.Point(x, y + 10);
            CashDeskName.Name = "CashDeskName" + number;
            CashDeskName.Size = new System.Drawing.Size(35, 11);
            CashDeskName.TabIndex = 1;
            CashDeskName.Text = cashDesk.ToString();
            //

            // label1
            //
            ExitCustomer = new Label();
            ExitCustomer.AutoSize = true;
            ExitCustomer.Location = new System.Drawing.Point(x + 420, y + 10);
            ExitCustomer.Name = "ExitCustomer" + number;
            ExitCustomer.Size = new System.Drawing.Size(35, 11);
            ExitCustomer.TabIndex = 1;
            ExitCustomer.Text = cashDesk.ToString();

            // numericUpDown1
            //

            Price = new NumericUpDown();
            Price.Location = new System.Drawing.Point(x + 100, y + 10);
            Price.Name = "Price" + number;
            Price.Size = new System.Drawing.Size(120, 40);
            Price.TabIndex = 3;
            Price.Maximum = 100000000000000000;

            QueueLenght = new ProgressBar();
            QueueLenght.Maximum = cashDesk.MaxQueueLenght;
            QueueLenght.Value = 0;
            QueueLenght.Location = new System.Drawing.Point(x + 250, y + 10);
            QueueLenght.Name = "QueueLenght" + number;
            QueueLenght.Size = new System.Drawing.Size(165, 23);
            QueueLenght.TabIndex = 1;

            cashDesk.CheckClosed += CashDesk_CheckClosed;
        }
Example #28
0
        public CashBoxView(CashDesk _cashDesk, int number, int x, int y)
        {
            cashDesk            = _cashDesk;
            CashDeskName        = new Label();
            Price               = new NumericUpDown();
            LeaveCustomersCount = new Label();
            QueueLenght         = new ProgressBar();
            //
            // label
            //
            CashDeskName.AutoSize = true;
            CashDeskName.Location = new System.Drawing.Point(x, y);
            CashDeskName.Name     = "label" + number;
            CashDeskName.Size     = new System.Drawing.Size(35, 13);
            CashDeskName.TabIndex = number;
            CashDeskName.Text     = cashDesk.ToString();
            //
            // numericUpDown
            //
            Price.Location = new System.Drawing.Point(x + 80, y);
            Price.Name     = "numericUpDown" + number;
            Price.Size     = new System.Drawing.Size(120, 20);
            Price.TabIndex = number;
            Price.Maximum  = 100000000000;
            //
            // progressBar1
            //

            QueueLenght.Location = new System.Drawing.Point(x + 250, y);
            QueueLenght.Maximum  = cashDesk.MaxQueueLength;
            QueueLenght.Name     = "progressBar" + number;
            QueueLenght.Size     = new System.Drawing.Size(100, 23);
            QueueLenght.TabIndex = number;
            QueueLenght.Value    = 0;

            LeaveCustomersCount.AutoSize = true;
            LeaveCustomersCount.Location = new System.Drawing.Point(x + 400, y);
            LeaveCustomersCount.Name     = "label2" + number;
            LeaveCustomersCount.Size     = new System.Drawing.Size(35, 13);
            LeaveCustomersCount.TabIndex = number;
            LeaveCustomersCount.Text     = "";

            cashDesk.Checkclosed += CashDesk_CheckClosed; //подписка на событие
        }
Example #29
0
        public CashDeskView(CashDesk cashDesk, int number)
        {
            this.cashDesk = cashDesk;

            cashName          = new Label();
            cashName.AutoSize = true;
            cashName.Font     = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            cashName.Location = new System.Drawing.Point(5, number * 35 + 10);
            cashName.Name     = "cashLabel" + cashDesk.number.ToString();
            cashName.Size     = new System.Drawing.Size(69, 20);
            cashName.TabIndex = 3;
            cashName.Text     = $"Cash Number {number}: ";

            queueLenght          = new ProgressBar();
            queueLenght.Location = new System.Drawing.Point(229, number * 35 + 10);
            queueLenght.Name     = "queueLenght" + cashDesk.number.ToString();
            queueLenght.Size     = new System.Drawing.Size(100, 20);
            queueLenght.Minimum  = 0;
            queueLenght.Maximum  = cashDesk.maxLenght;
            queueLenght.TabIndex = 4;

            leaveCount = new Label();

            leaveCount.AutoSize = true;
            leaveCount.Font     = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            leaveCount.Location = new System.Drawing.Point(344, number * 35 + 10);
            leaveCount.Name     = "leaveLable" + cashDesk.number;
            leaveCount.Size     = new System.Drawing.Size(56, 20);
            leaveCount.TabIndex = 5;
            leaveCount.Text     = $"Queue leave: {cashDesk.exitCount}.";

            cashSum = new NumericUpDown();

            cashSum.Location      = new System.Drawing.Point(95, number * 35 + 10);
            cashSum.Name          = "cashSum" + cashDesk.number;
            cashSum.Size          = new System.Drawing.Size(120, 20);
            cashSum.TabIndex      = 2;
            cashSum.DecimalPlaces = 2;
            cashSum.Minimum       = 0;
            cashSum.Maximum       = 1_000_000;

            cashDesk.BillOut += CashDesk_BillOut;
        }
        public async Task CreateStoreAsyncTestAsync()
        {
            string expectedResult = "Item Created";
            string result         = String.Empty;
            Store  store          = new Store(_StoreRepository);

            store.Key  = "ST01";
            store.Name = "Tienda 1";

            CashDesk        cashDesk  = new CashDesk("ST01C1", "Caja 1");
            List <CashDesk> cashDesks = new List <CashDesk>();

            cashDesks.Add(cashDesk);
            store.CashDesks = cashDesks;

            result = await store.CreateStoreAsync();

            Assert.AreEqual(expectedResult, result);
        }