Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }
Ejemplo n.º 3
0
        public List <T> GetList <T>(T model, string tableName) where T : new()
        {
            string sqlStr = CreateSQLStr.SelectSQLStr <T>(model, tableName);

            return(ttm.GetList <T>(sqlStr));
        }