예제 #1
0
        void chk_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox chk = sender as CheckBox;

            if (chk.Checked == true)
            {
                frmSoLuong frm = new frmSoLuong();
                frm.ShowDialog();
                if (ThayDoi == true)
                {
                    var    SP = context.SanPhams.FirstOrDefault(x => x.MaSP == chk.Tag);
                    string ma = SP.MaSP;
                    HienThiDanhSach(ma, frm);
                }
            }
        }
예제 #2
0
        private void HienThiDanhSach(string ma, frmSoLuong frm)
        {
            soluong++;

            int sl = int.Parse(frm.txtSoLuong.Text);

            SanPham      sp        = context.SanPhams.FirstOrDefault(x => x.MaSP == ma);
            ListViewItem lvi       = new ListViewItem((soluong) + "");
            int?         thanhtien = sp.DonGia * sl;

            lvi.SubItems.Add(sp.TenSP);
            lvi.SubItems.Add(sp.DvTinh);
            lvi.SubItems.Add(sl + "");
            lvi.SubItems.Add(sp.DonGia + "");
            lvi.SubItems.Add(thanhtien + "");
            lsvDanhSach.Items.Add(lvi);
        }