public bool Xoa(QLKTX.BusinessObject.KTXInfo ktx) { SqlCommand com = new SqlCommand(); com.CommandText = "Delete KTX where KTX=@ma"; com.Parameters.Add("@ma", SqlDbType.VarChar, 7).Value = ktx.MaKTX; try { ser.Load(com); return(true); } catch (Exception e) { e.ToString(); return(false); } }
public bool Sua(QLKTX.BusinessObject.KTXInfo ktx) { SqlCommand com = new SqlCommand(); com.CommandText = "Update KTX Set TenKTX =@ten, SOLUONGDAY=@soday where KTX=@ma"; com.Parameters.Add("@ma", SqlDbType.VarChar, 7).Value = ktx.MaKTX; com.Parameters.Add("@ten", SqlDbType.NVarChar, 30).Value = ktx.TenKTX; com.Parameters.Add("@soday", SqlDbType.Int).Value = ktx.SoDay; try { ser.Load(com); return(true); } catch (Exception e) { e.ToString(); return(false); } }
/// <summary> /// Lưu KTX Xuống CSDL /// </summary> /// <param name="ktx">KTX cần thêm</param> /// <returns> /// true --> Thành công /// false --> Thất bại /// </returns> public bool Them(QLKTX.BusinessObject.KTXInfo ktx) { SqlCommand com = new SqlCommand(); com.CommandText = "Insert Into KTX(KTX,TENKTX,SOLUONGDAY) values(@ma,@ten,@soday)"; com.Parameters.Add("@ma", SqlDbType.VarChar, 4).Value = ktx.MaKTX; com.Parameters.Add("@ten", SqlDbType.NVarChar, 30).Value = ktx.TenKTX; com.Parameters.Add("@soday", SqlDbType.Int).Value = ktx.SoDay; try { ser.Load(com); return(true); } catch (Exception e) { e.ToString(); return(false); } }
/// <summary> /// Sửa Thông tin KTX ra khỏi CSDL /// </summary> /// <param name="ktx">KTX cần Sửa</param> public void Sua(QLKTX.BusinessObject.KTXInfo ktx) { data.Sua(ktx); }
/// <summary> /// Thêm KTX vào CSDL /// </summary> /// <param name="ktx">KTX cần thêm</param> public void Them(QLKTX.BusinessObject.KTXInfo ktx) { data.Them(ktx); }