public bool addNgonNgu(NgonNgu newSec) { bool result = false; SqlConnection conn = new SqlConnection(connectionString); try { string query = "INSERT INTO Su_NgonNgu (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 NgonNgu getNgonNgu(int ID) { NgonNgu result = null; string query = "SELECT ID, Name, Description FROM Su_NgonNgu WHERE ID = " + ID + ""; DataTable dt = getData(query); if (dt.Rows.Count > 0) { result = new NgonNgu(); result.ID = ID; result.Name = dt.Rows[0][1].ToString(); result.Description = dt.Rows[0][2].ToString(); } return(result); }
public bool updateNgonNgu(NgonNgu Sec) { bool result = false; SqlConnection conn = new SqlConnection(connectionString); string query = "UPDATE Su_NgonNgu 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("updateNgonNgu()", e.Message); } finally { conn.Close(); } return(result); }