Beispiel #1
0
        internal void SetOrderDelegateCallbackFn(ImportOrder order)
        {
            if (importOrder.ImportOrderItems.Count > 0)
            {
                var result = MessageBox.Show(this,
                    "Bạn có muốn lưu lại đơn đang làm hay không?",
                    "Lưu đơn hàng",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);
                if(result == DialogResult.Yes)
                {
                    saveOrder();
                }
            }

            importOrder = db.ImportOrders.Where(i => i.order_id.Equals(order.order_id))
                //.Include(i => i.ImportOrderItems)
                .First();
            foreach (var item in importOrder.ImportOrderItems)
            {
                item.ProductName = item.Product.prod_name;
                item.TotalItemPrice = item.quantity_by_stock * item.base_price_by_stock +
                    item.base_price_by_stock * item.quantity_by_unit / item.quantity_control;
            }
            dataGridView.DataSource = importOrder.ImportOrderItems.ToList();
            updateLblTotal();
            if (importOrder.order_status.Trim() == "Done")
            {
                orderState = OrderState.Done;
                cbbStatus.Text = "Done";
            }
            else
            {
                orderState = OrderState.OnProgress;
                cbbStatus.Text = "On progress";
            }
        }
Beispiel #2
0
 private void newOrder()
 {
     clearEntries();
     importOrder = db.ImportOrders.Create();
     importOrder.user_id = 1;
     importOrder.order_status = "Done";
     importOrder.total_price = 0;
     importOrder.date_import = DateTime.Now;
     dataGridView.DataSource = new List<ImportOrderItem>();
     orderState = OrderState.New;
 }