49) How to write a COC using extension
1) COC for table method : -
/// <summary>
/// </summary>
[ExtensionOf(tableStr(EntAssetWorkOrderTable))]
final class AVAEntAssetWorkOrderTableDbt_Extension
{
/// <summary>
/// validating the Fields to be fill or blank </c> AVAKMPost & AVAYearofIssue </c> Validation perform for this two fields
/// </summary>
public boolean validateWrite()
{
boolean ret;
ret = next validateWrite();
if(this.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline)
{
if (!this.AVAKMPost)
{
ret = checkfailed(strFmt("@SYS26332", fieldId2pname(tableNum(EntAssetWorkOrderTable), fieldNum(EntAssetWorkOrderTable, AVAKMPost))));
}
if (!this.AVAYearofIssue)
{
ret = checkfailed(strFmt("@SYS26332", fieldId2pname(tableNum(EntAssetWorkOrderTable), fieldNum(EntAssetWorkOrderTable, AVAYearofIssue))));
}
}
return ret;
}
// <summary>
// To fill the Year of issue field with the current year on system
// </summary>
public void initValue()
{
next initValue();
if((this.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline))
{
this.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
}
======================================================================================
2) COC for Form data source fields : -
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableCreateFrm_Extension</c> xxxxxxxx</c> form.
/// </summary>
[ExtensionOf(formDataFieldStr(EntAssetWorkOrderTableCreate, WorkOrderTable, WorkOrderType))]
final class AVAEntAssetWorkOrderTableCreateFrm_Extension
{
/// <summary>
/// Fill the Year of issue if the work order type is pipleline
/// </summary>
public void modified()
{
FormDataObject entAssetWorkOrderTable_do = any2Object(this) as FormDataObject;
FormDataSource entAssetWorkOrderTable_ds = entAssetWorkOrderTable_do.datasource();
EntAssetWorkOrderTable entAssetWorkOrderTable = entAssetWorkOrderTable_ds.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
next modified();
if(enableDPMSButton)
{
entAssetWorkOrderTable.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
}
=======================================================================
3) COC for form data source only
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTableCreate, WorkOrderTable))]
1) final class AVAEntAssetWorkOrderTableCreateFrm_Extension
{
/// <summary>
/// Fill the Year of issue if the work order type is pipleline
/// </summary>
public void initValue()
{
EntAssetWorkOrderTable entAssetWorkOrderTable = this.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
next initValue();
if (enableDPMSButton)
{
entAssetWorkOrderTable.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
========================================================================
2) COC for the Active methods : -
Active method
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableFrm_Extension</c> xxxxxxxx</c> form.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTable, WorkOrderTable))]
final class AVAEntAssetWorkOrderTableFrm_WorkOrderTableDS_Extension
{
/// <summary>
/// validating the Fields to be fill or blank </c> AVAKMPost & AVAYearofIssue </c> Validation perform for this two fields
/// </summary>
public int active()
{
int ret;
FormRun formRun = this.formRun();
FormControl dpmsUrlButton = formRun.design().controlName(formControlStr(EntAssetWorkOrderTable, AVADpmsUrlLink));
EntAssetWorkOrderTable entAssetWorkOrderTable = this.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
ret = next active();
this.object(fieldNum(EntAssetWorkOrderTable, AVAKMPost)).mandatory(enableDPMSButton);
this.object(fieldNum(EntAssetWorkOrderTable, AVAYearofIssue)).mandatory(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAYearofIssue)).enabled(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAKMPost)).enabled(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAEnableDPMS)).enabled(enableDPMSButton);
// Form control button
dpmsUrlButton.enabled(enableDPMSButton);
return ret;
}
}
=======================================================================
COC for the Table method : -
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableDbt_Extension</c> xxxxxxx</c> table.
/// </summary>
[ExtensionOf(tableStr(EntAssetWorkOrderTable))]
final class AVAEntAssetWorkOrderTableDbt_Extension
{
// <summary>
// To fill the Year of issue field with the current year on system
// </summary>
public void initValue()
{
next initValue();
this.avaInitFromWorkOrderType();
}
// <summary>
// To modified field call the "avaInitFromWorkOrderType" method to check the works order type
// </summary>
public void modifiedField(FieldId _fieldId)
{
next modifiedField(_fieldId);
switch (_fieldId)
{
case fieldNum(EntAssetWorkOrderTable, WorkOrderType):
this.avaInitFromWorkOrderType();
break;
}
}
// <summary>
// Method will check that work order type what is the work order classification selected on work order typr form
// </summary>
public void avaInitFromWorkOrderType()
{
if(this.workordertype().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline && this.workOrderType().AVAEnableDPMS == NoYes::Yes)
{
this.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()))); // Current year
}
else
{
this.AVAYearofIssue = '';
}
}
}
====================================================================
/// <summary>
/// </summary>
[ExtensionOf(tableStr(EntAssetWorkOrderTable))]
final class AVAEntAssetWorkOrderTableDbt_Extension
{
/// <summary>
/// validating the Fields to be fill or blank </c> AVAKMPost & AVAYearofIssue </c> Validation perform for this two fields
/// </summary>
public boolean validateWrite()
{
boolean ret;
ret = next validateWrite();
if(this.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline)
{
if (!this.AVAKMPost)
{
ret = checkfailed(strFmt("@SYS26332", fieldId2pname(tableNum(EntAssetWorkOrderTable), fieldNum(EntAssetWorkOrderTable, AVAKMPost))));
}
if (!this.AVAYearofIssue)
{
ret = checkfailed(strFmt("@SYS26332", fieldId2pname(tableNum(EntAssetWorkOrderTable), fieldNum(EntAssetWorkOrderTable, AVAYearofIssue))));
}
}
return ret;
}
// <summary>
// To fill the Year of issue field with the current year on system
// </summary>
public void initValue()
{
next initValue();
if((this.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline))
{
this.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
}
======================================================================================
2) COC for Form data source fields : -
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableCreateFrm_Extension</c> xxxxxxxx</c> form.
/// </summary>
[ExtensionOf(formDataFieldStr(EntAssetWorkOrderTableCreate, WorkOrderTable, WorkOrderType))]
final class AVAEntAssetWorkOrderTableCreateFrm_Extension
{
/// <summary>
/// Fill the Year of issue if the work order type is pipleline
/// </summary>
public void modified()
{
FormDataObject entAssetWorkOrderTable_do = any2Object(this) as FormDataObject;
FormDataSource entAssetWorkOrderTable_ds = entAssetWorkOrderTable_do.datasource();
EntAssetWorkOrderTable entAssetWorkOrderTable = entAssetWorkOrderTable_ds.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
next modified();
if(enableDPMSButton)
{
entAssetWorkOrderTable.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
}
=======================================================================
3) COC for form data source only
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTableCreate, WorkOrderTable))]
1) final class AVAEntAssetWorkOrderTableCreateFrm_Extension
{
/// <summary>
/// Fill the Year of issue if the work order type is pipleline
/// </summary>
public void initValue()
{
EntAssetWorkOrderTable entAssetWorkOrderTable = this.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
next initValue();
if (enableDPMSButton)
{
entAssetWorkOrderTable.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())));
}
}
========================================================================
2) COC for the Active methods : -
Active method
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableFrm_Extension</c> xxxxxxxx</c> form.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTable, WorkOrderTable))]
final class AVAEntAssetWorkOrderTableFrm_WorkOrderTableDS_Extension
{
/// <summary>
/// validating the Fields to be fill or blank </c> AVAKMPost & AVAYearofIssue </c> Validation perform for this two fields
/// </summary>
public int active()
{
int ret;
FormRun formRun = this.formRun();
FormControl dpmsUrlButton = formRun.design().controlName(formControlStr(EntAssetWorkOrderTable, AVADpmsUrlLink));
EntAssetWorkOrderTable entAssetWorkOrderTable = this.cursor();
boolean enableDPMSButton = (entAssetWorkOrderTable.workOrderType().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline);
ret = next active();
this.object(fieldNum(EntAssetWorkOrderTable, AVAKMPost)).mandatory(enableDPMSButton);
this.object(fieldNum(EntAssetWorkOrderTable, AVAYearofIssue)).mandatory(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAYearofIssue)).enabled(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAKMPost)).enabled(enableDPMSButton);
this.object(fieldnum(entAssetWorkOrderTable, AVAEnableDPMS)).enabled(enableDPMSButton);
// Form control button
dpmsUrlButton.enabled(enableDPMSButton);
return ret;
}
}
=======================================================================
COC for the Table method : -
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableDbt_Extension</c> xxxxxxx</c> table.
/// </summary>
[ExtensionOf(tableStr(EntAssetWorkOrderTable))]
final class AVAEntAssetWorkOrderTableDbt_Extension
{
// <summary>
// To fill the Year of issue field with the current year on system
// </summary>
public void initValue()
{
next initValue();
this.avaInitFromWorkOrderType();
}
// <summary>
// To modified field call the "avaInitFromWorkOrderType" method to check the works order type
// </summary>
public void modifiedField(FieldId _fieldId)
{
next modifiedField(_fieldId);
switch (_fieldId)
{
case fieldNum(EntAssetWorkOrderTable, WorkOrderType):
this.avaInitFromWorkOrderType();
break;
}
}
// <summary>
// Method will check that work order type what is the work order classification selected on work order typr form
// </summary>
public void avaInitFromWorkOrderType()
{
if(this.workordertype().AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline && this.workOrderType().AVAEnableDPMS == NoYes::Yes)
{
this.AVAYearofIssue = int2Str(year(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()))); // Current year
}
else
{
this.AVAYearofIssue = '';
}
}
}
====================================================================
0mulneuriji Curtis Bethea https://wakelet.com/wake/woDNasLHUhC8ODUe1Xz9l
ReplyDeletescisoggata
YglomorWex-da Mike Anderson Eset NOD 32
ReplyDeleteVysor
CorelDRAW
fectpaddrahi