84) COC of the form Data soruce level method
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableFrm_Extension</c> contains the TransMountain extending logic for the <c>EntAssetWorkOrderTable</c> form.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTable, WorkOrderLine))]
final class AvaEntAssetWorkOrderTableFrm_WorkOrderLineDS_Extension
{
public void init()
{
next init();
this.avaUpdateTransferButtons();
}
/// <summary>
/// enable and disable the DPMS work order button
/// </summary>
/// <returns>true if workorder type is Pipeline, otherwise false.</returns>
public int active()
{
var ret = next active();
this.avaUpdateTransferButtons();
return ret;
}
public void avaUpdateTransferButtons()
{
EntAssetWorkOrderLine workOrderLineLocal = this.cursor();
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, InventTransferMultiReceiveAvaWorkOrderLine)).enabled(workOrderLineLocal.AvaHasShippedTransfer());
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, AvaEntAssetWorkorderLineTransfer)).enabled(workOrderLineLocal.AvaHasTransfer());
}
}
=====================================================================
This is the another example of the form emthod
/// <summary>
/// The <c>AVAEntAssetWorkOrderTableFrm_Extension</c> contains the TransMountain extending logic for the <c>EntAssetWorkOrderTable</c> form.
/// </summary>
[ExtensionOf(formDataSourceStr(EntAssetWorkOrderTable, WorkOrderTable))]
final class AvaEntAssetWorkOrderTableFrm_WorkOrderTableDS_Extension
{
/// <summary>
/// Handles the events raised on datasource initialization.
/// </summary>
public void init()
{
next init();
this.avaUpdatePipelinefields();
this.avaUpdateHazardFields();
this.avaUpdateCmrFields();
this.avaUpdateMaintenanceProgramFields();
this.avaUpdateMaintenanceRoundfields();
this.avaUpdateTransferButtons();
}
/// <summary>
/// enable and disable the DPMS work order button
/// </summary>
/// <returns>true if workorder type is Pipeline, otherwise false.</returns>
public int active()
{
var ret = next active();
// check Kmpost and Year of issue Fields.
this.avaUpdatePipelinefields();
this.avaUpdateMaintenanceRoundfields();
this.avaUpdateTransferButtons();
this.avaUpdateHazardFields();
this.avaUpdateCmrFields();
this.avaUpdateMaintenanceProgramFields();
return ret;
}
/// <summary>
/// check Mantory and enable and disable the km post and year of issue fields.
/// </summary>
public void avaUpdatePipelinefields()
{
EntAssetWorkOrderType workOrderTypeLocal = this.cursor().workOrderType();
boolean pipelineFieldsEnabled = workOrderTypeLocal.AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline;
boolean dpmsButtonEnabled = (workOrderTypeLocal.AVAWorkOrderTypeClassification == AVAWorkOrderTypeClassification::Pipeline
&& workOrderTypeLocal.AVAEnableDPMS == NoYes::Yes);
// check mandatory.
//this.object(fieldNum(EntAssetWorkOrderTable, AvaPipelineKMPost)).mandatory(pipelineFieldsEnabled); zero is a valid field value.
this.object(fieldNum(EntAssetWorkOrderTable, AvaPipelineYearofIssue)).mandatory(pipelineFieldsEnabled);
//Check field.
this.object(fieldnum(EntAssetWorkOrderTable, AvaPipelineYearofIssue)).visible(pipelineFieldsEnabled);
this.object(fieldnum(EntAssetWorkOrderTable, AvaPipelineKMPost)).visible(pipelineFieldsEnabled);
this.object(fieldnum(EntAssetWorkOrderTable, AvaPipelineGirthWeld)).visible(pipelineFieldsEnabled);
this.object(fieldnum(EntAssetWorkOrderTable, AvaPipelineDigNum)).visible(pipelineFieldsEnabled);
this.object(fieldnum(EntAssetWorkOrderTable, AvaLatitude)).visible(pipelineFieldsEnabled);
this.object(fieldnum(EntAssetWorkOrderTable, AvaLongitude)).visible(pipelineFieldsEnabled);
// Form control button.
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, AvaEntAssetDpmsUrlLink)).visible(dpmsButtonEnabled);
}
/// <summary>
/// check visibilty for maintenance round fields.
/// </summary>
public void avaUpdateMaintenanceRoundfields()
{
EntAssetWorkOrderTable workOrderTableLocal = this.cursor();
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, AvaIvaraStandardJobHistoricalReportLink)).visible(workOrderTableLocal.RecId!=0 && workOrderTableLocal.AvaAvaraJobId()!="");
}
public void avaUpdateTransferButtons()
{
EntAssetWorkOrderTable workOrderTableLocal = this.cursor();
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, InventTransferMultiReceiveAvaWorkOrder)).visible(workOrderTableLocal.AvaHasShippedTransfer());
this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, AvaEntAssetWorkorderTransfer)).enabled(workOrderTableLocal.AvaHasTransfer());
}
/// <summary>
/// check visibilty for Hazar fields.
/// </summary>
public void avaUpdateHazardFields()
{
EntAssetWorkOrderType workOrderTypeLocal = this.cursor().workOrderType();
boolean hazardFieldsEnabled = workOrderTypeLocal.AvaHazardProgram == NoYes::Yes;
this.object(fieldnum(EntAssetWorkOrderTable, AvaHazardId)).visible(hazardFieldsEnabled);
}
/// <summary>
/// check visibilty for CMR fields.
/// </summary>
public void avaUpdateCmrFields()
{
EntAssetWorkOrderType workOrderTypeLocal = this.cursor().workOrderType();
boolean cmrFieldsEnabled = (workOrderTypeLocal.AvaCMRProgram == NoYes::Yes);
this.object(fieldnum(EntAssetWorkOrderTable, AvaCMRNum)).visible(cmrFieldsEnabled);
}
/// <summary>
/// check visibilty for maintenance program fields.
/// </summary>
public void avaUpdateMaintenanceProgramFields()
{
EntAssetWorkOrderType workOrderTypeLocal = this.cursor().workOrderType();
boolean maintenanceProgramFieldsEnabled = workOrderTypeLocal.AVAWorkOrderTypeClassification != AVAWorkOrderTypeClassification::Facility;
this.object(fieldnum(EntAssetWorkOrderTable, AvaMaintenanceProgram)).visible(maintenanceProgramFieldsEnabled);
}
}
Comments
Post a Comment