public IQueryable <OrderDetail> UpdateOrderDetail(int OrderId) { //String cartId = usersShoppingCart.GetCartId(); using (OrderActions MyOrderActions = new OrderActions()) { OrderActions.OrederDetailUpdates[] ODUpdates = new OrderActions.OrederDetailUpdates[OrderDetailList.Rows.Count]; for (int i = 0; i < OrderDetailList.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(OrderDetailList.Rows[i]); ODUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductId"]); TextBox QtyShippedTextBox = new TextBox(); QtyShippedTextBox = (TextBox)OrderDetailList.Rows[i].FindControl("QtyShippedBx"); ODUpdates[i].QtyShipped = Convert.ToInt16(QtyShippedTextBox.Text.ToString()); TextBox QtyCancelledTextBox = new TextBox(); QtyCancelledTextBox = (TextBox)OrderDetailList.Rows[i].FindControl("QtyCancelledBx"); ODUpdates[i].QtyCancelled = Convert.ToInt16(QtyCancelledTextBox.Text.ToString()); TextBox CommentBox = new TextBox(); CommentBox = (TextBox)OrderDetailList.Rows[i].FindControl("CommentBx"); ODUpdates[i].Comment = CommentBox.Text.ToString(); } MyOrderActions.UpdateOrderDetailDatabase(OrderId, ODUpdates); OrderDetailList.DataBind(); return(MyOrderActions.GetOrderDetailsItems(OrderId)); } }
protected void BindList2(int order_id) { DataTable dt = new DataTable(); conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Cafe"].ConnectionString); using (conn) { SqlDataAdapter ad = new SqlDataAdapter(string.Format("SELECT * FROM sum_orders_detail WHERE order_id = {0}", order_id), conn); ad.Fill(dt); } OrderDetailList.DataSource = dt; OrderDetailList.DataBind(); }
protected void OrderMasterList_ItemCommand(object source, DataListCommandEventArgs e) { HiddenField hf = (HiddenField)e.Item.FindControl("hfOrderID"); DataTable dt = new DataTable(); conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Cafe"].ConnectionString); using (conn) { SqlDataAdapter ad = new SqlDataAdapter(string.Format("SELECT * FROM sum_orders_detail WHERE order_id = {0}", hf.Value), conn); ad.Fill(dt); } OrderDetailList.DataSource = dt; OrderDetailList.DataBind(); }