예제 #1
0
 private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         var localOrders         = (Orders)lvHistoryAdmin.SelectedItems[0].Tag;
         List <OrderDetail> list = OrderDetailBus.GetAllOrderDetailByIdOrder(localOrders.Id);
         lvHistoryDetail.Items.Clear();
         foreach (var item in list)
         {
             Products product = ProductsBus.GetProductsById(item.IdProducts);
             var      row     = new string[] { item.Id.ToString(), product.Name, item.Quanity.ToString(), string.Format("{0:#,##0.00}", item.TotalPrice) };
             var      lvi     = new ListViewItem(row);
             lvi.Tag = item;
             lvHistoryDetail.Items.Add(lvi);
         }
     }
     catch (Exception)
     {
     }
 }
 public void loadData()
 {
     try
     {
         List <OrderDetail> list = OrderDetailBus.GetAllOrderDetailByIdOrder(OrdersBus.GetIdOrder());
         listViewBill.Items.Clear();
         foreach (var item in list)
         {
             Products product = ProductsBus.GetProductsById(item.IdProducts);
             var      row     = new string[] { product.Name, string.Format("{0:#,##0}", product.Price), item.Quanity.ToString(), string.Format("{0:#,##0}", item.TotalPrice) };
             var      lvi     = new ListViewItem(row);
             lvi.Tag = item;
             listViewBill.Items.Add(lvi);
         }
         Orders orders = OrdersBus.getOrderById(OrdersBus.GetIdOrder());
         lbSales.Text = orders.Sales.ToString() + "  %";
         lbTotal.Text = string.Format("{0:#,##0}", orders.TotalPrice) + " VNĐ";
         lbdate.Text  = orders.Date.ToString();
     }
     catch (Exception)
     {
     }
 }