private void BtnOverview_Click(object sender, EventArgs e)
        {
            string[] columns = new string[] { "OrderId", "StaffName", "CustomerName", "CardNumber", "OrderPaid", "OrderAddress", "OrderDate", "StockName", "StockQuantity" };

            string CustomerOrderId = LblOrderID.Text;
            string staffId;
            string customerId;
            string cardId;
            string orderPaid;
            string orderAddress;
            string OrderDate;

            if (newOrder)
            {
                if (EmptyFields())
                {
                    return;
                }

                staffId    = (CbxStaffID.SelectedItem as Container).Id;
                customerId = (CbxCustomerID.SelectedItem as Container).Id;
                cardId     = (CbxCardID.SelectedItem as Container).Id;

                orderPaid    = CbxOrderPaid.Checked.ToString();
                orderAddress = TbxOrderAddress.ToString();
                OrderDate    = DtpOrderDate.Value.ToString();
            }

            else
            {
                //NEED TO PASS IN CUSTOMER ORDER ID AND USE IN QUERY
                FrmCustomerOrderReport report = new FrmCustomerOrderReport(CustomerOrderId);
                report.Show();
                return;
            }

            FrmOverview overview = new FrmOverview(columns);

            overview.Show();

            string staffName    = Staff.GetData(new string[] { staffId }, new string[] { "StaffName" })[0];
            string customerName = Customer.GetData(new string[] { customerId }, new string[] { "CustomerName" })[0];
            string cardNumber   = Card.GetData(new string[] { cardId }, new string[] { "CardNumber" })[0];

            for (int i = 0; i < StockIdToAdd.Count; i++)
            {
                string stockName = Stock.GetData(new string[] { StockIdToAdd[i] }, new string[] { "StockName" })[0];

                overview.Add(new string[] { CustomerOrderId, staffName, customerName, cardNumber, orderPaid, orderAddress, OrderDate, stockName, QuantityToAdd[i] });
            }
        }
Exemplo n.º 2
0
        private void BtnOverview_Click(object sender, EventArgs e)
        {
            string[] columns = new string[] { "StockOrderId", "StaffName", "StockOrderDate", "StockName", "StockQuantity" };

            string StockOrderId = LblStockOrderID.Text;
            string staffId;
            string staffName;
            string stockOrderDate;

            if (newOrder)
            {
                if (EmptyFields())
                {
                    return;
                }

                staffId        = (CbxStaffID.SelectedItem as Container).Id;
                staffName      = Staff.GetData(new string[] { staffId }, new string[] { "StaffName" })[0];
                stockOrderDate = DtpStockOrderDate.Value.ToString();
            }

            else
            {
                //NEED TO PASS IN STOCK ORDER ID AND USE IN QUERY
                FrmStockOrderReport report = new FrmStockOrderReport(StockOrderId);
                report.Show();
                return;
            }

            FrmOverview overview = new FrmOverview(columns);

            overview.Show();

            for (int i = 0; i < StockIdToAdd.Count; i++)
            {
                string stockName = Stock.GetData(new string[] { StockIdToAdd[i] }, new string[] { "StockName" })[0];

                overview.Add(new string[] { StockOrderId, staffName, stockOrderDate, stockName, QuantityToAdd[i] });
            }
        }