public bool themphieumuon(string maphieumuon, DateTime ngaymuon, DateTime hanngaytra, string manhanvien, string masach, string madocgia, string trangthai, ref string err) { string ktphieumuon = @"exec dbo.kiemtraphieumuon N'" + maphieumuon + "'"; string themphieumuon = @"exec dbo.themphieumuon N'" + maphieumuon + "'," + ngaymuon + "," + hanngaytra + ",N'" + manhanvien + "',N'" + masach + "',N'" + madocgia + "',N'" + trangthai + "'"; DataTable dt = db.ExecuteQueryDataTable(ktphieumuon, CommandType.Text); if (dt.Rows.Count > 0) { return(false); } else { return(db.MyExecuteNonQuery(themphieumuon, CommandType.Text, ref err)); } }
public bool themdocgia(string madocgia, string tendocgia, string gioitinh, string diachi, ref string err) { string ktdocgia = @"exec dbo.kiemtradocgia N'" + madocgia + "'"; string themdocgia = @"exec dbo.themdocgia N'" + madocgia + "',N'" + tendocgia + "',N'" + gioitinh + "',N'" + diachi + "'"; DataTable dt = db.ExecuteQueryDataTable(ktdocgia, CommandType.Text); if (dt.Rows.Count > 0) { MessageBox.Show("Da co ID nay roi", " Da Ton Tai"); return(false); } else { return(db.MyExecuteNonQuery(themdocgia, CommandType.Text, ref err)); } }
//public bool themnvn(string manv, string tk, string mk, string loai,string tennv,string diachi,string sex, ref string err) //{ // string ktnv = @"exec dbo.kiemtranv N'" + manv + "'"; // string themnv = @"exec dbo.themnv N'" + manv + "',N'" + tk + "',N'" +mk + "',N'" + loai + "',N'" + tennv + "',N'" + diachi + "',N'" + sex + "'"; // DataTable dt = db.ExecuteQueryDataTable(ktnv, CommandType.Text); // if (dt.Rows.Count == 0) // { // return db.MyExecuteNonQuery(themnv, CommandType.Text, ref err); // } // else return false; //} public bool themnvn(controllerNhanVien ctnhanvien, ref string err) { string ktnv = @"exec dbo.kiemtranv N'" + ctnhanvien.MaNhanVien + "'"; string themnv = @"exec dbo.themnv N'" + ctnhanvien.MaNhanVien + "',N'" + ctnhanvien.TaiKhoan + "',N'" + ctnhanvien.MatKhau + "',N'" + ctnhanvien.Loai + "',N'" + ctnhanvien.TenNhanVien + "',N'" + ctnhanvien.DiaChi + "',N'" + ctnhanvien.GioiTinh + "'"; DataTable dt = db.ExecuteQueryDataTable(ktnv, CommandType.Text); if (dt.Rows.Count > 0) { MessageBox.Show("Da co ID nay roi", " Da Ton Tai"); return(false); } else { return(db.MyExecuteNonQuery(themnv, CommandType.Text, ref err)); } }
public bool themsach(string masach, string tensach, string tenloaisach, int soluong, string make, ref string err) { string kiemtrasach = @"exec dbo.kiemtrasach N'" + masach + "'"; string themsach = @"exec dbo.themsach N'" + masach + "',N'" + tensach + "',N'" + tenloaisach + "',N'" + soluong + "',N'" + make + "'"; DataTable dt = db.ExecuteQueryDataTable(kiemtrasach, CommandType.Text); if (dt.Rows.Count > 0) { MessageBox.Show("Da co ID nay roi", " Da Ton Tai"); return(false); } else { return(db.MyExecuteNonQuery(themsach, CommandType.Text, ref err)); } }
public DataTable search(string name) { string str = " Select * from sach where tensach LIKE '" + name + "%'"; DBMain dB = new DBMain(); DataTable table = dB.ExecuteQueryDataTable(str, CommandType.Text); return(table); }
public DataTable LAYTAIKHOAN() { return(db.ExecuteQueryDataTable("select * from TAIKHOAN", CommandType.Text)); }