public void LoadData() { DeptList = SharedPreference.Instance.DeptList; RankList = SharedPreference.Instance.RankList; StaffName = SharedPreference.Instance.SelectedStaff.STAFF_NAME; StaffAddress = SharedPreference.Instance.SelectedStaff.STAFF_ADDRESS; StaffTel = SharedPreference.Instance.SelectedStaff.STAFF_TEL; StaffJoinDayStr = SharedPreference.Instance.SelectedStaff.STAFF_JOIN_DAY; StaffJoinDay = DateTime.ParseExact(StaffJoinDayStr, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); if ((SharedPreference.Instance.SelectedStaff.STAFF_RETIREMENT_DAY != "" || SharedPreference.Instance.SelectedStaff.STAFF_RETIREMENT_DAY.Length != 0) && SharedPreference.Instance.SelectedStaff.STAFF_RETIREMENT_DAY != null) { StaffRetirementDayStr = SharedPreference.Instance.SelectedStaff.STAFF_RETIREMENT_DAY; StaffRetirementDay = DateTime.ParseExact(StaffRetirementDayStr, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); } StaffState = SharedPreference.Instance.SelectedStaff.STAFF_STATE; var deptList = SharedPreference.Instance.DeptList.Where(p => p.DEPT_CODE == SharedPreference.Instance.SelectedStaff.STAFF_DEPT).FirstOrDefault(); SelectedDeptIndex = SharedPreference.Instance.DeptList.IndexOf(deptList); var rankList = SharedPreference.Instance.RankList.Where(p => p.RANK_CODE == SharedPreference.Instance.SelectedStaff.STAFF_RANK).FirstOrDefault(); SelectedRankIndex = SharedPreference.Instance.RankList.IndexOf(rankList); var stateList = StateList.Where(p => p == SharedPreference.Instance.SelectedStaff.STAFF_STATE).FirstOrDefault(); StateIndex = StateList.IndexOf(stateList); }
/// <summary> /// Checks if the <paramref name="stateView"/> state is the first in a collection in the parent. /// </summary> /// <param name="stateView">The state view.</param> public virtual bool IsFirstItem(IFocusNodeStateView stateView) { Contract.RequireNotNull(stateView, out IFocusNodeStateView StateView); IFocusNodeState State = StateView.State; Debug.Assert(State != null); IFocusInner ParentInner = State.ParentInner; IFocusPlaceholderNodeState PlaceholderNodeState; FocusPlaceholderNodeStateReadOnlyList StateList; int Index; bool Result; switch (ParentInner) { case IFocusListInner AsListInner: PlaceholderNodeState = State as IFocusPlaceholderNodeState; Debug.Assert(PlaceholderNodeState != null); StateList = AsListInner.StateList; Index = StateList.IndexOf(PlaceholderNodeState); Debug.Assert(Index >= 0 && Index < StateList.Count); Result = Index == 0; break; case IFocusBlockListInner AsBlockListInner: PlaceholderNodeState = State as IFocusPlaceholderNodeState; Debug.Assert(PlaceholderNodeState != null); Result = false; for (int BlockIndex = 0; BlockIndex < AsBlockListInner.BlockStateList.Count; BlockIndex++) { StateList = (FocusPlaceholderNodeStateReadOnlyList)AsBlockListInner.BlockStateList[BlockIndex].StateList; Index = StateList.IndexOf(PlaceholderNodeState); if (Index >= 0) { Debug.Assert(Index < StateList.Count); Result = BlockIndex == 0 && Index == 0; } } break; default: Result = true; break; } return(Result); }