Exemple #1
0
        private void threadDetail_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            List <DetailModel> lstDetail = new List <DetailModel>();

            foreach (var item in detail)
            {
                DetailModel       model = new DetailModel();
                ProductSV.Product p     = productService.findById(item.ProductId);
                model.SanPham   = p.Name;
                model.SoLuong   = item.Quantity.Value;
                model.DonGia    = p.Price.Value;
                model.GiaGiam   = p.PromotionPrice.HasValue ? p.PromotionPrice.Value : 0;
                model.Thanhtien = p.PromotionPrice.HasValue ?
                                  item.Quantity.Value * p.PromotionPrice.Value : item.Quantity.Value * p.Price.Value;
                lstDetail.Add(model);
            }
            gvDetail.DataSource = lstDetail;
        }
 private void threadDetail_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     List<DetailModel> lstDetail = new List<DetailModel>();
     foreach (var item in detail)
     {
         DetailModel model = new DetailModel();
         ProductSV.Product p = productService.findById(item.ProductId);
         model.SanPham = p.Name;
         model.SoLuong = item.Quantity.Value;
         model.DonGia = p.Price.Value;
         model.GiaGiam = p.PromotionPrice.HasValue ? p.PromotionPrice.Value : 0;
         model.Thanhtien = p.PromotionPrice.HasValue ?
             item.Quantity.Value * p.PromotionPrice.Value : item.Quantity.Value * p.Price.Value;
         lstDetail.Add(model);
     }
     gvDetail.DataSource = lstDetail;
 }