示例#1
0
 public bool InsertHoaDon(string maHoaDon, string maKH, DateTime?ngayLap, decimal?tienHang,
                          decimal?giamGia, decimal?thue, decimal?tongTien, string nhanVien)
 {
     try
     {
         HoaDon hoadon = new HoaDon
         {
             MaHoaDon = maHoaDon,
             MaKH     = maKH,
             NgayLap  = ngayLap,
             TienHang = tienHang,
             GiamGia  = giamGia,
             Thue     = thue,
             TongTien = tongTien,
             NhanVien = nhanVien
         };
         context.HoaDon.Add(hoadon);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#2
0
 public bool InsertLoaiKH(string maLoaiKH, string tenLoaiKH, int chietKhau)
 {
     try
     {
         LoaiKH lkh = new LoaiKH
         {
             MaLoaiKH  = maLoaiKH,
             TenLoaiKH = tenLoaiKH,
             ChietKhau = chietKhau
         };
         context.LoaiKHs.Add(lkh);
         context.SaveChanges();
         return(true);
     }
     catch { return(false); }
 }
 public bool InsertNhaCC(string maNCC, string tenNCC, string diaChi, string sdt)
 {
     try
     {
         NhaCungCap ncc = new NhaCungCap
         {
             MaNCC  = maNCC,
             TenNCC = tenNCC,
             DiaChi = diaChi,
             SDT    = sdt,
         };
         context.NhaCungCaps.Add(ncc);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#4
0
 public bool InsertHopDong(string soHopDong, string maNCC, DateTime?ngayKy, DateTime?thoiHanHopDong)
 {
     try
     {
         HopDong hd = new HopDong
         {
             SoHopDong      = soHopDong,
             MaNCC          = maNCC,
             NgayKy         = ngayKy,
             ThoiHanHopDong = thoiHanHopDong
         };
         context.HopDong.Add(hd);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#5
0
 public bool InsertCTHopDong(ref string err, string soHopDong, string maSP, int soLuong, decimal?donGia)
 {
     try
     {
         ChiTietHopDong cthd = new ChiTietHopDong
         {
             SoHopDong = soHopDong,
             MaSP      = maSP,
             SoLuong   = soLuong,
             DonGia    = donGia,
         };
         context.ChiTietHopDong.Add(cthd);
         context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         err = e.Message;
         return(false);
     }
 }
 public bool InsertCTHoaDon(ref string err, string maHoaDon, string maSP, int soLuong, decimal?donGia, int ck)
 {
     try
     {
         ChiTietHoaDon cthd = new ChiTietHoaDon {
             MaHoaDon  = maHoaDon,
             MaSP      = maSP,
             SoLuong   = soLuong,
             DonGia    = donGia,
             ChietKhau = ck
         };
         context.ChiTietHoaDon.Add(cthd);
         context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         err = e.Message;
         return(false);
     }
 }
示例#7
0
 public bool InsertProduct(string maSP, string tenSP, int?soLuong, decimal?giaMua, decimal?giaban, string donViTinh)
 {
     try
     {
         SanPham sp = new SanPham
         {
             MaSP      = maSP,
             TenSP     = tenSP,
             SoLuong   = soLuong,
             GiaBan    = giaban,
             GiaMua    = giaMua,
             DonViTinh = donViTinh
         };
         context.SanPhams.Add(sp);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#8
0
 public bool InsertCustomer(string maKH, string tenKH, DateTime?ngaySinh, string gioiTinh, string diaChi, string sdt, string maLoaiKH)
 {
     try
     {
         KhachHang kh = new KhachHang
         {
             MaKH     = maKH,
             TenKH    = tenKH,
             NgaySinh = ngaySinh,
             GioiTinh = gioiTinh,
             DiaChi   = diaChi,
             SDT      = sdt,
             MaLoaiKH = maLoaiKH
         };
         context.KhachHang.Add(kh);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#9
0
 public bool InsertEmployee(string maNV, string tenNV, DateTime?ngaySinh, string sdt, string diaChi, string gioiTinh, decimal?luong)
 {
     try
     {
         NhanVien nv = new NhanVien
         {
             MaNV     = maNV,
             HoTenNV  = tenNV,
             NgaySinh = ngaySinh,
             SDT      = sdt,
             DiaChi   = diaChi,
             GioiTinh = gioiTinh,
             Luong    = luong
         };
         context.NhanViens.Add(nv);
         context.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#10
0
 public bool ChangePassword(ref string err, string user, string newPass)
 {
     try
     {
         TaiKhoan tk = context.TaiKhoans.Single(s => s.TenDangNhap.Equals(user));
         tk.MatKhau = newPass;
         context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         err = e.Message;
         return(false);
     }
 }