Beispiel #1
0
 public bool DeleteSanPham(SanPham sanPham)
 {
     try
     {
         var db = new QuanLyCuaHangEntities();
         db.SanPhams.Remove(sanPham);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Beispiel #2
0
 public bool AddLoaiSanPham(LoaiSanPham loaiSanPham)
 {
     try
     {
         var db = new QuanLyCuaHangEntities();
         db.LoaiSanPhams.Add(loaiSanPham);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Beispiel #3
0
 public bool AddDonHang(DonHang donHang)
 {
     try
     {
         var db = new QuanLyCuaHangEntities();
         db.DonHangs.Add(donHang);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Beispiel #4
0
 public bool AddKhachHang(KhachHang khachHang)
 {
     try
     {
         var db = new QuanLyCuaHangEntities();
         db.KhachHangs.Add(khachHang);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Beispiel #5
0
 public bool AddKhuyenMai(KhuyenMai khuyenMai)
 {
     try
     {
         var db = new QuanLyCuaHangEntities();
         db.KhuyenMais.Add(khuyenMai);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Beispiel #6
0
        public bool EditDonHang(DonHang donHang)
        {
            try
            {
                var db = new QuanLyCuaHangEntities();

                var donHang1 = db.DonHangs.Find(donHang.MaDongHang, donHang.MaSanPham);

                donHang1.TinhTrang = donHang.TinhTrang;
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }
 private void ThemKM_Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var           db            = new QuanLyCuaHangEntities();
         KhuyenMai_Bus khuyenMai_Bus = new KhuyenMai_Bus();
         KhuyenMai     km            = new KhuyenMai();
         km.MaKhuyenMai  = MaKM_TextBox.Text;
         km.TenKhuyenMai = TenKM_TextBox.Text;
         km.MucKhuyenMai = int.Parse(MucKM_TextBox.Text);
         khuyenMai_Bus.AddKhuyenMai(km);
         db.SaveChanges();
         MessageBox.Show("Thêm mã khuyến mãi thành công!");
         MaKM_TextBox.Text  = "";
         TenKM_TextBox.Text = "";
         MucKM_TextBox.Text = "";
     }
     catch (Exception)
     {
         MessageBox.Show("Thêm không thành công vui lòng kiểm tra lại");
     }
     DanhSachKMDataGrid_Loaded(null, null);
 }
Beispiel #8
0
        public bool EditSanPham(SanPham sanPham)
        {
            try
            {
                var db = new QuanLyCuaHangEntities();

                var sanPham1 = db.SanPhams.Find(sanPham.MaSanPham);
                sanPham1.GiaBan  = sanPham.GiaBan;
                sanPham1.GiaGoc  = sanPham.GiaGoc;
                sanPham1.HinhAnh = sanPham.HinhAnh;

                sanPham1.MaLoaiSanPham = sanPham.MaLoaiSanPham;
                sanPham1.SoLuongConLai = sanPham.SoLuongConLai;
                sanPham1.TenSanPham    = sanPham.TenSanPham;
                sanPham1.isDelete      = sanPham.isDelete;
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
            }
            return(false);
        }