public void LuuPhieuNhap(DTONhapTP dtoPNTP) { DAO_Entity dao = new DAO_Entity(); dao.ThemPhieuNhap(dtoPNTP); }
//DAO Vat Lieu //Lay du lieu tu Database hien thi ra bang //DAOPhieuNhapThanhPham //Them phieu nhap public bool ThemPhieuNhap(DTONhapTP dtoPNTP) { bool ketqua = false; ketnoi.TaoKetNoi(); try { string lenh = "insert into PhieuNSP(MaNSP, MaPhieuGiao, NgayNhap, NgayGiao, NguoiGiao, NguoiNhan, maDH) values(@mansp, @maPhieuGiao, @ngaynhap, @ngaygiao, @nguoigiao, @nguoinhan, @madh)"; ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi); ketnoi.LenhKetNoi.Parameters.Add("@mansp", SqlDbType.VarChar); ketnoi.LenhKetNoi.Parameters.Add("@maPhieuGiao", SqlDbType.VarChar); ketnoi.LenhKetNoi.Parameters.Add("@ngaynhap", SqlDbType.DateTime); ketnoi.LenhKetNoi.Parameters.Add("@ngaygiao", SqlDbType.DateTime); ketnoi.LenhKetNoi.Parameters.Add("@nguoigiao", SqlDbType.NVarChar); ketnoi.LenhKetNoi.Parameters.Add("@nguoinhan", SqlDbType.NVarChar); ketnoi.LenhKetNoi.Parameters.Add("@madh", SqlDbType.VarChar); ketnoi.LenhKetNoi.Parameters["@mansp"].Value = dtoPNTP.MaNTP; ketnoi.LenhKetNoi.Parameters["@maPhieuGiao"].Value = dtoPNTP.MaPhieuGiao; ketnoi.LenhKetNoi.Parameters["@ngaynhap"].Value = dtoPNTP.NgayTao; ketnoi.LenhKetNoi.Parameters["@ngaygiao"].Value = dtoPNTP.NgayGiao; ketnoi.LenhKetNoi.Parameters["@nguoigiao"].Value = dtoPNTP.NguoiGiao; ketnoi.LenhKetNoi.Parameters["@nguoinhan"].Value = dtoPNTP.NguoiNhan; ketnoi.LenhKetNoi.Parameters["@madh"].Value = dtoPNTP.MaDH; if (ketnoi.LenhKetNoi.ExecuteNonQuery() != 0) ketqua = true; } catch (Exception) { } finally { ketnoi.DongKetNoi(); } return ketqua; }