public Int32 Save <T>(T model, string tableName) where T : new() { string sqlStr = CreateSQLStr.SaveSQLStr <T>(model, tableName); using (SqlCommand sc = new SqlCommand(sqlStr, DBHelper.conn)) { DBHelper.conn.Open(); int result = sc.ExecuteNonQuery(); DBHelper.conn.Close(); return(result); } }
public int Delete <T>(T model, string tableName) where T : new() { string sqlStr = CreateSQLStr.DeleteSQLStr <T>(model, tableName); if (sqlStr.Equals("false")) { return(0); } else { using (SqlCommand sc = new SqlCommand(sqlStr, DBHelper.conn)) { DBHelper.conn.Open(); int result = sc.ExecuteNonQuery(); DBHelper.conn.Close(); return(result); } } }
public List <T> GetList <T>(T model, string tableName) where T : new() { string sqlStr = CreateSQLStr.SelectSQLStr <T>(model, tableName); return(ttm.GetList <T>(sqlStr)); }