public bool addMucDoTinCay(MucDoTinCay newSec) { bool result = false; SqlConnection conn = new SqlConnection(connectionString); try { string query = "INSERT INTO Su_MucDoTinCay (Name, Description) VALUES(N'" + newSec.Name + "', N'" + newSec.Description + "');"; conn.Open(); executeDataByQuery(query, conn, null); result = true; } catch (Exception e) { logUserManagement("addApprover()", e.Message); } finally { conn.Close(); } return(result); }
public MucDoTinCay getMucDoTinCay(int ID) { MucDoTinCay result = null; string query = "SELECT ID, Name, Description FROM Su_MucDoTinCay WHERE ID = " + ID + ""; DataTable dt = getData(query); if (dt.Rows.Count > 0) { result = new MucDoTinCay(); result.ID = ID; result.Name = dt.Rows[0][1].ToString(); result.Description = dt.Rows[0][2].ToString(); } return(result); }
public bool updateMucDoTinCay(MucDoTinCay Sec) { bool result = false; SqlConnection conn = new SqlConnection(connectionString); string query = "UPDATE Su_MucDoTinCay SET Name = N'" + Sec.Name + "', Description = N'" + Sec.Description + "' WHERE ID = " + Sec.ID + ""; try { conn.Open(); executeDataByQuery(query, conn, null); result = true; } catch (Exception e) { logUserManagement("updateMucDoTinCay()", e.Message); } finally { conn.Close(); } return(result); }