Пример #1
0
        public static int SubmitOrder(int Rest_ID, int[] Order_List, double Total, string Notes)
        {
            // TODO: Setup loading customer ID
            int Cust_ID = 0;

            // Order ID = unixtimestamp + customer ID
            Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            int Order_ID = unixTimestamp + Cust_ID;

            // Create adapter to create order (Wat)
            DataSet1TableAdapters.Order_DetailsTableAdapter adapter = new DataSet1TableAdapters.Order_DetailsTableAdapter();
            adapter.CreateOrder(Order_ID, Cust_ID, Rest_ID, DateTime.Now, Total, "Visa", 0);

            // Create adapter to submit order to database
            DataSet1TableAdapters.Order_ItemsTableAdapter adapter2 = new DataSet1TableAdapters.Order_ItemsTableAdapter();

            for (int i = 0; i < Order_List.Length; i++)
            {
                adapter2.Insert(Order_ID, Order_List[i], Notes, i);
            }

            return Order_ID;
        }