public bool AddKH(Entities.KhachHang.KhachHang kh)
        {
            try
            {
                Tbl_KhachHang newKHRecord = DB.Tbl_KhachHangs.Where(x => x.maKH == kh.Makh).FirstOrDefault();
                if (newKHRecord != null)
                {
                    return(0);///trường hợp trùng
                }
                newKHRecord             = new Tbl_KhachHang();
                newKHRecord.maKH        = kh.Makh;
                newKHRecord.tenKH       = kh.Tenkh;
                newKHRecord.diachi      = kh.Diachi;
                newKHRecord.soCMND      = kh.Socmnd;
                newKHRecord.sodienthoai = kh.Sodienthoai;
                newKHRecord.gioitinh    = kh.Gioitinh;
                newKHRecord.ngaycapCMND = kh.Ngaycapcmnd;
                newKHRecord.nghenghiep  = kh.Nghenghiep;
                newKHRecord.ngaysinh    = kh.Ngaysinh;
                newKHRecord.trangthai   = kh.Trangthai;
                newKHRecord.email       = kh.Email;
                DB.SubmitChanges();

                return(true);
            }
            catch { return(false); }
        }
        public int AddKH(eKhachHang kh)
        {
            var makhachhang = DB.Tbl_KhachHangs.Where(x => x.maKH == kh.Makh).FirstOrDefault();

            if (makhachhang != null)
            {
                return(0);
            }
            Tbl_KhachHang khTmp = new Tbl_KhachHang();

            khTmp.maKH        = kh.Makh;
            khTmp.tenKH       = kh.Tenkh;
            khTmp.diachi      = kh.Diachi;
            khTmp.soCMND      = kh.Socmnd;
            khTmp.sodienthoai = kh.Sodienthoai;
            khTmp.gioitinh    = kh.Gioitinh;
            khTmp.ngaycapCMND = kh.Ngaycapcmnd;
            khTmp.nghenghiep  = kh.Nghenghiep;
            khTmp.ngaysinh    = kh.Ngaysinh;
            khTmp.trangthai   = kh.Trangthai;
            khTmp.email       = kh.Email;

            DB.Tbl_KhachHangs.InsertOnSubmit(khTmp);
            DB.SubmitChanges();
            return(1);
        }
예제 #3
0
        public int themhoadon(eHDBanSi hdbs)
        {
            if (kiemtra(hdbs.maHD))
            {
                return(0);
            }
            Tbl_HDBanSi n = new Tbl_HDBanSi();

            n.maHD    = hdbs.maHD;
            n.maKH    = hdbs.maKH;
            n.maNV    = hdbs.maNV;
            n.ngayLap = Convert.ToDateTime(hdbs.ngayLap);
            n.ghiChu  = hdbs.ghiChu;
            db.Tbl_HDBanSis.InsertOnSubmit(n);
            db.SubmitChanges();
            //Tbl_CTHDBanSi si = new Tbl_CTHDBanSi();
            //si.maHD = ctbs.maHD;
            //si.maSP = si.maSP;
            //si.soluong = ctbs.soluong;
            //si.ghiChu = ctbs.ghiChu;
            //si.dongiaBan =Convert.ToInt16(ctbs.dongiaBan);
            //db.Tbl_CTHDBanSis.InsertOnSubmit(si);
            //db.SubmitChanges();
            return(1);
        }
예제 #4
0
        public bool Add(DaoTao newDT)
        {
            try
            {
                Tbl_DaoTaoNV newRecord = MyConvert.toTbl_DaoTao(newDT);

                DB.Tbl_DaoTaoNVs.InsertOnSubmit(newRecord);
                DB.SubmitChanges();

                return(true);
            }
            catch { return(false); }
        }
예제 #5
0
        public bool Add(NhanVien newNV)
        {
            try
            {
                Tbl_NhanVien newRecord = MyConvert.ToTbl_NhanVien(newNV);

                DB.Tbl_NhanViens.InsertOnSubmit(newRecord);
                DB.SubmitChanges();

                return(true);
            }
            catch { return(false); }
        }
