private void buttonTakeOrder_Click(object sender, EventArgs e)
        {
            FormAdminPanel myUserControl = (FormAdminPanel)ParentForm;
            Employee       LoginEmployee = _employeeManager.GetEmployee(myUserControl.Text);
            Order          order         = new Order()
            {
                OrderDate       = DateTime.Now,
                EmployeeID      = LoginEmployee.EmployeeID,
                OrderTotalPrice = decimal.Parse(labelTotalPrice.Text)
            };

            _orderManager.AddOrder(order);

            foreach (CartItem cartItem in _myCart.ListCart)
            {
                OrderDetail orderDetail = new OrderDetail
                {
                    OrderID           = order.OrderID,
                    ProductID         = cartItem.ID,
                    ProductAmount     = cartItem.Amount,
                    UnitPrice         = cartItem.Price,
                    ProductTotalPrice = cartItem.Price * cartItem.Amount
                };
                _orderDetailManager.AddOrderDetail(orderDetail);
            }

            MessageBox.Show("Yeni Sipariş Oluştu ");
        }
Exemplo n.º 2
0
        private void buttonGiris_Click(object sender, EventArgs e)
        {
            string   username      = textKullaniciAdi.Text;
            string   password      = textSifre.Text;
            Employee loginEmployee = _employeeManager.GetEmployee(username, password);

            if (loginEmployee != null)
            {
                MessageBox.Show("Giris Basarili", "Login Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                FormAdminPanel formAdminPanel = new FormAdminPanel(this, loginEmployee);
                textKullaniciAdi.Clear();
                textSifre.Clear();
                formAdminPanel.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Kullanici adi ve şifre yanlis", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }