ResourceTransaction class

From Catglobe Wiki
Jump to: navigation, search

ResourceTransaction



Do accounting on resources to keep track of tickets, points, licenses etc. E.g. Keep track of group X (byResource) bought n licences to product Y (onResource).

Parent class

Inherits from object

Constructors

  • (int onResourceId "The resource that the points are kept on", int byResourceId "The resource that the uses points. May be 0") - Latest transaction on a given resource by a given resource

Methods

  • int Insert(int amount "Number of points to insert", string description "User visible descrition of transaction") - Insert additional points. Inserting to unlimited unsets the unlimited. Returns the new balance.
  • Empty RemoveAll(string description "User visible descrition of transaction") - Set points to 0.
  • Empty SetUnlimited(string description "User visible descrition of transaction") - Set points to unlimited.
  • (From object) string ToString() - The string representation of the object.
  • Array of ResourceTransaction Transactions() - Get list of all transactions.
  • int Transfer(int byResourceIdTarget "Id of recipient of the points", int amount "Number of points to transfer. Use -1 to set target to unlimited", string description "User visible descrition of transaction") - Transfer points from one byResource to another. Transfer to unlimited unsets the unlimited. Returns the new balance of target.
  • int Withdraw(int amount "Number of points to withdraw", string description "User visible descrition of transaction") - Withdraw points. Returns the new balance.

Properties

  • int Amount { get; } - Amount of this transaction. Negative if withdrawal
  • int Balance { get; } - Current balance after this transaction
  • int ByResourceId { get; } - Resource id of the 'user'
  • DateTime Date { get; } - Date of transaction. Empty if no transactions ever performed
  • string Description { get; } - Description of transaction
  • bool IsUnlimited { get; } - True if has unlimited licences
  • string ObjectTypeName { get; } - The name of the type of object.
  • int OnResourceId { get; } - Resource id of the 'product'
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Static Methods

  • Dictionary ResourceTransaction_getBalances(Array of int onResourceIds "List of ids to lookup balances on", Array of int byResourceIds "List of ids to lookup who changed balances on. May be empty to fetch all") - Fetch current balance on the given list of resources. Returns a dictionary of onResourceId, and value is a dictionary where keys are either the given byResourceIds or all known and the value is balance.