Example #1
0
        private void FillData(System.Collections.ObjectModel.ObservableCollection <LeaveInfo> observableCollection)
        {
            List <LeaveInfo> leaveInfos = (List <LeaveInfo>)observableCollection.ToList <LeaveInfo>();

            source.Clear();
            for (int i = 0; i < leaveInfos.Count; i++)
            {
                LeaveInfo li   = (LeaveInfo)leaveInfos[i];
                LeaveItem item = new LeaveItem(li);
                item.Submitter = li.Submitter.FirstName + " " + li.Submitter.LastName;
                //item.Index = (i + 1);
                source.Add(item);
            }

            records.ItemsSource = null;
            records.ItemsSource = source;

            int selectIndex = -1;

            for (int i = 0; i < source.Count; i++)
            {
                if (source[i].LeaveInfo.PKLeaveInfoID == currentGUID)
                {
                    selectIndex = i;
                }
            }

            records.SelectedIndex = selectIndex;

            ClientInstance.HideSpinner();
        }
Example #2
0
        public void Clean(bool full)
        {
            reason.Text             = string.Empty;
            leaveType.SelectedIndex = -1;
            description.Text        = string.Empty;
            datesList.ItemsSource   = null;
            if (leaveItem != null)
            {
                leaveItem = new LeaveItem();
            }
            AskedHours = 0;
            startTime.Clean();
            endTime.Clean();
            if (CurrentPage == CARSPage.ApproveLeave)
            {
                actButton.IsEnabled = false;
                if (rejectButton != null)
                {
                    rejectButton.IsEnabled = false;
                }
            }

            if (full)
            {
                annualLeaveLabel.Content = string.Empty;
                sickLeaveLabel.Content   = string.Empty;
            }
        }
Example #3
0
        private void records_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            selectedItem = (LeaveItem)records.SelectedItem;

            if (SelectionChanged != null)
            {
                SelectionChanged(sender, e);
            }
        }
Example #4
0
        private void records_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            LeaveItem obj = e.Row.DataContext as LeaveItem;

            if (obj.Status == LeaveStatus.Applying)
            {
                e.Row.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x33, 0xFF));
            }
            else
            {
                e.Row.Foreground = new SolidColorBrush(Colors.Black);
            }
        }
Example #5
0
        public void SetLeaveItem(LeaveItem item)
        {
            if (item == null)
            {
                Clean(true);
                return;
            }

            leaveItem = item;             // set current leave item
            if (mPage == CARSPage.ApproveLeave || mPage == CARSPage.LeaveHistory)
            {
                mUserHoursInfo = new User(item.LeaveInfo.Submitter);
            }
            else
            {
                mUserHoursInfo = mUser;
            }

            IsViewMode          = true;
            actButton.IsEnabled = true;
            if (rejectButton != null)
            {
                rejectButton.IsEnabled = true;
            }

            reason.Text      = item.Reason;
            description.Text = item.Description;
            for (int i = 0; i < leaveType.Items.Count; i++)
            {
                LeaveTypeValue lt = (LeaveTypeValue)leaveType.Items[i];
                if (lt.TypeValue.Name == leaveItem.LeaveInfo.Type.Name)
                {
                    leaveType.SelectedIndex = i;
                    break;
                }
            }
            startTime.SelectDateTime = item.LeaveInfo.FirstStartTime;
            endTime.SelectDateTime   = item.LeaveInfo.LastEndTime;
            datesList.ItemsSource    = null;
            datesList.ItemsSource    = item.List;

            AskedHours = item.Hours;

            // disable some buttons
            startTime.IsEnabled = endTime.IsEnabled = addToListButton.IsEnabled = removeFromListButton.IsEnabled = false;

            GetHoursInfo();
        }
Example #6
0
        private void SetLeaveValue(LeaveItem item)
        {
            if (item != null)
            {
                baseApplyInfo.reason.Content    = item.Reason;
                baseApplyInfo.description.Text  = item.Description;
                baseApplyInfo.leaveType.Content = item.TypeValue;

                foreach (DateRecords dr in item.List)
                {
                    baseApplyInfo.datesList.Items.Add(dr.Record);
                }

                baseApplyInfo.note.Content = "Asked: " + item.Hours.ToString() + " Hours";
            }
        }
Example #7
0
        public LeavePreview(User pUser, LeaveItem item, string warning)
        {
            InitializeComponent();

            ClientInstance.Get().ApplyLeaveCompleted += new EventHandler <ApplyLeaveCompletedEventArgs>(client_ApplyLeaveCompleted);

            SetLeaveValue(item);
            if (warning != "")
            {
                warningInfo.Height     = double.NaN;
                warningInfo.Visibility = System.Windows.Visibility.Visible;
                warningInfo.Text       = warning;
            }
            else
            {
                warningInfo.Height     = 0;
                warningInfo.Visibility = System.Windows.Visibility.Collapsed;
            }

            user      = pUser;
            leaveItem = item;
        }
Example #8
0
 public LeavePreview(User pUser, LeaveItem item)
     : this(pUser, item, "")
 {
     // nothing
 }