public static bool updateStatus(byte[] data, ActivityStatus status, ulong block_height) { bool result = false; if (CoreConfig.walletNotifyCommand != "") { string notify_cmd = CoreConfig.walletNotifyCommand.Replace("%s", Encoding.UTF8.GetString(data)); IxiUtils.executeProcess(notify_cmd, "", false); } lock (storageLock) { if (block_height > 0) { string sql = "UPDATE `activity` SET `status` = ?, `blockHeight` = ? WHERE `data` = ?"; result = executeSQL(sql, status, (long)block_height, data); } else { string sql = "UPDATE `activity` SET `status` = ? WHERE `data` = ?"; result = executeSQL(sql, status, data); } } return(result); }
private static bool insertActivityInternal(Activity activity) { if (activity.id == null || activity.id.Length < 1) { return(false); } byte[] seed_hash = activity.seedHash; if (seed_hash == null) { seed_hash = new byte[1] { 0 }; } bool result = false; if (CoreConfig.walletNotifyCommand != "") { IxiUtils.executeProcess(CoreConfig.walletNotifyCommand, Encoding.UTF8.GetString(activity.data), false); } lock (storageLock) { string sql = "INSERT OR REPLACE INTO `activity` (`id`, `seedHash`, `wallet`, `from`, `toList`, `type`, `data`, `value`, `timestamp`, `status`, `blockHeight`, `txid`, `insertedTimestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; result = executeSQL(sql, activity.id, seed_hash, activity.wallet, activity.from, activity.toList, activity.type, activity.data, activity.value, activity.timestamp, activity.status, activity.blockHeight, activity.txid, Clock.getTimestampMillis()); } return(result); }
private static bool updateValueInternal(byte[] data, IxiNumber value) { bool result = false; if (CoreConfig.walletNotifyCommand != "") { IxiUtils.executeProcess(CoreConfig.walletNotifyCommand, Encoding.UTF8.GetString(data), false); } lock (storageLock) { string sql = "UPDATE `activity` SET `value` = ? WHERE `data` = ?"; result = executeSQL(sql, value.ToString(), data); } return(result); }
public static bool updateValue(byte[] data, IxiNumber value) { bool result = false; if (CoreConfig.walletNotifyCommand != "") { string notify_cmd = CoreConfig.walletNotifyCommand.Replace("%s", Encoding.UTF8.GetString(data)); IxiUtils.executeProcess(notify_cmd, "", false); } lock (storageLock) { string sql = "UPDATE `activity` SET `value` = ? WHERE `data` = ?"; result = executeSQL(sql, value.ToString(), data); } return(result); }
public static bool insertActivity(Activity activity) { if (activity.id == null || activity.id.Length < 1) { return(false); } byte[] seed_hash = activity.seedHash; if (seed_hash == null) { seed_hash = new byte[1] { 0 }; } bool result = false; if (CoreConfig.walletNotifyCommand != "") { string notify_cmd = CoreConfig.walletNotifyCommand.Replace("%s", Encoding.UTF8.GetString(activity.data)); IxiUtils.executeProcess(notify_cmd, "", false); } lock (storageLock) { if (getActivityById(activity.id) == null) { string sql = "INSERT INTO `activity` (`id`, `seedHash`, `wallet`, `from`, `toList`, `type`, `data`, `value`, `timestamp`, `status`, `blockHeight`, `txid`, `insertedTimestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; result = executeSQL(sql, activity.id, seed_hash, activity.wallet, activity.from, activity.toList, activity.type, activity.data, activity.value, activity.timestamp, activity.status, activity.blockHeight, activity.txid, Clock.getTimestampMillis()); } else { string sql = "UPDATE `activity` SET `seedHash` = ?, `wallet` = ?, `from` = ?, `toList` = ?, `type` = ?, `data` = ?, `value` = ?, `timestamp` = ?, `status` = ?, `blockHeight` = ?, `txid`=? WHERE `id` = ?"; result = executeSQL(sql, seed_hash, activity.wallet, activity.from, activity.toList, activity.type, activity.data, activity.value, activity.timestamp, activity.status, activity.blockHeight, activity.txid, activity.id); } } return(result); }