예제 #1
0
        //public static void loadComboBanTheoTrangThai(ComboBox cbbNhom, bool isTrong)
        //{
        //    cbbNhom.DataSource = LoadBanTheoTrangThai(isTrong);
        //    cbbNhom.DisplayMember = "MaBan";
        //    cbbNhom.ValueMember = "MaBan";
        //}
        //public static List<Ban> LoadBanTheoTrangThai(bool isTrong) {
        //    using (var db = new TanHongPhatDataContext()) {
        //        var bs = db.Ban.Where(b=>b.Trong == isTrong).ToList();
        //        return bs;
        //    }
        //}
        internal static int themVaoPhieuNhap(FrmBanHang f, SanPham h)
        {
            var li = f.hoaDon.ChiTietHoaDon;
            var c1 = li.FirstOrDefault(c => c.MaSanPham.ToString() == h.MaSanPham.ToString());
            if (c1 == null)
            {
                int soLuong = Convert.ToInt32(f.spnSoLuong.Value);
                int donGia = h.Gia;
                ChiTietHoaDon c = new ChiTietHoaDon()
                {
                    SanPham = h,
                    MaSanPham = h.MaSanPham,
                    Gia = donGia,
                    SoLuong = soLuong
                };
                f.hoaDon.ChiTietHoaDon.Add(c);
                loadGridHoaDon(f);
                return 1;
            }

            return 0;
        }
예제 #2
0
 private static void loadGridHoaDon(FrmBanHang f)
 {
     //var pn = f.hoaDon;
     //f.lvHangNhap.Items.Clear();
     //foreach (ChiTietHoaDon c in pn.ChiTietHoaDon)
     //{
     //    string[] s = { c.MaHang.ToString(), c.HangBan.Hang.TenHang, TienIch.formatThousand(c.SoLuong), TienIch.formatThousand(c.DonGia), TienIch.formatThousand(c.SoLuong * c.DonGia) };
     //    ListViewItem i = new ListViewItem(s);
     //    f.lvHangNhap.Items.Add(i);
     //}
 }