Exemple #1
0
        /// <summary>
        /// The document will be exported according to the extension,
        /// which must be specified in the path information.  For now only .csv and .xlsx extension formats are supported
        /// </summary>
        /// <param name="path">Example: Example.xlxs</param>
        /// <param name="CurrencyCode"></param>
        /// <param name="CurrencyName"></param>
        /// <param name="BanknoteBuying"></param>
        /// <param name="BanknoteSelling"></param>
        /// <returns></returns>
        public async Task <bool> FilterByAndExport(string path, string CurrencyCode = null, string CurrencyName = null, string BanknoteBuying = null, string BanknoteSelling = null)
        {
            var currency = await FilterBy(CurrencyCode, CurrencyName, BanknoteBuying, BanknoteSelling);

            var table = currency.ToDataTable();

            Enum.TryParse(Path.GetExtension(path), out ApiExportExtensions extension);
            var exportService = ExportFactory.GetService(extension);

            return(await exportService.Export(table, path));
        }
Exemple #2
0
        /// <summary>
        /// The document will be exported according to the extension,
        /// which must be specified in the path information.  For now only .csv and .xlsx extension formats are supported
        /// </summary>
        public async Task <bool> SortByAndExport(string path, bool isAscending, bool CurrencyName = false, bool BanknoteBuying = false, bool BanknoteSelling = false, bool CurrencyCode = false, bool Isim = false)
        {
            var currency = await SortBy(isAscending, CurrencyName, BanknoteBuying, BanknoteSelling, CurrencyCode, Isim);

            var table = currency.ToDataTable();

            Enum.TryParse(Path.GetExtension(path), out ApiExportExtensions extension);
            var exportService = ExportFactory.GetService(extension);

            return(await exportService.Export(table, path));
        }
Exemple #3
0
        public async Task <bool> ExportAll(List <Currency> currency, string path)
        {
            var table = currency.ToDataTable();

            try
            {
                Enum.TryParse(Path.GetExtension(path), out ApiExportExtensions extension);
                var exportService = ExportFactory.GetService(extension);
                return(await exportService.Export(table, path));
            }
            catch
            {
                return(false);
            }
        }