-
-
Save ztirom/3d310e869bb334f4387963b5ec587510 to your computer and use it in GitHub Desktop.
Table Extension2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestMyExtension | |
{ | |
/// <summary> | |
/// Runs the class with the specified arguments. | |
/// </summary> | |
/// <param name = "_args">The specified arguments.</param> | |
public static void main(Args _args) | |
{ | |
InventTable invenTable = InventTable::find("1000" /* ItemId */, true /* Select For Update */); | |
if (invenTable) | |
{ | |
TestMyExtension::InsertMyText(invenTable, "FillMyExtension"); | |
if (TestMyExtension::CheckIfFieldIsEmpty(invenTable)) | |
{ | |
info("Empty!"); | |
} | |
else | |
{ | |
info("Is filled!"); | |
} | |
} | |
} | |
public static void InsertMyText(InventTable _invenTable, str _myExtText) | |
{ | |
try | |
{ | |
ttsbegin; | |
_invenTable.MyExtField = _myExtText; | |
if (_invenTable.validateWrite()) | |
{ | |
_invenTable.update(); | |
} | |
else | |
{ | |
throw Exception::Error; | |
} | |
ttscommit; | |
} | |
catch | |
{ | |
error(":/"); | |
} | |
} | |
public static boolean CheckIfFieldIsEmpty(InventTable _invenTable) | |
{ | |
return InventTable::isMyFieldEmpty(_invenTable); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment