Exemplo n.º 1
0
        public static void ExportGenreXLSX()
        {
            LogManager.Trace(GetLog("Export Genre XLSX", "Start"));

            string filePath = "";

            try
            {
                string         exePath       = Assembly.GetExecutingAssembly().Location;
                FileSystemInfo exeFileInfo   = new FileInfo(exePath);
                string         fileDirectory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryExport"));

                ZOperationResult   operationResult = new ZOperationResult();
                ChinookApplication application     =
                    (ChinookApplication)Container.Resolve <IChinookApplication>();

                // WorkSheet

                LogManager.Trace(GetLog("Export Genre", "Worksheet"));
                if (application.ExportGenreXLSX(operationResult, fileDirectory,
                                                out filePath))
                {
                    LogManager.Trace(GetLog("Export Genre", "e-mail"));

                    string body = @"
Hi,

Attached you will find the [Genre.xlsx] worksheet.

Sincerely,
Chinook";
                    (new MailManager()).Mail("Chinook", "EasyLOB", "*****@*****.**",
                                             "Chinook - Export Genre", body, false, new string[] { filePath });
                }
                else
                {
                    LogManager.LogOperationResult(operationResult);
                }
            }
            catch (Exception exception)
            {
                LogManager.LogException(exception);
            }
            //finally
            //{
            //    if (!String.IsNullOrEmpty(filePath))
            //    {
            //        File.Delete(filePath);
            //    }
            //}

            LogManager.Trace(GetLog("Export Genre", "Stop"));
        }
Exemplo n.º 2
0
        public static string ExportGenreTXT()
        {
            LogManager.Trace(GetLog("Export Genre TXT", "Start"));

            string filePath = "";

            try
            {
                string         exePath       = Assembly.GetExecutingAssembly().Location;
                FileSystemInfo exeFileInfo   = new FileInfo(exePath);
                string         fileDirectory = Path.Combine(Path.GetDirectoryName(exePath), LibraryHelper.AppSettings <string>("DirectoryExport"));

                ZOperationResult   operationResult = new ZOperationResult();
                ChinookApplication application     =
                    (ChinookApplication)Container.Resolve <IChinookApplication>();
                ChinookGenericApplication <Genre> genreApplication =
                    (ChinookGenericApplication <Genre>)Container.Resolve <IChinookGenericApplication <Genre> >();

                // Clean Z-Export

                application.Clean(operationResult, fileDirectory);

                // Text File

                LogManager.Trace(GetLog("Export Genre", "Text File"));

                if (!application.ExportGenreTXT(operationResult, fileDirectory, genreApplication,
                                                out filePath))
                {
                    LogManager.LogOperationResult(operationResult);
                }
            }
            catch (Exception exception)
            {
                LogManager.LogException(exception);
            }

            LogManager.Trace(GetLog("Export Genre", "Stop"));

            return(filePath);
        }