public static int DeleteOrders(int[] orderIDs) { foreach (var orderID in orderIDs) { OrderDetailDB.Delete(orderID); } return(OrderDB.Delete(orderIDs)); }
// Khai báo các chức năng xử lý nghiệp vụ /// <summary> /// Hiển thị suppliers /// </summary> /// <param name="page"></param> /// <param name="pageSize"></param> /// <param name="searchValue"></param> /// <param name="rowCount"></param> /// <returns></returns> public static List <OrderDetail> ListOfOrderDetails(int orderID) { List <OrderDetail> listDetails = OrderDetailDB.List(orderID); foreach (var detail in listDetails) { detail.Product = ProductDB.Get(detail.ProductID); } return(listDetails); }
private void orderDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { int rowindex = e.RowIndex; int orderid = orders[rowindex].OrderID; selectedorder = OrderDetailDB.GetSelectedOrderDetail(orderid); frmOrderDetail orderDetailForm = new frmOrderDetail(); orderDetailForm.orderdetail_list = selectedorder; DialogResult result = orderDetailForm.ShowDialog(); }
private void orderIDComboBox_SelectedIndexChanged(object sender, EventArgs e) { dtpShippedDate.Enabled = false; btnUpdate.Enabled = true; // can update the shippedDate foreach (var order in orders) // display the selected order { if (orderIDComboBox.Text == order.OrderID.ToString()) { newOrder = oldOrder = order.CopyOrder(); // make separate copy before update customerIDTextBox.Text = order.CustomerID; txtOrderDate.Text = (order.OrderDate == null) ? null : Convert.ToDateTime(order.OrderDate).ToShortDateString(); txtRequiredDate.Text = (order.RequiredDate == null) ? null : Convert.ToDateTime(order.RequiredDate).ToShortDateString(); if (order.ShippedDate != null) // ShippedDate is not null { dtpShippedDate.Text = Convert.ToDateTime(order.ShippedDate).ToShortDateString(); } else // ShippedDate is null { dtpShippedDate.CustomFormat = " "; dtpShippedDate.Format = DateTimePickerFormat.Custom; order.ShippedDate = tmpDate; } } } // get the OrderDetails for display in the list box List <OrderDetail> orderDetails = OrderDetailDB.GetOrderDetails(); lstOrdDetails.Items.Clear(); // clear the list box int i = 0; decimal orderTotal = 0; // the total amount of each order for the OrderID foreach (var orderDetail in orderDetails) // details to be listed for the chosen OrderID { if (orderIDComboBox.Text == orderDetail.OrderID.ToString()) { lstOrdDetails.Items.Add(orderDetail.OrderID.ToString()); lstOrdDetails.Items[i].SubItems.Add(orderDetail.ProductID.ToString()); lstOrdDetails.Items[i].SubItems.Add(orderDetail.Quantity.ToString()); lstOrdDetails.Items[i].SubItems.Add(orderDetail.UnitPrice.ToString("c")); lstOrdDetails.Items[i].SubItems.Add(orderDetail.Discount.ToString("p0")); lstOrdDetails.Items[i].SubItems.Add(orderDetail.OrderTotal.ToString("c")); orderTotal += orderDetail.OrderTotal; i++; } } txtTotalAmount.Text = orderTotal.ToString("c"); // display to total sum }
public static OrderDetail GetOrderDetail(int orderID, int productID) { return(OrderDetailDB.Get(orderID, productID)); }
public static bool UpdateOrderDetail(OrderDetail data) { return(OrderDetailDB.Update(data)); }
/// <summary> /// thêm supplier /// </summary> /// <param name="data"></param> /// <returns></returns> public static int AddOrderDetail(OrderDetail data) { return(OrderDetailDB.Add(data)); }
//order detail public static List <OrderDetail> ListOfOrderDetail(int id) { return(OrderDetailDB.ListDetail(id)); }