Пример #1
0
        /// <summary>
        /// Genera el excel y lo guarda
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [ecanul] 15/03/2016 Created
        /// </history>
        private async void btnToExcel_Click(object sender, RoutedEventArgs e)
        {
            StaStart("Loading assistances Excel...");
            btnToExcel.IsEnabled = false;
            //Si tiene LeadSource se toma este de preferencia
            if (user.LeadSource != null)
            {
                filters.Add(Tuple.Create("Lead Sourse", user.LeadSource.lsID));
            }
            else
            {
                filters.Add(Tuple.Create("Sales Room", user.SalesRoom.srID));
            }

            _listAssistData = BRAssistance.GetAssistance(enumPalaceType, palaceId, dtpStartt.Value.Value, dtpEndd.Value.Value);
            if (_listAssistData.Count > 0)
            {
                FileInfo file = await ExportReports.RptAssitance(_listAssistData, dtpStartt.Value.Value, dtpEndd.Value.Value, filters);

                if (file != null)
                {
                    frmDocumentViewer documentViewver = new frmDocumentViewer(file, user.HasPermission(EnumPermission.RptExcel, EnumPermisionLevel.ReadOnly), false);
                    documentViewver.Owner = this;
                    documentViewver.ShowDialog();
                }
            }
            else
            {
                UIHelper.ShowMessage("There is no Information to generate the report", MessageBoxImage.Exclamation, "Save the data");
            }
            StaEnd();
            btnToExcel.IsEnabled = true;
        }
Пример #2
0
        /// <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();
        }