public static bool Add_GiaSP(Gia_SP gia_SP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.Gia_SP.Add(gia_SP); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_DanhMuc(DanhMuc danhMuc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.DanhMuc.Add(danhMuc); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_HangSX(Hang_SX hangSX) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.Hang_SX.Add(hangSX); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_NhanVien(NhanVien nhanVien) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.NhanVien.Add(nhanVien); entities.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public static bool Delete_SanPham(int maSP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { SanPham san_Pham = entities.SanPham.Where(p => p.ma_SP == maSP).FirstOrDefault(); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_KhachHang(KhachHang khachHang) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.KhachHang.Add(khachHang); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_NhanVien(int value) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.NhanVien.Remove(entities.NhanVien.Where(p => p.ma_NV == value).FirstOrDefault()); entities.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public static bool Add_HangSX(Loai_SP loaiSP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.Loai_SP.Add(loaiSP); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_SanPham(SanPham sanPham) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.SanPham.Add(sanPham); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Add_NhaCungCap(Nha_CungCap ncc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.Nha_CungCap.Add(ncc); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool ChangePass(NhanVien nhanVien) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { NhanVien nhanVien1 = entities.NhanVien.Where(p => p.ma_NV == nhanVien.ma_NV).FirstOrDefault(); nhanVien.mk_DangNhap = nhanVien.mk_DangNhap; entities.SaveChanges(); return(true); } } catch { return(false); } }
public static bool Update_HangSX(Hang_SX hangSX) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Hang_SX hangSx = entities.Hang_SX.Where(p => p.ma_Hang == hangSX.ma_Hang).FirstOrDefault(); hangSx.ten_Hang = hangSX.ten_Hang; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_DanhMuc(DanhMuc danh_Muc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { DanhMuc danhMuc = entities.DanhMuc.Where(p => p.ma_DM == danh_Muc.ma_DM).FirstOrDefault(); danhMuc.ten_DM = danh_Muc.ten_DM; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_LoaiSP(int maLoai) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Loai_SP loai_SP = entities.Loai_SP.Where(p => p.ma_Loai == maLoai).FirstOrDefault(); entities.Loai_SP.Remove(loai_SP); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_LoaiSP(Loai_SP loaiSP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Loai_SP loai_SP = entities.Loai_SP.Where(p => p.ma_Loai == loaiSP.ma_Loai).FirstOrDefault(); loai_SP.ten_Loai = loaiSP.ten_Loai; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_NhaCungCap(int ma_NCC) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Nha_CungCap nha_CungCap = entities.Nha_CungCap.Where(p => p.ma_NCC == ma_NCC).FirstOrDefault(); entities.Nha_CungCap.Remove(nha_CungCap); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_NhaCungCap(Nha_CungCap ncc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Nha_CungCap nha_CungCap = entities.Nha_CungCap.Where(p => p.ma_NCC == ncc.ma_NCC).FirstOrDefault(); nha_CungCap.ten_NCC = ncc.ten_NCC; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_HangSX(int ma_Hang) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Hang_SX hang_SX = entities.Hang_SX.Where(p => p.ma_Hang == ma_Hang).FirstOrDefault(); entities.Hang_SX.Remove(hang_SX); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_DanhMuc(int ma_DanhMuc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { DanhMuc danhMuc = entities.DanhMuc.Where(p => p.ma_DM == ma_DanhMuc).FirstOrDefault(); entities.DanhMuc.Remove(danhMuc); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_GiaSP(int maGiaSP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Gia_SP giaSP = entities.Gia_SP.Where(p => p.ma_GiaSP == maGiaSP).FirstOrDefault(); entities.Gia_SP.Remove(giaSP); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_KhachHang(int maKH) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { KhachHang khach_Hang = entities.KhachHang.Where(p => p.ma_KH == maKH).FirstOrDefault(); entities.KhachHang.Remove(khach_Hang); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_GiaSP(Gia_SP gia_SP) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Gia_SP giaSP = entities.Gia_SP.Where(p => p.ma_GiaSP == gia_SP.ma_GiaSP).FirstOrDefault(); giaSP.ngay_BDSP = gia_SP.ngay_BDSP; giaSP.gia_SP1 = gia_SP.gia_SP1; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_NhanVien(int manv, string gmail, string sdt, string pass) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { NhanVien nhanVien = entities.NhanVien.Where(p => p.ma_NV == manv).FirstOrDefault(); nhanVien.mail_NV = gmail; nhanVien.sdt_NV = sdt; nhanVien.mk_DangNhap = pass; entities.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public static bool Update_KhachHang(KhachHang khachHang) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { KhachHang khach_Hang = entities.KhachHang.Where(p => p.ma_KH == khachHang.ma_KH).FirstOrDefault(); khach_Hang.ten_HK = khachHang.ten_HK; khach_Hang.mail_KH = khachHang.mail_KH; khach_Hang.sdt_KH = khachHang.sdt_KH; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Edit_NhanVien(NhanVien nhanVien) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { NhanVien nhanVien1 = entities.NhanVien.Where(p => p.ma_NV == nhanVien.ma_NV).FirstOrDefault(); nhanVien1.ten_NV = nhanVien.ten_NV; nhanVien1.mail_NV = nhanVien.mail_NV; nhanVien1.sdt_NV = nhanVien.sdt_NV; entities.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public static bool Update_SanPham(SanPham sanPham) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { SanPham san_Pham = entities.SanPham.Where(p => p.ma_SP == sanPham.ma_SP).FirstOrDefault(); san_Pham.ten_SP = sanPham.ten_SP; san_Pham.ma_Loai = sanPham.ma_Loai; san_Pham.ma_Hang = sanPham.ma_Hang; san_Pham.ma_DM = sanPham.ma_DM; san_Pham.soluong_SP = sanPham.soluong_SP; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }