/// <summary> /// Удалить файлы счетов /// </summary> /// <param name="files">Провайдер имен файлов счета</param> /// <param name="outputDirectory">Каталог выгрузки</param> public static void RemoveFiles(InvoiceFilename files, string outputDirectory) { #if DEBUG string fname = outputDirectory + files.PersonFile + ".xml"; if (File.Exists(fname)) { File.Delete(fname); } fname = outputDirectory + files.InvoiceFile + ".xml"; if (File.Exists(fname)) { File.Delete(fname); } #endif }
/// <summary> /// Compress invoice files to ZIP archive /// </summary> /// <param name="names">Invoice filenames</param> /// <returns>True on success</returns> public static bool Compress(InvoiceFilename files) { string bin = Properties.Settings.Default.PathTo7Zip; if (!System.IO.File.Exists(bin)) { return(false); } ProcessStartInfo info = new ProcessStartInfo(bin); info.CreateNoWindow = true; info.WindowStyle = ProcessWindowStyle.Hidden; info.UseShellExecute = false; info.RedirectStandardError = true; info.RedirectStandardOutput = true; info.Arguments = string.Format(ARGUMENTS_7Z, invox.Options.OutputLocation, files.InvoiceFile, files.PersonFile); Process p = Process.Start(info); string error = p.StandardError.ReadToEnd(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); if (p.ExitCode != 0) { Logger.Log(output); Logger.Log(error); return(false); } else { return(true); } }
static bool Run(Data.IInvoice pool, Model.OrderSection section, ref int packet) { foreach (Model.ProphSubsection s in Model.ProphSubsectionHelper.GetSubsections(section, Options.Pediatric)) { Lib.InvoiceFilename files = Lib.InvoiceFilename.ToAssuranceFund( Options.LpuCode, Options.FomsCode, Options.Year, Options.Month, ++packet, section, s); Model.Invoice invoice = new Model.Invoice(files); if (!invoice.Export(pool, Options.OutputLocation, Options.LeaveFiles)) { Console.WriteLine("\r\nОшибка!\r\n"); return(false); } } return(true); }