Beispiel #1
0
        public int Update <T>(T entity, DbTransaction isOpenTrans)
        {
            object        obj2    = 0;
            StringBuilder builder = DatabaseCommon.UpdateSql <T>(entity);

            DbParameter[] parameter = DatabaseCommon.GetParameter <T>(entity);
            obj2 = DbHelper.ExecuteNonQuery(isOpenTrans, CommandType.Text, builder.ToString(), parameter);
            return(Convert.ToInt32(obj2));
        }
Beispiel #2
0
        public int Update(string tableName, Hashtable ht, string propertyName, DbTransaction isOpenTrans)
        {
            object        obj2    = 0;
            StringBuilder builder = DatabaseCommon.UpdateSql(tableName, ht, propertyName);

            DbParameter[] parameter = DatabaseCommon.GetParameter(ht);
            obj2 = DbHelper.ExecuteNonQuery(isOpenTrans, CommandType.Text, builder.ToString(), parameter);
            return(Convert.ToInt32(obj2));
        }
Beispiel #3
0
        public int Update <T>(T entity)
        {
            object        obj2    = 0;
            StringBuilder builder = DatabaseCommon.UpdateSql <T>(entity);

            DbParameter[] parameter = DatabaseCommon.GetParameter <T>(entity);
            obj2 = DbHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), parameter);
            if (Convert.ToInt32(obj2) < 1)
            {
                StringBuilder builderTmp = DatabaseCommon.InsertSql <T>(entity);
                obj2 = DbHelper.ExecuteNonQuery(CommandType.Text, builderTmp.ToString(), parameter);
            }
            return(Convert.ToInt32(obj2));
        }