public ReportProcessingJob(ProcessingJobsSharedTools processingJobsSharedTools, ServerErrorReport report)
		{
			this.tools = processingJobsSharedTools;
			this.report = report;
			reportHashCode = tools.GetReportHashCode(this.report);

			inProcessingTicketsList = new List<ReportProcessingTicket>(tools.GetTicketsOfTypeInProcessing(reportHashCode));
			sentTicketsList = new List<ReportProcessingTicket>(tools.GetTicketsOfTypeAlreadySent(reportHashCode));
			toBeUploadedTicketsList = new List<ReportProcessingTicket>(tools.GetTicketsOfTypeToBeUploaded(reportHashCode));
			uploadingTicketsList = new List<ReportProcessingTicket>(tools.GetAllUploadingTicketsOfType(reportHashCode));

			allTicketsList = new List<ReportProcessingTicket>();
			allTicketsList.AddRange(sentTicketsList);
			allTicketsList.AddRange(inProcessingTicketsList);
			allTicketsList.AddRange(toBeUploadedTicketsList);
			allTicketsList.AddRange(uploadingTicketsList);

			ticket = new ReportProcessingTicket();
			ticket.ReportHashcode = reportHashCode;
		}
		private UploableErrorReportingEngine(string reportsFolderPath, int intervalOfDays, int maxNumberErrReport,bool addSnapshotToReport)
		{
			reportsFolder = new DirectoryInfo(Path.Combine(reportsFolderPath, "MiniReports"));
			PathUtils.TryCreatePath(reportsFolder.FullName);
			reportsToUploadFolder = reportsFolder.CreateSubdirectory("ToUpload");
			uploadingReportsFolder = reportsFolder.CreateSubdirectory("Uploading");
			processingFolder = reportsFolder.CreateSubdirectory("Processing");
			lastSentItemsFileInfo = new FileInfo(Path.Combine(reportsFolder.FullName, LAST_SENT_ITEMS_FILE_NAME));

			//try clear processing and uploading folder
			try
			{
				List<FileInfo> files = new List<FileInfo>();
				//files.AddRange(uploadingReportsFolder.GetFiles("err*.zip"));
				//files.AddRange(uploadingReportsFolder.GetFiles("issue*.zip"));
				files.AddRange(uploadingReportsFolder.GetFiles("err*.*"));
				files.AddRange(uploadingReportsFolder.GetFiles("issue*.*"));

				foreach (FileInfo file in files)
				{
					file.MoveTo(Path.Combine(reportsToUploadFolder.FullName, file.Name));
				}
				processingFolder.Delete(true);
				uploadingReportsFolder.Delete(true);
				processingFolder = reportsFolder.CreateSubdirectory("Processing");
				uploadingReportsFolder = reportsFolder.CreateSubdirectory("Uploading");
			}
			catch (Exception e)
			{
				ProcessException.Handle(e);
				Debug.WriteLine(e);
			}
      
			tools = new ProcessingJobsSharedTools(intervalOfDays, maxNumberErrReport, addSnapshotToReport, 
			                                      processingFolder, reportsToUploadFolder, uploadingReportsFolder,
			                                      lastSentItemsFileInfo);
			PackageUploadManager.Initialize(tools);

			//Uploder uploader = new Uploder(PackageUploadManager.Instance);
			//uploader.TryDoUploads();

			//return;

			ThreadPool.QueueUserWorkItem(delegate(object state)
			{
				Uploder uploader = new Uploder(PackageUploadManager.Instance);
				uploader.TryDoUploads();
			});
		}
 private PackageUploadManager(ProcessingJobsSharedTools tools)
 {
     this.tools = tools;
 }
 public static void Initialize(ProcessingJobsSharedTools tools)
 {
     instance = new PackageUploadManager(tools);
 }