private void dataGridViewCustomers_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridViewCustomers.Columns[e.ColumnIndex].Name == "Cart" && e.RowIndex >= 0) { string CustomerId_Value = dataGridViewCustomers.Rows[e.RowIndex].Cells["Id"].Value.ToString(); var cart = CartOfCustomerDataAccess.GetCart(CustomerId_Value); CartOfCustomerForm customerCartForm = new CartOfCustomerForm(); SendCartInfoEvent += customerCartForm.ShowCart; SendCartInfoEvent.Invoke(cart); customerCartForm.ShowDialog(); } else if (dataGridViewCustomers.Columns[e.ColumnIndex].Name == "Order" && e.RowIndex >= 0) { string CustomerId_Value = dataGridViewCustomers.Rows[e.RowIndex].Cells["Id"].Value.ToString(); var orders = OrderOfCustomerDataAccess.GetAllOrders(CustomerId_Value); OrdersOfCustomerForm ordersOfCustomerForm = new OrdersOfCustomerForm(); SendOrdersInfoEvent += ordersOfCustomerForm.ShowOrders; SendOrdersInfoEvent.Invoke(orders); ordersOfCustomerForm.ShowDialog(); } else if (dataGridViewCustomers.Columns[e.ColumnIndex].Name == "Review" && e.RowIndex >= 0) { string CustomerId_Value = dataGridViewCustomers.Rows[e.RowIndex].Cells["Id"].Value.ToString(); var reviews = ReviewOfCustomerDataAccess.GetReviews(CustomerId_Value); ReviewsOfCustomerForm ordersOfCustomerForm = new ReviewsOfCustomerForm(); SendReviewsInfoEvent += ordersOfCustomerForm.ShowReviews; SendReviewsInfoEvent.Invoke(reviews); ordersOfCustomerForm.ShowDialog(); } }
private void ShowPendingPaymentOrders() { try { _pendingPaymentOrders = OrderOfCustomerDataAccess.GetOrdersByStatusId(CustomerInfo.customer.Id, 1); } catch (Exception ex) { MessageBox.Show(ex.Message); } dataGridViewPendingPaymentOrders.Rows.Clear(); foreach (var order in _pendingPaymentOrders) { int rowId = dataGridViewPendingPaymentOrders.Rows.Add(); DataGridViewRow row = dataGridViewPendingPaymentOrders.Rows[rowId]; row.Cells["OrderId2"].Value = order.Id; row.Cells["BookISBN2"].Value = order.Book_ISBN; row.Cells["Title2"].Value = order.Title; row.Cells["Amount2"].Value = order.Amount; row.Cells["TotalPrice2"].Value = order.Total_Price; row.Cells["OrderDate2"].Value = order.Order_Date; } }
private void ShowWaitingForDeliveryOrders() { try { _waitingForDeliveryOrders = OrderOfCustomerDataAccess.GetOrdersByStatusId(CustomerInfo.customer.Id, 2); } catch (Exception ex) { MessageBox.Show(ex.Message); } dataGridViewWaitingForDeliveryOrders.Rows.Clear(); foreach (var order in _waitingForDeliveryOrders) { int rowId = dataGridViewWaitingForDeliveryOrders.Rows.Add(); DataGridViewRow row = dataGridViewWaitingForDeliveryOrders.Rows[rowId]; row.Cells["OrderId3"].Value = order.Id; row.Cells["BookISBN3"].Value = order.Book_ISBN; row.Cells["Title3"].Value = order.Title; row.Cells["Amount3"].Value = order.Amount; row.Cells["TotalPrice3"].Value = order.Total_Price; row.Cells["OrderDate3"].Value = order.Order_Date; } }
private void ShowAllOrders() { try { _allOrders = OrderOfCustomerDataAccess.GetAllOrders(CustomerInfo.customer.Id); } catch (Exception ex) { MessageBox.Show(ex.Message); } dataGridViewAllOrders.Rows.Clear(); foreach (var order in _allOrders) { int rowId = dataGridViewAllOrders.Rows.Add(); DataGridViewRow row = dataGridViewAllOrders.Rows[rowId]; row.Cells["OrderId1"].Value = order.Id; row.Cells["BookISBN1"].Value = order.Book_ISBN; row.Cells["Title1"].Value = order.Title; row.Cells["Amount1"].Value = order.Amount; row.Cells["TotalPrice1"].Value = order.Total_Price; row.Cells["OrderDate1"].Value = order.Order_Date; row.Cells["OrderStatus1"].Value = order.Status; } }