コード例 #1
0
ファイル: List.cs プロジェクト: paulusyeung/RT2020
        private void OnCommandClick(object sender, EventArgs e)
        {
            if (!IsSelValid())
            {
                return;
            }

            var cmd = (Button)sender;

            switch (cmd.Name)
            {
            case "cmdPreview":
                htmlBox1.Html = RT2020.Reports.Inventory.Journal.List.HTML(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));
                break;

            case "cmdPDF":
                #region export PDF
                var pdf = RT2020.Reports.Inventory.Journal.List.PDF(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));

                if (pdf != null)
                {
                    var dl = new FileDownloadGateway();
                    dl.FileName = string.Format("{0}.{1}.pdf", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
                    dl.SetContentType(DownloadContentType.OctetStream);
                    dl.StartBytesDownload(this, pdf);
                }
                break;

                #endregion
            case "cmdExcel":
                #region export Excel
                var xls = RT2020.Reports.Inventory.Journal.List.Excel(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));

                if (xls != null)
                {
                    var dl = new FileDownloadGateway();
                    dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
                    dl.SetContentType(DownloadContentType.MicrosoftExcel);
                    dl.StartBytesDownload(this, xls);
                }
                break;

                #endregion
            case "cmdPivot":
                #region export PivotTable
                var pvt = RT2020.Reports.Inventory.Journal.List.Pivot(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));

                if (pvt != null)
                {
                    var dl = new FileDownloadGateway();
                    dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
                    dl.SetContentType(DownloadContentType.MicrosoftExcel);
                    dl.StartBytesDownload(this, pvt);
                }
                break;
                #endregion
            }
        }
コード例 #2
0
        private void btnGenerateTemplate_Click(object sender, EventArgs e)
        {
            String filePath = System.Web.HttpContext.Current.Server.MapPath("~/Resources/Templates/CAP Import Template.xlsx");
            var    dl       = new FileDownloadGateway();

            dl.FileName = "CAP Import Template.XLS";
            dl.SetContentType(DownloadContentType.MicrosoftExcel);
            dl.StartFileDownload(this, filePath);
        }
コード例 #3
0
ファイル: Summary.cs プロジェクト: paulusyeung/RT2020
        private void OnCommandClick(object sender, EventArgs e)
        {
            if (!IsSelValid())
            {
                return;
            }

            var cmd = (Button)sender;

            switch (cmd.Name)
            {
            case "cmdPreview":
                #region gen HTML Preview
                var id      = Guid.NewGuid();
                var subject = "SA1340-Summary";
                var json    = GetSelectionsJson();
                var result  = PipelineEx.Save(id, subject, json, (int)EnumHelper.Status.Active, DateTime.Now, ConfigHelper.CurrentUserId);
                if (result)
                {
                    htmlBox1.Html = RT2020.Reports.Inventory.Journal.Summary.HTML(id.ToString());
                }
                break;

                #endregion

            /** suspended
             * case "cmdPDF":
             #region export PDF
             *  var pdf = RT2020.Reports.Inventory.Journal.Monthly.PDF(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));
             *
             *  if (pdf != null)
             *  {
             *      var dl = new FileDownloadGateway();
             *      dl.FileName = string.Format("{0}.{1}.pdf", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
             *      dl.SetContentType(DownloadContentType.OctetStream);
             *      dl.StartBytesDownload(this, pdf);
             *  }
             *  break;
             #endregion
             * case "cmdExcel":
             #region export Excel
             *  var xls = RT2020.Reports.Inventory.Journal.Monthly.Excel(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd"));
             *
             *  if (xls != null)
             *  {
             *      var dl = new FileDownloadGateway();
             *      dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
             *      dl.SetContentType(DownloadContentType.MicrosoftExcel);
             *      dl.StartBytesDownload(this, xls);
             *  }
             *  break;
             #endregion
             */
            case "cmdPivot":
                #region export PivotTable
                var pvt = RT2020.Reports.Inventory.Journal.Summary.Pivot(GetSelections());

                if (pvt != null)
                {
                    var dl = new FileDownloadGateway();
                    dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1340", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss"));
                    dl.SetContentType(DownloadContentType.MicrosoftExcel);
                    dl.StartBytesDownload(this, pvt);
                }
                break;
                #endregion
            }
        }