예제 #6
0
        public bool Add(ChucVu newCV)
        {
            try
            {
                Tbl_ChucVu newRecord = MyConvert.toTbl_ChucVu(newCV);
                DB.Tbl_ChucVus.InsertOnSubmit(newRecord);
                DB.SubmitChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool Add(KyLuat newKL)
        {
            try
            {
                Tbl_KyLuatNV newRecord = MyConvert.toTbl_KyLuat(newKL);
                DB.Tbl_KyLuatNVs.InsertOnSubmit(newRecord);
                DB.SubmitChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #8
0
        public bool Add(PhongBan newPB)
        {
            try
            {
                Tbl_PhongBan newRecord = MyConvert.toTbl_PhongBan(newPB);
                DB.Tbl_PhongBans.InsertOnSubmit(newRecord);
                DB.SubmitChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public int ThemPQ(string id, string pq)
        {
            try
            {
                var tmp = db.Tbl_Users.Where(x => x.ID == id).Single();
                tmp.Phanquyen = pq;
                db.SubmitChanges();


                return(1);
            }
            catch
            {
                return(0);
            }
        }
예제 #10
0
        public int AddAllPhieuQLK(ePhieuQLiKho newpqlk)
        {
            if (Kiemtrasutontai(newpqlk._maPhieuQli))
            {
                return(0);
            }
            Tbl_PhieuQLKho pqlk = new Tbl_PhieuQLKho();

            pqlk.maPhieuQL = newpqlk._maPhieuQli;
            pqlk.ngayLapQL = newpqlk._ngayLapQLi;
            pqlk.maNV      = newpqlk._maNV;
            pqlk.tinhTrang = newpqlk._tinhTrang;
            pqlk.msKho     = newpqlk._maKho;
            DB.Tbl_PhieuQLKhos.InsertOnSubmit(pqlk);
            DB.SubmitChanges();
            return(1);
        }
예제 #11
0
        public int ThemPhieuXuatKho(ePhieuXK newpxk)
        {
            if (Kiemtrasutontai(newpxk._maPhieuXuat))
            {
                return(0);
            }
            Tbl_PhieuXK pxkTmp = new Tbl_PhieuXK();

            pxkTmp.maPhieuXuat = newpxk._maPhieuXuat;
            pxkTmp.ngayLapXuat = newpxk._ngayLapXuat;
            pxkTmp.maNV        = newpxk._maNV;
            pxkTmp.maKho       = newpxk._maKho;
            pxkTmp.tinhTrang   = newpxk._tinhTrang;
            DB.Tbl_PhieuXKs.InsertOnSubmit(pxkTmp);
            DB.SubmitChanges();
            return(1);
        }
예제 #12
0
        public int ThemPhieuNhapKho(ePhieuNK newpnk)
        {
            if (Kiemtrasutontai(newpnk._maPhieuNhap))
            {
                return(0);
            }
            Tbl_PhieuNK pnkTmp = new Tbl_PhieuNK();

            pnkTmp.maPhieuNhap = newpnk._maPhieuNhap;
            pnkTmp.ngayLapNhap = newpnk._ngayLapNhap;
            pnkTmp.maNV        = newpnk._maNV;
            pnkTmp.msKho       = newpnk._msKho;
            pnkTmp.tinhTrang   = newpnk._tinhTrang;
            DB.Tbl_PhieuNKs.InsertOnSubmit(pnkTmp);
            DB.SubmitChanges();
            return(1);
        }
 public bool AddAllPhieuNK(ePhieuXK newpxk)
 {
     try
     {
         Tbl_PhieuXK pxk = DB.Tbl_PhieuXKs.Single(x => x.maPhieuXuat == newpxk._maPhieuXuat);
         pxk.maPhieuXuat = newpxk._maPhieuXuat;
         pxk.ngayLapXuat = Convert.ToDateTime(newpxk._ngayLapXuat);
         pxk.maNV        = newpxk._maNV;
         pxk.tinhTrang   = newpxk._tinhTrang;
         DB.Tbl_PhieuXKs.InsertOnSubmit(pxk);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #14
0
        public int themhd(eHDMuaHangNCC hdmh)
        {
            if (kiemtra(hdmh.maHD))
            {
                return(0);
            }
            Tbl_HDMuaHangNCC n = new Tbl_HDMuaHangNCC();

            n.maHD    = hdmh.maHD;
            n.tenHD   = hdmh.tenHD;
            n.maNCC   = hdmh.maNCC;
            n.maNV    = hdmh.maNV;
            n.ngayLap = Convert.ToDateTime(hdmh.ngayLap);
            n.noiDung = hdmh.noidung;
            db.Tbl_HDMuaHangNCCs.InsertOnSubmit(n);
            db.SubmitChanges();
            return(1);
        }
예제 #15
0
 public bool Add(CTThamGiaDTNV newCTTGDT)
 {
     try
     {
         Tbl_CTThamGiaDTNV newRecord = DB.Tbl_CTThamGiaDTNVs.Single(record => record.maNV == newCTTGDT.MaNV && record.maKhoaDT == newCTTGDT.MaKhoaDT);
         newRecord.maNV     = newCTTGDT.MaNV;
         newRecord.maKhoaDT = newCTTGDT.MaKhoaDT;
         newRecord.nhanXet  = newCTTGDT.NhanXet;
         newRecord.ketQua   = newCTTGDT.KetQua;
         DB.Tbl_CTThamGiaDTNVs.InsertOnSubmit(newRecord);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public int themPDNXK(ePhieuDNXK PDNXK)
        {
            var tPDNXK = db.Tbl_PhieuDNXKs.Where(x => x.soPDNNK == PDNXK.soPDNXK).FirstOrDefault();

            if (tPDNXK != null)
            {
                return(0);
            }
            Tbl_PhieuDNXK p = new Tbl_PhieuDNXK();

            p.soPDNNK = PDNXK.soPDNXK;
            p.maNV    = PDNXK.maNV;
            p.ngayLap = Convert.ToDateTime(PDNXK.ngayLap);
            p.maKho   = PDNXK.maKho;
            db.Tbl_PhieuDNXKs.InsertOnSubmit(p);
            db.SubmitChanges();
            return(1);
        }
 public bool AddAllPhieuQLK(ePhieuQLiKho newpqlk)
 {
     try
     {
         Tbl_PhieuQLKho pqlk = DB.Tbl_PhieuQLKhos.Single(x => x.maPhieuQL == newpqlk._maPhieuQli);
         pqlk.maPhieuQL = newpqlk._maPhieuQli;
         pqlk.ngayLapQL = Convert.ToDateTime(newpqlk._ngayLapQLi);
         pqlk.maNV      = newpqlk._maNV;
         pqlk.tinhTrang = newpqlk._tinhTrang;
         DB.Tbl_PhieuQLKhos.InsertOnSubmit(pqlk);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #18
0
 public bool AddAllPhieuNK(ePhieuNK newpnk)
 {
     try
     {
         Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == newpnk._maPhieuNhap);
         pnk.maPhieuNhap = newpnk._maPhieuNhap;
         pnk.ngayLapNhap = Convert.ToDateTime(newpnk._ngayLapNhap);
         pnk.maNV        = newpnk._maNV;
         pnk.msKho       = newpnk._msKho;
         pnk.tinhTrang   = newpnk._tinhTrang;
         DB.Tbl_PhieuNKs.InsertOnSubmit(pnk);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #19
0
        public int themNCC(eNhaCungCap ncc)
        {
            var nccap = db.Tbl_NhaCungCaps.Where(x => x.maNCC == ncc.maNCC).FirstOrDefault();

            if (nccap != null)
            {
                return(0);
            }
            Tbl_NhaCungCap p = new Tbl_NhaCungCap();

            p.maNCC  = ncc.maNCC;
            p.tenNCC = ncc.tenNCC;
            p.diaChi = ncc.diaChi;
            p.sDT    = ncc.sDT;
            p.email  = ncc.email;
            db.Tbl_NhaCungCaps.InsertOnSubmit(p);
            db.SubmitChanges();
            return(1);
        }
예제 #20
0
        public int themKM(eKhuyenMai km)
        {
            var tkm = db.Tbl_KhuyenMais.Where(x => x.msDotKM == km.msDotKM).FirstOrDefault();

            if (tkm != null)
            {
                return(0);
            }
            Tbl_KhuyenMai p = new Tbl_KhuyenMai();

            p.msDotKM  = km.msDotKM;
            p.tenDotKM = km.tenDotKM;
            p.ngayBD   = km.ngayBD;
            p.ngayKT   = km.ngayKT;
            p.ghiChu   = km.ghiChu;
            db.Tbl_KhuyenMais.InsertOnSubmit(p);
            db.SubmitChanges();
            return(1);
        }
예제 #21
0
 public bool Add(LichSuLamViec newLSLV)
 {
     try
     {
         Tbl_LichSuLamViec newRecord = DB.Tbl_LichSuLamViecs.Single(record => record.maNV == newLSLV.MaNV && record.maChucVu == newLSLV.MaChucVu && record.maPB == newLSLV.MaPB);
         newRecord.maNV     = newLSLV.MaNV;
         newRecord.maPB     = newLSLV.MaPB;
         newRecord.maChucVu = newLSLV.MaChucVu;
         newRecord.ngayBD   = newLSLV.NgayBD;
         newRecord.ngayKT   = newLSLV.NgayKT;
         DB.Tbl_LichSuLamViecs.InsertOnSubmit(newRecord);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #22
0
 public bool AddAllCTPQLKho(eCTQLKho newctpqlk)
 {
     try
     {
         Tbl_CTPhieuQLKho ctpqlk = DB.Tbl_CTPhieuQLKhos.Single(x => x.maPhieuql == newctpqlk._maPhieuQL && x.maSP == newctpqlk._masp);
         ctpqlk.maPhieuql = newctpqlk._maPhieuQL;
         ctpqlk.maSP      = newctpqlk._masp;
         ctpqlk.sTT       = newctpqlk._sott;
         ctpqlk.tenSP     = newctpqlk._tensp;
         ctpqlk.sLuongql  = newctpqlk._soluongql;
         ctpqlk.donVi     = newctpqlk._donvi;
         DB.Tbl_CTPhieuQLKhos.InsertOnSubmit(ctpqlk);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public int ThemHDBanLe(HoaDonBanLe hdbl)
        {
            var hdbanle = DB.Tbl_HDBanLes.Where(x => x.soHoaDon == hdbl.SoHoaDon).FirstOrDefault();

            if (hdbanle != null)
            {
                return(0);
            }
            Tbl_HDBanLe hd = new Tbl_HDBanLe();

            hd.soHoaDon = hdbl.SoHoaDon;
            hd.maKH     = hdbl.MaKH;
            hd.maNV     = hdbl.MaNV;
            hd.ghiChu   = hdbl.GhiChu;
            hd.ngayBan  = hdbl.NgayBan;

            DB.Tbl_HDBanLes.InsertOnSubmit(hd);
            DB.SubmitChanges();
            return(1);
        }
        public int ThemCTHDBanLe(ChiTietHoaDonBanLe cthdbl)
        {
            var cthdbanle = DB.Tbl_CTHDBanLes.Where(x => x.soHoaDon == cthdbl.SoHoaDon).FirstOrDefault();

            if (cthdbanle != null)
            {
                return(0);
            }
            Tbl_CTHDBanLe hd = new Tbl_CTHDBanLe();

            hd.soHoaDon = cthdbl.SoHoaDon;
            hd.maSP     = cthdbl.MaSP;
            hd.ghiChu   = cthdbl.GhiChu;
            hd.soLuong  = cthdbl.SoLuong;
            hd.donGia   = cthdbl.DonGia;

            DB.Tbl_CTHDBanLes.InsertOnSubmit(hd);
            DB.SubmitChanges();
            return(1);
        }
        /* private eThethanhvien eThethanhvien()
         * {
         *   throw new NotImplementedException();
         * }*/



        public int AddThe(eThethanhvien the)
        {
            var mathe = DB.Tbl_TheThanhViens.Where(x => x.maThe == the.Makh).FirstOrDefault();

            if (mathe != null)
            {
                return(0);
            }
            Tbl_TheThanhVien khTmp = new Tbl_TheThanhVien();

            khTmp.maThe      = the.Mathe;
            khTmp.maKH       = the.Makh;
            khTmp.tongTien   = Convert.ToDecimal(the.Tongtien);
            khTmp.ngayHetHan = the.Ngayhethan;
            khTmp.ngayLap    = the.Ngaylap;
            khTmp.ghiChu     = the.Ghichu;

            DB.Tbl_TheThanhViens.InsertOnSubmit(khTmp);
            DB.SubmitChanges();
            return(1);
        }
        public int ThemSanPham(eSanPham newsp)
        {
            var masanpham = db.Tbl_SanPhams.Where(x => x.maSP == newsp.maSP).FirstOrDefault();

            if (masanpham != null)
            {
                return(0);
            }
            Tbl_SanPham spTmp = new Tbl_SanPham();

            spTmp.maSP      = newsp.maSP;
            spTmp.tenSP     = newsp.tenSP;
            spTmp.tenNhaPP  = newsp.tenNhaPP;
            spTmp.tenNhaSX  = newsp.tenNhaSX;
            spTmp.trangThai = newsp.trangthai;
            spTmp.ngaySX    = newsp.ngaySX;
            spTmp.moTa      = newsp.moTa;
            spTmp.hanSD     = newsp.hanSD;
            db.Tbl_SanPhams.InsertOnSubmit(spTmp);
            db.SubmitChanges();
            return(1);
        }
예제 #27
0
 public bool Add(CTKyLuatNV newCTKL)
 {
     try
     {
         Tbl_CTKyLuatNV newRecord = DB.Tbl_CTKyLuatNVs.Single(record => record.maNV == newCTKL.MaNV && record.maKyLuat == newCTKL.MaKyLuat);
         newRecord.maNV        = newCTKL.MaNV;
         newRecord.maKyLuat    = newCTKL.MaKyLuat;
         newRecord.ngayLap     = newCTKL.NgayLap;
         newRecord.ngayThiHanh = newCTKL.NgayThiHanh;
         newRecord.ngayKetThuc = newCTKL.NgayKetThuc;
         newRecord.mucDoKL     = newCTKL.MucDoKL;
         newRecord.lyDo        = newCTKL.LyDo;
         newRecord.ghiChu      = newCTKL.GhiChu;
         DB.Tbl_CTKyLuatNVs.InsertOnSubmit(newRecord);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #28
0
        public int ThemHDGTGT(HoaDonBanGTGT updategtgt)
        {
            var updategtgiatang = DB.Tbl_HD_GTGTs.Where(x => x.soHoaDon == Convert.ToString(updategtgt.SoHoaDon)).FirstOrDefault();

            if (updategtgiatang != null)
            {
                return(0);
            }
            Tbl_HD_GTGT update = new Tbl_HD_GTGT();

            update.soHoaDon          = updategtgt.SoHoaDon;
            update.dvBanHang         = updategtgt.DvBanHang;
            update.dvMuaHang         = updategtgt.DvMuaHang;
            update.diaChi            = updategtgt.DiaChi;
            update.hinhthucThanhToan = updategtgt.HinhThucThanhToan;
            update.soTaiKhoan        = updategtgt.SoTaiKhoan;
            update.msThue            = updategtgt.MsThue;
            update.ngaylapHoaDon     = updategtgt.NgaylapHoaDon;
            update.thanhTien         = updategtgt.ThanhTien;

            DB.Tbl_HD_GTGTs.InsertOnSubmit(update);
            DB.SubmitChanges();
            return(1);
        }
예제 #29
0
        public int them1nhom(eNhom nhom)
        {
            var tmp = db.Tbl_Nhoms.Where(x => x.IDNhom == nhom.IdNhom1).FirstOrDefault();

            if (tmp != null)
            {
                return(0);
            }

            Tbl_Nhom n = new Tbl_Nhom();

            n.IDNhom    = nhom.IdNhom1;
            n.TenNhom   = nhom.TenNhom1;
            n.Phanquyen = nhom.PhanQuyen1;
            db.Tbl_Nhoms.InsertOnSubmit(n);
            db.SubmitChanges();

            return(1);
        }