public void XoaSanPham(int ma)
        {
            SAN_PHAM s = data.SAN_PHAMs.Where(t => t.MaSP == ma).FirstOrDefault();

            data.SAN_PHAMs.DeleteOnSubmit(s);
            data.SubmitChanges();
        }
        public long GetGiaTheoMaSP(int ma)
        {
            SAN_PHAM sp = data.SAN_PHAMs.Where(t => t.MaSP == ma).FirstOrDefault();

            if (sp != null)
            {
                return(Convert.ToInt64(sp.GiaBan));
            }
            return(0);
        }
        public void ThemSanPham(string ten, string loaiSP, long giaBan, long giaVon, int sl, string dvt, bool trangThai, string hinh)
        {
            SAN_PHAM s = new SAN_PHAM();

            s.TenSP     = ten;
            s.MaLoaiSP  = loaiSP;
            s.GiaBan    = giaBan;
            s.GiaVon    = giaVon;
            s.HinhAnh   = hinh;
            s.SoLuong   = sl;
            s.DonViTinh = dvt;
            s.TrangThai = trangThai;
            data.SAN_PHAMs.InsertOnSubmit(s);
            data.SubmitChanges();
        }
        public void SuaSanPham(int ma, string ten, string loaiSP, long giaBan, long giaVon, int sl, string dvt, bool trangThai, string hinh)
        {
            SAN_PHAM s = data.SAN_PHAMs.Where(t => t.MaSP == ma).FirstOrDefault();

            s.TenSP    = ten;
            s.MaLoaiSP = loaiSP;
            s.GiaBan   = giaBan;
            //s.GiaNhapCuoi = giaNhapCuoi;
            s.GiaVon  = giaVon;
            s.HinhAnh = hinh;
            //s.MucTon = 10;
            s.SoLuong   = sl;
            s.DonViTinh = dvt;
            s.TrangThai = trangThai;
            data.SubmitChanges();
        }
        public bool KiemTraKhoaChinh(int ma)
        {
            SAN_PHAM s = data.SAN_PHAMs.Where(t => t.MaSP == ma).FirstOrDefault();

            return(s != null);
        }