示例#1
0
        public bool ThemSach(ref string err, string MaSach, string TenSach, string MaTheLoai,
                             string MaNXB, float GiaBan, int SoLuongTon, int TinhTrang)
        {
            try
            {
                var s = new Sach
                {
                    MaSach     = MaSach,
                    TenSach    = TenSach,
                    MaTheLoai  = MaTheLoai,
                    MaNXB      = MaNXB,
                    GiaBan     = GiaBan,
                    SoLuongTon = SoLuongTon,
                    TinhTrang  = TinhTrang == 1 ? true : false
                };

                db.Saches.Add(s);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#2
0
        public bool ThemNhanVien(ref string err, string MaNV, string HoNV, string TenNV, DateTime NgaySinh, int Nu, DateTime NgayNV, string DiaChi, string SoDT,
                                 float Luong, int TinhTrang)
        {
            try
            {
                var nv = new NhanVien
                {
                    MaNV      = MaNV,
                    HoNV      = HoNV,
                    TenNV     = TenNV,
                    NgaySinh  = NgaySinh,
                    Nu        = Nu == 1 ? true : false,
                    NgayNV    = NgayNV,
                    DiaChi    = DiaChi,
                    SoDT      = SoDT,
                    Luong     = Luong,
                    TinhTrang = TinhTrang == 1 ? true : false
                };

                db.NhanViens.Add(nv);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#3
0
        public bool ThemNXB(ref string err, string MaNXB, string TenNXB, int TinhTrang)
        {
            try
            {
                var nxb = new NXB
                {
                    MaNXB     = MaNXB,
                    TenNXB    = TenNXB,
                    TinhTrang = TinhTrang == 1 ? true : false
                };

                db.NXBs.Add(nxb);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#4
0
        public bool ThemTheLoai(ref string err, string MaTheLoai, string TenTheLoai, int TinhTrang)
        {
            try
            {
                var tl = new TheLoai
                {
                    MaTheLoai  = MaTheLoai,
                    TenTheLoai = TenTheLoai,
                    TinhTrang  = TinhTrang == 1 ? true : false
                };

                db.TheLoais.Add(tl);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#5
0
        public bool ThemTaiKhoan(ref string err, string MaNV, string MatKhau, int Quyen)
        {
            try
            {
                var tk = new TaiKhoan
                {
                    MaNV    = MaNV,
                    MatKhau = MatKhau,
                    Quyen   = Quyen == 1 ? true : false
                };

                db.TaiKhoans.Add(tk);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#6
0
        public bool ThemNhaCC(ref string err, string MaNCC, string TenNCC, string DiaChi, string SDT, int TinhTrang)
        {
            try
            {
                var ncc = new NhaCC
                {
                    MaNCC     = MaNCC,
                    TenNCC    = TenNCC,
                    DiaChi    = DiaChi,
                    SDT       = SDT,
                    TinhTrang = TinhTrang == 1 ? true : false
                };

                db.NhaCCs.Add(ncc);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#7
0
        public bool ThemHoaDonBan(ref string err, string MaHDB, string MaNV, string HoTenKH, DateTime NgayLapHD)
        {
            try
            {
                var hdb = new HoaDonBan
                {
                    MaHDB     = MaHDB,
                    MaNV      = MaNV,
                    HoTenKH   = HoTenKH,
                    NgayLapHD = NgayLapHD
                };

                db.HoaDonBans.Add(hdb);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }
示例#8
0
        public bool ThemHoaDonNhap(ref string err, string MaHDN, string MaNCC, string MaNV, DateTime NgayLap)
        {
            try
            {
                var hdn = new HoaDonNhap
                {
                    MaHDN   = MaHDN,
                    MaNCC   = MaNCC,
                    MaNV    = MaNV,
                    NgayLap = NgayLap
                };

                db.HoaDonNhaps.Add(hdn);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                return(false);
            }
        }