Hide Enum value based on condition at run time (bounded)
Here is code sample to hide ENUM elements from a FORM at run
time. For reference purpose I’m using
leave request process form. In this every worker have different type of leaves
for example, some worker can able to apply EL some of can
eligible to apply EL women worker only eligible to apply ML. So we supposed to modified
ENUM value based on worker.
(ENUM = SMJ_LeaveCode)
Now i want to show only first two values while selecting on SO, to achieve this override the form control method as below
[Control("ComboBox")]
class SMJ_LeaveRequestLine_TypeOfleave
{
///
<summary>
///
///
</summary>
public void enter()
{
super();
hcmworker CheckLeaveType = hcmworker::findByPersonnelNumber(hcmworker::find(hcmworker::userId2Worker(curUserId())).PersonnelNumber);//this is for get
current logged in worker id
if(CheckLeaveType.SMJ_CL == NoYes::No)
this.delete(enum2str(SMJ_LeaveCode::CL));
if(CheckLeaveType.SMJ_EL == NoYes::No)
this.delete(enum2str(SMJ_LeaveCode::EL));
if(CheckLeaveType.SMJ_ML == NoYes::No)
this.delete(enum2str(SMJ_LeaveCode::ML));
if(CheckLeaveType.SMJ_Others == NoYes::No)
this.delete(enum2str(SMJ_LeaveCode::Others));
if(CheckLeaveType.SMJ_SL == NoYes::No)
this.delete(enum2str(SMJ_LeaveCode::SL));
}
Comments
Post a Comment