public void updateModel(tblThongTinMuonModel muon) { //string sql = "Update tblThongTinMuon set XACNHANTRA=N'" + muon.XacNhanTra + "',GHICHU=N'" + muon.GhiChu + "' where MADG='" + muon.MaDocGia + "'"; //connectSer.ThucThiSQLTheoPhiKetNoi(sql); sqlCom = new SqlCommand(); sqlCom.CommandType = CommandType.StoredProcedure; sqlCom.CommandText = "USP_UpdateThongTinMuonTra"; sqlCom.Parameters.Add("@MADG", SqlDbType.VarChar).Value = muon.MaDocGia; sqlCom.Parameters.Add("@MASACH", SqlDbType.VarChar).Value = muon.MaSach; sqlCom.Parameters.Add("@XACNHANTRA", SqlDbType.NVarChar).Value = muon.XacNhanTra; sqlCom.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = muon.GhiChu; sqlCom.Connection = connectSer.Connect(); sqlCom.ExecuteNonQuery(); if (muon.XacNhanTra.Equals("Đã trả")) { sachSer.updateModelByCondition(muon.MaSach, true); } }
public void createModel(tblThongTinMuonModel muon) { //string sql = "Insert Into tblThongTinMuon(MADG,MASACH,SOLUONGMUON,NGAYMUON,NGAYTRA,XACNHANTRA,GHICHU) values ('" + muon.MaDocGia + "','" + muon.MaSach + "','" + muon.SoLuongMuon + "','" + muon.NgayMuon + "','" + muon.NgayTra + "', N'Chưa trả'" + ", N'" + muon.GhiChu + "')"; //connectSer.ThucThiSQLTheoPhiKetNoi(sql); sqlCom = new SqlCommand(); sqlCom.CommandType = CommandType.StoredProcedure; sqlCom.CommandText = "USP_InsertThongTinMuonTra"; sqlCom.Parameters.Add("@MADG", SqlDbType.VarChar).Value = muon.MaDocGia; sqlCom.Parameters.Add("@MASACH", SqlDbType.VarChar).Value = muon.MaSach; sqlCom.Parameters.Add("@SOLUONGMUON", SqlDbType.Int).Value = muon.SoLuongMuon; sqlCom.Parameters.Add("@NGAYMUON", SqlDbType.VarChar).Value = muon.NgayMuon; sqlCom.Parameters.Add("@NGAYTRA", SqlDbType.VarChar).Value = muon.NgayTra; sqlCom.Parameters.Add("@XACNHANTRA", SqlDbType.NVarChar).Value = muon.XacNhanTra; sqlCom.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = muon.GhiChu; sqlCom.Connection = connectSer.Connect(); sqlCom.ExecuteNonQuery(); sachSer.updateModelByCondition(muon.MaSach, false); }