コード例 #1
0
ファイル: frmAssistance.xaml.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Carga El grid Con la lista de asistencia con las fechas seleccionadas
        /// </summary>
        /// <history>[ECANUL] 19-03-2016 CREATED</history>
        async void LoadGrid()
        {
            StaStart("Loading Assistance List...");
            _listAssistData            = BRAssistance.GetAssistance(enumPalaceType, palaceId, dtpStartt.Value.Value, dtpEndd.Value.Value);
            assistanceDataViewSource   = ((CollectionViewSource)(this.FindResource("assistanceDataViewSource")));
            assistanceStatusViewSource = ((CollectionViewSource)(this.FindResource("assistanceStatusViewSource")));
            assistanceViewSource       = ((CollectionViewSource)(this.FindResource("assistanceViewSource")));
            AssistanceStatus ast = new AssistanceStatus();

            lstAssistStatus = await BRAssistancesStatus.GetAssitanceStatus(ast, 1);

            assistanceStatusViewSource.Source = lstAssistStatus;
            if (_listAssistData.Count != 0)
            {
                assistanceDataDataGrid.ItemsSource = _listAssistData;
                _isNew = false;
            }
            else
            {
                if (UIHelper.ShowMessage("There is no assistance for this week.\nWould you like to generate?", MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    List <PersonnelAssistance> lstPersonAssist = BRAssistance.GetPersonnelAssistance(enumPalaceType, palaceId, dtpStartt.Value.Value, dtpEndd.Value.Value);
                    lstPersonAssist.ForEach(c =>
                    {
                        var assistance = AssistanceToAssistance.ConvertPersonnelAssistanceToAssistanceData(c);
                        _listAssistData.Add(assistance);
                    });
                    _isNew            = true;
                    btnEdit.IsEnabled = true;
                }
                else
                {
                    btnEdit.IsEnabled = false;
                }
                assistanceDataDataGrid.ItemsSource = _listAssistData;
            }
            StaEnd();
        }
コード例 #2
0
        /// <summary>
        /// carga la lista de Assistance Status
        /// </summary>
        /// <history>
        /// [emoguel] 27/Feb/2016 Created
        /// </history>
        protected async void LoadAssitance(AssistanceStatus assistanceStatus = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <AssistanceStatus> lstAssistance = await BRAssistancesStatus.GetAssitanceStatus(_assistanceFilter, _nStatus);

                dtgAssitances.ItemsSource = lstAssistance;
                if (assistanceStatus != null && lstAssistance.Count > 0)
                {
                    assistanceStatus = lstAssistance.Where(ass => ass.atID == assistanceStatus.atID).FirstOrDefault();
                    nIndex           = lstAssistance.IndexOf(assistanceStatus);
                }
                GridHelper.SelectRow(dtgAssitances, nIndex);
                StatusBarReg.Content = lstAssistance.Count + " Assistance Status.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }