protected void Sumbit_Order(object sender, EventArgs e) { if (DialogClass.MessageChickSimple("確定此筆訂單已完成?", MessageBoxButton.OKCancel)) { Button sumbitButton = (Button)sender; String order_id = (string)sumbitButton.CommandArgument; string sqlStr = " update order_form set status = 20 , end_time = getDate() where order_form.order_id = " + order_id; myDatabase.execSQL(sqlStr); Order_View(sender, e); } }
protected void Pick_Up_Order(object sender, EventArgs e) { if (DialogClass.MessageChickSimple("確定要製作此筆定單商品?", MessageBoxButton.OKCancel)) { string user_id = Session["user_name"].ToString(); Button pickupButton = (Button)sender; String order_id = (string)pickupButton.CommandArgument; string sqlStr = " update order_form set status = 18 , pick_up_time = getDate(), pick_up_id = " + myDatabase.qo(user_id) + " where order_form.order_id = " + order_id; myDatabase.execSQL(sqlStr); Order_View(sender, e); Order_Detail_View(sender, e); } }
protected void Complete_Order(object sender, EventArgs e) { if (DialogClass.MessageChickSimple("確定此筆訂單商品已製作完成?", MessageBoxButton.OKCancel)) { Button completeButton = (Button)sender; String order_id = (string)completeButton.CommandArgument; string sqlStr = " update order_form set status = 19 , complete_time = getDate() where order_form.order_id = " + order_id; myDatabase.execSQL(sqlStr); Order_View(sender, e); orderTable = null; Order_Item_Detail_Grid.DataSource = orderTable; Order_Item_Detail_Grid.DataBind(); } }
protected void Submit_Order(object sender, EventArgs e) { if (addItems.Rows.Count > 0) { if (DialogClass.MessageChickSimple("確定完成結帳?", MessageBoxButton.OKCancel)) { string user_id = Session["user_name"].ToString(); string sqlstr = " Declare @Form_No int;"; //sqlstr += " Begin Tran"; sqlstr += " select @Form_No = isnull(max(order_id), 0) + 1 "; sqlstr += " from order_form;"; sqlstr += " insert into order_form (order_id, created_id,status,create_time,cust_sex, cust_age) values("; sqlstr += " @Form_No," + myDatabase.qo(user_id) + ",1,getDate(),"; sqlstr += myDatabase.qo(cust_Sex.SelectedValue.ToString()) + ","; sqlstr += myDatabase.qo(cust_Age.SelectedValue.ToString()) + ");"; sqlstr += " insert into order_detail (order_id, prod_id,qty,sugur_type,ice_type) values"; for (int i = 0; i < addItems.Rows.Count; i++) { DataRow row = addItems.Rows[i]; string prod_id = row["prod_id"].ToString(); string qty = row["qty"].ToString(); string suger_id = row["suger_id"].ToString(); string ice_id = row["ice_id"].ToString(); sqlstr += "( @Form_No," + myDatabase.qo(prod_id) + "," + myDatabase.qo(qty) + "," + myDatabase.qo(suger_id) + "," + myDatabase.qo(ice_id) + ")"; if (i + 1 == addItems.Rows.Count) { sqlstr += ";"; } else { sqlstr += ","; } } myDatabase.execSQL(sqlstr); addItems.Rows.Clear(); Show_Grid(); showResMessage("訂單已送出"); } } else { showResMessage("請選擇欲結帳的商品"); } }