Esempio n. 1
0
        /// <summary>
        /// Muestra el Personnel Log en el DocumentViewer
        /// </summary>
        /// <history>
        /// [emoguel] 17/10/2016 created
        /// </history>
        private async void btnPrintlog_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                List <GetPersonnelLog> lstPersonnelLog = dtgPersonnelLog.ItemsSource as List <GetPersonnelLog>;

                FileInfo fileInfo = await ReportBuilder.CreateCustomExcelAsync(
                    TableHelper.GetDataTableFromList(lstPersonnelLog, true, true, true),
                    new List <Tuple <string, string> > {
                    Tuple.Create("Personnel ID", _idPersonnelLog)
                },
                    "Personnel Log",
                    DateHelper.DateRangeFileName(DateTime.Today, DateTime.Today),
                    EpplusHelper.OrderColumns(dtgPersonnelLog.Columns.ToList(), clsFormatReport.RptPersonnelLog()));

                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;
            }
        }
Esempio n. 2
0
        private void But_CreatExcel_Click(object sender, EventArgs e)
        {
            string    exportpath = txt_exportpath.Text.Trim();
            DataTable table      = (DataTable)dgv_content.DataSource;

            EpplusHelper.DataTableToExcel(table, "mysheet", exportpath);
            MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 3
0
        private void But_CreatExcel_Click(object sender, EventArgs e)
        {
            string    sql        = rtb_sql.Text.TrimEnd();
            DataTable dt         = sqlContent.GetTable(sql);
            string    exportpath = txt_exportpath.Text.Trim();

            EpplusHelper.DataTableToExcel(dt, "mysheet", exportpath);
            MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 4
0
        public FilePathResult DownloadOrderDetile(OrderSearchCriteria csc)
        {
            HttpContext HttpCurrent = System.Web.HttpContext.Current;
            var         data        = Ioc.Get <IOrderDetailService>().GetOrderDetail(csc);

            string[] title    = "1,2,3,4,5,6,7,8,9,10,11".Split(',');
            string   filename = $"~/file/excel/Export/Order{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx";

            filename = HttpCurrent.Server.MapPath(filename);
            filename = EpplusHelper.SaveToExcel(data, filename, title);
            return(File(filename, "application/octet-stream", $"订单{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls"));
        }
Esempio n. 5
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;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Exporta los registros de grid a un archivo de excel.
        /// </summary>
        /// <history>
        /// [edgrodriguez] 08/07/2016 Created
        /// [edgrodriguez] 05/09/2016 Modified. Se cambio el método CreateExcelCustom por CreatCustomExcel
        /// [emoguel] 08/09/2016 modified. Ahora abre el visor de reportes
        /// </history>
        private async void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (((List <ExchangeRateLogData>)_cvsExchangeRate.Source).Any())
            {
                var fileinfo = await ReportBuilder.CreateCustomExcelAsync(TableHelper.GetDataTableFromList((List <ExchangeRateLogData>)_cvsExchangeRate.Source, true, true, true),
                                                                          new List <Tuple <string, string> > {
                    Tuple.Create("Date Range", DateHelper.DateRange(DateTime.Today, DateTime.Today)), Tuple.Create("Gift ID", string.Join(",", ((List <ExchangeRateLogData>)_cvsExchangeRate.Source).Select(c => c.elcu).Distinct().ToList()))
                },
                                                                          "Exchange Rates Log", DateHelper.DateRangeFileName(DateTime.Today, DateTime.Today), EpplusHelper.OrderColumns(getExchangeRateLogDataGrid.Columns.ToList(), clsFormatReport.RptExchangeRatesLog()));

                if (fileinfo != null)
                {
                    frmDocumentViewer documentViewer = new frmDocumentViewer(fileinfo, Context.User.HasPermission(EnumPermission.RptExcel, EnumPermisionLevel.ReadOnly), false);
                    documentViewer.Owner = this;
                    documentViewer.ShowDialog();
                }
            }
            else
            {
                UIHelper.ShowMessage("There is no info to make a report");
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Exporta los registros de grid a un archivo de excel.
        /// </summary>
        /// <history>
        /// [edgrodriguez] 08/07/2016 Created
        /// [edgrodriguez] 05/09/2016 Modified. Se cambio el método CreateExcelCustom por CreatCustomExcel
        /// [emoguel] 08/09/2016 Modified. Ahora se abre el visor de reportes
        /// </history>
        private async void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (((List <SalesRoomLogData>)_salesRoomLog.Source).Any())
            {
                var fileinfo = await ReportBuilder.CreateCustomExcelAsync(TableHelper.GetDataTableFromList((List <SalesRoomLogData>)_salesRoomLog.Source, true, true, true),
                                                                          new List <Tuple <string, string> > {
                    Tuple.Create("Date Range", DateHelper.DateRange(DateTime.Today, DateTime.Today)), Tuple.Create("Sales Room ID", Context.User.SalesRoom.srID)
                },
                                                                          "Sales Rooms Log", DateHelper.DateRangeFileName(DateTime.Today, DateTime.Today), EpplusHelper.OrderColumns(dtgSalesRoomLog.Columns.ToList(), clsFormatReport.RptCloseSalesRoomLog()));

                if (fileinfo != null)
                {
                    frmDocumentViewer documentViewver = new frmDocumentViewer(fileinfo, Context.User.HasPermission(EnumPermission.RptExcel, EnumPermisionLevel.ReadOnly), false);
                    documentViewver.Owner = this;
                    documentViewver.ShowDialog();
                }
            }
            else
            {
                UIHelper.ShowMessage("There is no info to make a report");
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Guarda un excel con los datos del grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 01/07/2016
        /// [edgrodriguez] 05/09/2016 Modified. Se cambio el método CreateExcelCustom por CreatCustomExcel
        /// </history>
        private async void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                var fileinfo = await ReportBuilder.CreateCustomExcelAsync(TableHelper.GetDataTableFromList((List <GiftLogData>)dgrGifsLog.ItemsSource, true, true, true), new List <Tuple <string, string> > {
                    Tuple.Create("GIFT ID", idGift)
                },
                                                                          $"Gift Logs - {idGift}", DateHelper.DateRangeFileName(DateTime.Today, DateTime.Today), EpplusHelper.OrderColumns(dgrGifsLog.Columns.ToList(), clsFormatReport.RptGiftLog()));

                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;
            }
        }