Exemplo n.º 1
0
        public async Task Close()
        {
            ISave save = null;

            switch (_settings.ExtractMethod)
            {
            case DataMethods.File:
            {
                save = new FileSave(_dataBacklinkRowService, _dataListedInfoService, _dataTagAService, _settings);

                break;
            }

            case DataMethods.GoogleDocs:
            {
                save = new SpreadSheetSave(_dataBacklinkRowService, _dataListedInfoService, _dataTagAService, _settings);
                break;
            }

            case DataMethods.Excell:
            {
                save = new ExcelSave(_dataBacklinkRowService, _dataListedInfoService, _dataTagAService, _settings);
                break;
            }
            }

            await save.Save();
        }
Exemplo n.º 2
0
        private void btn_statistic_Click(object sender, EventArgs e)
        {
            if (!ExcelSave.isTemplateValid(ExcelSave.RentTemplate))
            {
                mainWindow.dialogCreate("Сталась помилка!\n Не було знайдено шаблоний файл user.xslx",
                                        "Помилка шаблону", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter     = "Excel Files | *.xlsx";
            saveDialog.DefaultExt = "xlsx";

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                switch (terminedate)
                {
                case 0: ExcelSave.exportRent(saveDialog.FileName, stat_Year.statVehicles, stat_Year.startDate, stat_Year.endDate); break;

                case 1: ExcelSave.exportRent(saveDialog.FileName, stat_Month.statVehicles, stat_Month.startDate, stat_Month.endDate); break;

                case 2: ExcelSave.exportRent(saveDialog.FileName, stat_Week.statVehicles, stat_Week.startDate, stat_Week.endDate); break;

                case 3: ExcelSave.exportRent(saveDialog.FileName, stat_Custom.statVehicles, stat_Custom.startDate, stat_Custom.endDate); break;
                }

                //ExcelSave.exportRent(saveDialog.FileName, statInfo.statVehicles, statInfo.startDate, statInfo.endDate);

                mainWindow.dialogCreate("Ви успішно створили Excel-документ", "Збереження Excel", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 3
0
        private void btnTestExcelOutput_Click(object sender, EventArgs e)
        {
            string templeteFileName = "..\\..\\excelTemplate\\検収記録_template_1.xlsx";
            //string outputExcelFileName = "..\\..\\excelTemplate\\PDFTemp\\検収記録.xlsx";
            //string outputExcelFileName = this.saveExcelFileDialog.FileName;
            string outputExcelFileName = GetOutPutPath("検収記録.xlsx");
            string pdfFileName         = GetOutPutPath("検収記録.pdf");

            File.Copy(templeteFileName, outputExcelFileName, true);
            File.SetAttributes(outputExcelFileName, FileAttributes.Normal);

            //シート名
            string sheetName = "検収記録_例.店舗全体";

            //目標行の画線をコピーする
            ExcelFileSingleton excelSingleton = ExcelFileSingleton.GetInstance();

            try
            {
                excelSingleton.OpenExcel(outputExcelFileName);

                //新規の列(3列)を指定列(D:D)に挿入する
                excelSingleton.InsertColOfSheet(sheetName, "D", 3);

                // EXCELの固定セルの内容を設定する。
                SetHeadCellData2Excel(excelSingleton, sheetName);

                // EXCELの明細内容を設定する。
                SetDetailData2Excel(excelSingleton, sheetName);
            }
            catch (Exception ex)
            {
                ex.ToString();
                throw ex;
            }
            finally
            {
                excelSingleton.CloseExcel();
            }

            //ExcelファイルをPDFに変換する
            ExcelSave excelSave = new ExcelSave();

            excelSave.SaveAsPdf(outputExcelFileName, pdfFileName);

            //PDFに変換後、TempのExcelファイルを削除する
            //File.Delete(outputExcelFileName);

            MessageBox.Show("Output have been finished!!!");
        }
Exemplo n.º 4
0
        private async void bt_save_Click(object sender, RoutedEventArgs e)
        {
            ISave save = null;

            switch (_settings.ExtractMethod)
            {
            case DataMethods.File:
            {
                save = new FileSave(
                    new DataBacklinkRowService(_settings.ConnectionString),
                    new DataListedInfoService(_settings.ConnectionString),
                    new DataTagAService(_settings.ConnectionString),
                    _settings);
                break;
            }

            case DataMethods.GoogleDocs:
            {
                save = new SpreadSheetSave(
                    new DataBacklinkRowService(_settings.ConnectionString),
                    new DataListedInfoService(_settings.ConnectionString),
                    new DataTagAService(_settings.ConnectionString),
                    _settings);
                break;
            }

            case DataMethods.Excell:
            {
                save = new ExcelSave(
                    new DataBacklinkRowService(_settings.ConnectionString),
                    new DataListedInfoService(_settings.ConnectionString),
                    new DataTagAService(_settings.ConnectionString),
                    _settings);
                break;
            }
            }

            await save.Save();
        }
        private void btn_statistic_Click(object sender, EventArgs e)
        {
            if (!ExcelSave.isTemplateValid(ExcelSave.UserTemplate))
            {
                mainWindow.dialogCreate("Сталась помилка!\n Не було знайдено шаблоний файл user.xslx",
                                        "Помилка шаблону", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            SaveFileDialog saveDialog = new SaveFileDialog();

            saveDialog.Filter     = "Excel Files | *.xlsx";
            saveDialog.DefaultExt = "xlsx";

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                ExcelSave.exportAccount(saveDialog.FileName, account);

                mainWindow.dialogCreate("Ви успішно створили Excel-документ", "Збереження Excel", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }