/// <summary> /// "CommonCombo" binding /// </summary> private void BindCommon() { VacationTypeService leavings = new VacationTypeService(); List <LeaveType> leaveTopSix = new List <LeaveType>(); leaveTopSix = leavings.ObtainVacationTypes("common"); this.CommonCombo.DataSource = leaveTopSix; LeaveType l = new LeaveType { LeaveTypeId = -1, LeaveTypeName = "Please Select", }; leaveTopSix.Insert(0, l); if (Convert.ToInt32(showStaffInfo.Gender) > 0) { LeaveType paternityleave = new LeaveType { LeaveTypeId = 7, LeaveTypeName = "Paternity Leave", }; leaveTopSix.Insert(3, paternityleave); } else { LeaveType maternityleave = new LeaveType { LeaveTypeId = 5, LeaveTypeName = "Maternity Leave", }; leaveTopSix.Insert(3, maternityleave); } this.CommonCombo.DisplayMember = "LeaveTypeName"; this.CommonCombo.ValueMember = "LeaveTypeId"; }
/// <summary> /// "OthersCombo" binding /// </summary> private void BindOther() { VacationTypeService leavings = new VacationTypeService(); List <LeaveType> leaveRest = new List <LeaveType>(); leaveRest = leavings.ObtainVacationTypes("rest"); if (showStaffInfo.Gender > 0) { leaveRest.RemoveAt(1); } else { leaveRest.RemoveAt(2); } this.OthersCombo.DataSource = leaveRest; LeaveType l = new LeaveType { LeaveTypeId = -1, LeaveTypeName = "Please Select", }; leaveRest.Insert(0, l); this.OthersCombo.DisplayMember = "LeaveTypeName"; this.OthersCombo.ValueMember = "LeaveTypeId"; }