private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         order.PurchaseDate = this.dateTimePicker1.Value;
         bool success = orderBUS.InsertOrder(order);
         if (success)
         {
             MessageBox.Show("Insert successfully", "Information",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
             order                    = new Order();
             order.OrderID            = new Random(1000).Next();
             order.PurchaseDate       = dateTimePicker1.Value;
             dataGridView1.DataSource = null;
         }
     }
     catch (Exception se) {
         MessageBox.Show(se.Message);
     }
 }
Esempio n. 2
0
        private void btnBuy_Click(object sender, EventArgs e)
        {
            if (GetQuantity() < 0)
            {
                return;
            }
            if (MessageBox.Show("Do you want to buy?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            if (_orderBUS.InsertOrder(CreateOrder()))
            {
                MessageBox.Show("Buy was successfull ^^", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Buy was fail :(", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        private void btnAddOrder_Click(object sender, EventArgs e)
        {
            int dressID = dressBUS.GetDressID(cbxDressName.Text);

            if (rentQuant.Value < OrdLine_BUS.GetStockQuant(dressID))
            {
                MessageBox.Show("Not enough dress");
            }
            else
            {
                int      dressQuant = Convert.ToInt32(rentQuant.Value);
                DressDTO dressDTO   = new DressDTO(dressID, cbxDressName.Text);
                int      eID        = Convert.ToInt32(txtEmpID.Text);
                int      cusID      = Convert.ToInt32(txtCID.Text);
                OrderDTO orderDTO   = new OrderDTO(eID, cusID);

                OrdLine_BUS.ReduceStockQuant(dressID);

                orderBUS.InsertOrder(orderDTO);

                OrdLine_BUS.InsertOrderLine(dressID, dressQuant);
            }
        }