Пример #1
0
        /// <summary>
        /// Imprime el el Log del Guest
        /// </summary>
        /// <history>
        /// [jorcanche]  created 07/07/2016
        /// [edgrodriguez] 05/09/2016 Modified. Se cambio el método CreateExcelCustom por CreatCustomExcel
        /// </history>
        private async void btnPrintGuestLog_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dgGuestLog == null)
                {
                    return;
                }
                if (dgGuestLog.Items.Count == 0)
                {
                    UIHelper.ShowMessage("There is no info to make a report");
                    return;
                }
                Mouse.OverrideCursor = Cursors.Wait;
                FileInfo fileInfo = await ReportBuilder.CreateCustomExcelAsync(
                    TableHelper.GetDataTableFromList((List <GuestLogData>)dgGuestLog.ItemsSource, true, true, true),
                    new List <Tuple <string, string> > {
                    Tuple.Create("Guest Id", _idGuest.ToString())
                },
                    "Guest Log",
                    DateHelper.DateRangeFileName(DateTime.Today, DateTime.Today),
                    EpplusHelper.OrderColumns(dgGuestLog.Columns.ToList(), clsFormatReports.RptGuestLog()));

                if (fileInfo != null)
                {
                    frmDocumentViewer documentViewver = new frmDocumentViewer(fileInfo, Context.User.HasPermission(EnumPermission.RptExcel, EnumPermisionLevel.ReadOnly), false);
                    documentViewver.Owner = this;
                    documentViewver.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }
        }