Exemplo n.º 1
0
 public void LogProcess(object caller, RFProcessEntry p)
 {
     if (p != null)
     {
         try
         {
             using (var connection = new SqlConnection(_connectionString))
             {
                 connection.Open();
                 using (var insertCommand = new SqlCommand("INSERT INTO RIFF.ProcessLog( [Timestamp],[Hostname],[GraphName],[ProcessName],[Instance],[ValueDate],[IOTime],[ProcessingTime],[Success],[Message],[NumUpdates] ) VALUES " +
                                                           "( @Timestamp,@Hostname,@GraphName,@ProcessName,@Instance,@ValueDate,@IOTime,@ProcessingTime,@Success,@Message,@NumUpdates )", connection))
                 {
                     insertCommand.Parameters.AddWithValue("@Timestamp", new DateTimeOffset(DateTime.Now));
                     insertCommand.Parameters.AddWithValue("@Hostname", RFStringHelpers.StringToSQL(Environment.MachineName.ToLower(), false, 50, false));
                     insertCommand.Parameters.AddWithValue("@GraphName", RFStringHelpers.StringToSQL(p.GraphName, true, 50, false));
                     insertCommand.Parameters.AddWithValue("@ProcessName", RFStringHelpers.StringToSQL(p.ProcessName, false, 100, false));
                     insertCommand.Parameters.AddWithValue("@Instance", RFStringHelpers.StringToSQL(p.GraphInstance?.Name, true, 30, false));
                     insertCommand.Parameters.AddWithValue("@ValueDate", p.GraphInstance?.ValueDate?.Date ?? (object)DBNull.Value);
                     insertCommand.Parameters.AddWithValue("@IOTime", p.IOTime);
                     insertCommand.Parameters.AddWithValue("@ProcessingTime", p.ProcessingTime);
                     insertCommand.Parameters.AddWithValue("@Success", p.Success);
                     insertCommand.Parameters.AddWithValue("@Message", RFStringHelpers.StringToSQL(p.Message, true, 1014, true));
                     insertCommand.Parameters.AddWithValue("@NumUpdates", p.NumUpdates);
                     insertCommand.ExecuteNonQuery();
                 }
             }
         }
         catch (Exception ex)
         {
             Exception(this, ex, "Error logging in Process Log");
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Do not override or call base when you do
 /// </summary>
 public virtual void Initialize(RFEngineProcessorParam p, IRFProcessingContext context, RFKeyDomain keyDomain, string processName)
 {
     InstanceParams = p?.ConvertTo <P>();
     Context        = context;
     KeyDomain      = keyDomain;
     ProcessName    = processName;
     _isCancelling  = false;
     _processEntry  = null;
     Log            = new RFProcessLog(Context.SystemLog, context.UserLog, this);
 }
Exemplo n.º 3
0
 public void SetProcessEntry(RFProcessEntry processEntry)
 {
     _processEntry = processEntry;
 }