public bool DeleteHangve(DTO.Hangve hv) { string sql = "UPDATE HANGVE SET TINHTRANG=N'Không khả dụng' WHERE MAHV = @MAHV"; SqlConnection con = dc.GetConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@MAHV", SqlDbType.VarChar).Value = hv.mahv; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool InsertHangve(DTO.Hangve hv) { string sql = "INSERT INTO HANGVE(MAHV, TENHV, TYLE, TINHTRANG) VALUES(@MAHV, @TENHV, @TYLE, @TINHTRANG)"; SqlConnection con = dc.GetConnect(); try { cmd = new SqlCommand(sql, con); con.Open(); cmd.Parameters.Add("@MAHV", SqlDbType.VarChar).Value = TaoMaHangVe2(); cmd.Parameters.Add("@TENHV", SqlDbType.NVarChar).Value = hv.tenhv; cmd.Parameters.Add("@TYLE", SqlDbType.Int).Value = hv.tyle; cmd.Parameters.Add("@TINHTRANG", SqlDbType.NVarChar).Value = hv.tinhtrang; cmd.ExecuteNonQuery(); con.Close(); } catch (Exception e) { return(false); } return(true); }
public bool DeleteHangve(DTO.Hangve dto) { return(dal.DeleteHangve(dto)); }
public bool InsertHangve(DTO.Hangve dto) { return(dal.InsertHangve(dto)); }