Tuesday, 16 July 2013

UI and Contract Class

Contract : 
[
    DataContractAttribute,
   SysOperationContractProcessingAttribute(classStr(ProjHourUtilisationUIBuilder))
    // SysOperationContractProcessingAttribute(classstr(ProjHourUtilisationUIBuilder), SysOperationDataContractProcessingMode::CreateSeparateUIBuilderForEachContract)
    //SysOperationGroupAttribute('PrintOut', "@SYS12608", '2')
]
class ProjHourUtilisationContract implements SysOperationValidatable
{
    ProjWorkerRecId projWorkerRecId;
    ProjId projId;
    ProjCategoryId category;
    FromDate fromDate;
    ToDate toDate;
}

/// <summary>

[
    DataMemberAttribute('ToDate'),
    SysOperationGroupMemberAttribute('Date'),
    SysOperationDisplayOrderAttribute('5')
]
public ToDate parmToDate(ToDate _toDate = toDate)
{
    toDate = _toDate;
    return toDate;
}
=================================================public boolean validate()
{
    boolean             isValid = true;
    if(!projWorkerRecId)
        throw error(“Select Employee ID”);*/
    return isValid;
}

[
    DataMemberAttribute('Category'),
 SysOperationDisplayOrderAttribute('2')
]
public ProjCategoryId parmCategory(ProjCategoryId _ProjCategoryId = category)
{
    category = _ProjCategoryId;
    return category;
}

[
    DataMemberAttribute('FromDate'),
   SysOperationGroupMemberAttribute('Date'),
   SysOperationDisplayOrderAttribute('4')
]
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
    fromDate = _fromDate;
    return fromDate;
}

UI Builder Class:

class ProjHourUtilisationUIBuilder extendsSysOperationAutomaticUIBuilder
{
    ProjHourUtilisationContract projHourUtilisationContract;
    DialogField dialogCategory;
    DialogField dialogProject;
    DialogField dialogEmployee;
    DialogField fromDate;
    DialogField toDate;

}


public void build()
{

    Dialog      dialogLocal = this.dialog();

     projHourUtilisationContract = this.dataContractObject();
    this.addDialogField(methodStr(ProjHourUtilisationContract,parmProjectId), projHourUtilisationContract);
    this.addDialogField(methodStr(ProjHourUtilisationContract,parmCategory), projHourUtilisationContract);
    this.addDialogField(methodStr(ProjHourUtilisationContract,parmEmployeeId), projHourUtilisationContract);
   this.addDialogField(methodStr(projHourUtilisationContract,parmFromDate),projHourUtilisationContract);
   this.addDialogField(methodStr(projHourUtilisationContract,parmToDate),projHourUtilisationContract);
}

public void getFromDialog()
{
    projHourUtilisationContract = this.dataContractObject();
    super();
}
public void initializeFields()
{
    projHourUtilisationContract = this.dataContractObject();
}
 public void lookupCategory(FormStringControl _control)
{
    Query query = new Query();
    SysTableLookup sysTablelookup;

    sysTablelookup =SysTableLookup::newParameters(tableNum(ProjCategory),_control);
    sysTablelookup.addLookupfield(fieldNum(ProjCategory,CategoryId));
    sysTablelookup.addLookupfield(fieldnum(ProjCategory,Name));
//that table display method(show in lookup) for thatbelowline
sysTablelookup.addLookupMethod(“EmplName”);
    sysTablelookup.addLookupfield(fieldnum(ProjCategory,CategoryType));
     query.addDataSource(tableNum(ProjCategory));
    query.dataSourceTable(tableNum(ProjCategory)).addRange(fieldNum(ProjCategory, CategoryType)).value(queryValue(ProjCategoryType::Hour));

    sysTablelookup.parmQuery(query);
    sysTablelookup.performFormLookup();
}
 // <summary>
/// Override this method in order to register the dialog field methods to capture events.
/// </summary>
public void postRun()
{

    Dialog dialogLocal = this.dialog();
    super();
    // This method should be called in order to handle events on dialogs.
   dialogLocal.dialogForm().formRun().controlMethodOverload(false);
 }
 public void postBuild()
{
    ;
    super();
    dialogCategory = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(ProjHourUtilisationContract,parmCategory));


    // register override method for lookup customer
    dialogCategory.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(ProjHourUtilisationUIBuilder,lookupCategory),this);

    dialogProject = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(ProjHourUtilisationContract,parmProjectId));

    dialogEmployee = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(ProjHourUtilisationContract,parmEmployeeId));

    fromDate = this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(ProjHourUtilisationContract,parmFromDate));

    toDate =this.bindInfo().getDialogField(
                         this.dataContractObject(),
                         methodStr(ProjHourUtilisationContract,parmToDate));

  }


No comments:

Post a Comment