private void SenderWorking() { // clear 'X' flag { int _norec = EMailer.ClearXFlag(); ELogger.SNG.WriteLog(String.Format("While starting, updated to 'F' {0} record(s) that isMailSending was 'X'.", _norec)); } // Do not use using statement AutoResetEvent _autoEvent = new AutoResetEvent(false); { SendingTimer = new Timer(SenderWakeup, _autoEvent, TimeSpan.FromSeconds(1).Milliseconds, Timeout.Infinite); int _iteration = 0; ELogger.SNG.WriteLog ( String.Format ( "productid->{0}, liveServer->{1}, mailerDueTime->{2}, debugMode->{3}, mailSniffing->{4}, soapFiltering->{5}, eMailFolder->{6}", UAppHelper.QMaster.ProductId, UAppHelper.LiveServer, UAppHelper.MailerDueTime, CfgHelper.SNG.DebugMode, UAppHelper.MailSniffing, UAppHelper.SoapFiltering, UAppHelper.eMailFolder ) ); while (_autoEvent.WaitOne() == true && ShouldStop == false) { IMailer.WriteDebug(String.Format("waiting: {0}...", ++_iteration)); } SendingTimer.Dispose(); } }
/// <summary> /// /// </summary> /// <param name="p_certapp"></param> /// <param name="p_invoicerId"></param> /// <returns></returns> public int ClearXFlag(Guid p_certapp, string p_invoicerId) { int _result = 0; try { if (IMailer.CheckValidApplication(p_certapp) == true) { _result = EMailer.ClearXFlag(p_invoicerId); } } catch (MailerException ex) { ELogger.SNG.WriteLog(ex); } catch (Exception ex) { ELogger.SNG.WriteLog(ex); } return(_result); }