//------------------------------------------------------------------------------------------------------------------------- // //------------------------------------------------------------------------------------------------------------------------- private void ServerHost_Opened(object sender, EventArgs e) { ISigner.WriteDebug("server channel opened...."); }
private void SignerWakeup(object stateInfo) { var _autoEvent = (AutoResetEvent)stateInfo; try { ISigner.WriteDebug("wakeup..."); DateTime _fromDay = UTextHelper.SNG.GetFirstDayOfLastMonth(); DateTime _tillDay = UTextHelper.SNG.GetLastDayOfThisMonth(); UTextHelper.SNG.GetSigningRange(ref _fromDay, ref _tillDay); // check table for auto-signing var _sqlstr = "SELECT invoicerId, COUNT(invoicerId) as norec, @fromDay as fromDay, @tillDay as tillDay " + " FROM TB_eTAX_INVOICE " + " WHERE isSuccess != @isSuccess " // for resignning, do check 'isSuccess' here + " AND issueDate>=@fromDay AND issueDate<=@tillDay " + " GROUP BY invoicerId"; var _dbps = new PgDatParameters(); { _dbps.Add("@isSuccess", NpgsqlDbType.Varchar, "T"); _dbps.Add("@fromDay", NpgsqlDbType.TimestampTz, _fromDay); _dbps.Add("@tillDay", NpgsqlDbType.TimestampTz, _tillDay); } var _ds = LSQLHelper.SelectDataSet(UAppHelper.ConnectionString, _sqlstr, _dbps); if (LSQLHelper.IsNullOrEmpty(_ds) == false) { var _rows = _ds.Tables[0].Rows; ELogger.SNG.WriteLog(String.Format("selected invoicer(s): {0} ", _rows.Count)); var _doneEvents = new ThreadPoolWait[_rows.Count]; for (int i = 0; i < _rows.Count; i++) { _doneEvents[i] = new ThreadPoolWait(); _doneEvents[i].QueueUserWorkItem(SignerCallback, _rows[i]); if (Environment.UserInteractive == true) { _doneEvents[i].WaitOne(); } } ThreadPoolWait.WaitForAll(_doneEvents); } } catch (SignerException ex) { ELogger.SNG.WriteLog(ex); } catch (Exception ex) { ELogger.SNG.WriteLog(ex); } finally { ISigner.WriteDebug("sleep..."); SignatureTimer.Change(UAppHelper.SignerDueTime, Timeout.Infinite); _autoEvent.Set(); } }
private void WcfHelper_Faulted(object sender, EventArgs e) { ISigner.WriteDebug(String.Format("client channel faulted: '{0}'", WcfServiceIp)); Stop(); }
private void ServerHost_Faulted(object sender, EventArgs e) { ISigner.WriteDebug("server channel faulted...."); Stop(); }