Exemple #1
0
        public void hienThiBan(String ban)
        {
            try{
                HoaDon hoadon = bus_hoaDon.layHoaDonTheoMaBan(ban);
                List <ChiTietHoaDon> chitiet = bus_hoaDon.layChiTietHoaDon(hoadon.MaHoaDon);
                listhienthihoadon.Clear();

                //gridSelectMenu.DataSource = chitiet;
                myListHoaDon = chitiet;

                for (int i = 0; i <= myListHoaDon.Count - 1; i++)
                {
                    String tenSanpham = bus_sanPham.laySanPhanTheoMa(myListHoaDon[i].MaSanPham).TenSanPham;
                    float  gia        = (float)bus_sanPham.laySanPhanTheoMa(myListHoaDon[i].MaSanPham).GiaSanPham;

                    int   soLuong   = (int)bus_chiTietHoaDon.laySanPhanTheoMa(myListHoaDon[i].MaChiTietHoaDon).SoLuong;
                    float thanhTien = (float)(soLuong * gia);
                    listhienthihoadon.Add(new LISTHOADON(tenSanpham, gia, soLuong, thanhTien));
                }
                hienthitest(listhienthihoadon);
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            String  maSanpham = gridSanPham.CurrentRow.Cells[0].Value.ToString();
            SanPham sanPham   = bus_sanPham.laySanPhanTheoMa(maSanpham);

            sanPham.TenSanPham  = txtTenSanPham.Text;
            sanPham.LoaiSanPham = txtLoaiSanPham.Text;

            sanPham.GiaSanPham = float.Parse(txtGiaSanPham.Text);
            sanPham.DuongDan   = txt_duongDan.Text;

            bus_sanPham.capNhatSanPham(sanPham);
            gridSanPham.DataSource = bus_sanPham.laySanPham();

            MetroMessageBox.Show(this, "Câp Nhật Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }