public bool WriteEvent(IEventDefinition def, IEventState state) { lock (_accessor) { string cmd; cmd = "INSERT INTO Events VALUES ("; cmd += "'" + def.Id + "', "; cmd += "'" + state.FormatText(def.Text) + "', "; cmd += "'" + state.Time.ToString("yyyy-MM-dd HH:mm:ss.fff") + "', "; cmd += "'" + (int)state.GetCause() + "');"; _accessor.ExeсCommand(cmd); } return(true); }
void source_EventChanged(IEventDefinition ev, IEventState state) { if (!_isConnected && !(state is FreeSCADA.Common.Events.States.StartedEventState)) { return; } try { SmsSubmitPdu[] pdus = _settings.TelNumbers.Cast <TelNumElement>().Select(t => new SmsSubmitPdu(state.FormatText(ev.Text), t.TelNum, (byte)DataCodingScheme.GeneralCoding.Alpha16Bit)).ToArray(); _comm.SendMessages(pdus); } catch (Exception e) { Env.Current.Logger.LogInfo(e.Message); } }