Example #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //if (txtOrderQuantity.Text == "" && txtSelectStock.Text == "" && txtSelectSupplier.Text == "")
            //{
            //    btnSubmit.Enabled = false;
            //}
            //else
            //    btnSubmit.Enabled = true;
            Stock_Order sOrder = new Stock_Order();

            // orderLine.Q = orderLine.Stock_Order_Quantity;
            sOrder.Stock_Order_Description = "Description";
            sOrder.Stock_Order_Issue_Date  = DateTime.Now;
            sOrder.Stock_Order_Status_ID   = 1;
            sOrder.Supplier_ID             = supplierID;
            db.Stock_Order.Add(sOrder);
            db.SaveChanges();
            foreach (var item in Globals.StockOrders)
            {
                Stock_Order_Line orderLine = new Stock_Order_Line();
                orderLine.Stock_ID = item.OrderNo;


                orderLine.Stock_Order_Quantity = item.sOrderQuantity;

                orderLine.Stock_Order_ID = sOrder.Stock_Order_ID;
                // sOrder.Stock_Order_ID = item.OrderNo;

                db.Stock_Order_Line.Add(orderLine);
                db.SaveChanges();
                // parent.load();


                //}



                //SendEmail();
                //// parent.loadReceivedOrder();
                //MessageBox.Show("New Order Placed");
            }
        }
Example #2
0
        private void ListOrders_Load(object sender, EventArgs e)
        {
            //foreach(var orders in Globals.StockOrders)
            //{
            //    TreeNode node = new TreeNode(orders.OrderNo.ToString());
            //    node.Nodes.Add(orders.StockItemName);
            //    treeView1.Nodes.Add(node);
            //}



            foreach (var orders in db.Stock_Order)
            {
                Stock_Order      so  = new Stock_Order();
                Stock_Order_Line sol = db.Stock_Order_Line.Where(x => x.Stock_Order_Line_ID == orders.Stock_Order_ID).FirstOrDefault();

                TreeNode node = new TreeNode("Order No " + orders.Stock_Order_ID.ToString());
                node.Nodes.Add(sol.Stock_Item.Stock_Item_Name);
                treeView1.Nodes.Add(node);
            }
        }