コード例 #1
0
        protected void sendOneAlert(object sender, EventArgs e)
        {
            Button          btn   = (Button)sender;
            List <object[]> data  = new List <object[]>();
            AlertMessenger  aMsgr = new AlertMessenger();

            string truckMsg = getTruckIdentifierMessage(btn);
            string tankMsg  = getTankCapacityMessage(btn);

            try
            {
                int alertID = Convert.ToInt32(btn.CommandArgument);
                EventAlertsHelper eaHelper = new EventAlertsHelper();
                eaHelper.createAndSendAlertEmail(alertID, truckMsg + tankMsg);
                eaHelper.createAndSendAlertSMS(alertID, truckMsg + tankMsg);
            }
            catch (SqlException excep)
            {
                string strErr = " SQLException Error in alertsProcessing sendOneAlert(). Details: " + excep.ToString();
                ErrorLogging.LogErrorAndRedirect(2, strErr);
            }
            catch (Exception ex)
            {
                string strErr = " Exception Error in alertsProcessing sendOneAlert(). Details: " + ex.ToString();
                ErrorLogging.LogErrorAndRedirect(1, strErr);
            }
            finally
            {
            }
        }
コード例 #2
0
        public int createNewEventLogAndTriggerExistingAlerts(string customAlertMsg)
        {
            int newEventID = 0;

            try
            {
                newEventID = createNewEventLog(this.MSEvent);
                if (newEventID > 0)
                {
                    this.MSEvent.setEventID(newEventID);
                    EventAlertsHelper eaHelper = new EventAlertsHelper();
                    eaHelper.sendAlertsForEvent(newEventID, customAlertMsg);
                }
                else
                {
                    throw new Exception("Error: Create New Log and Send Alert failed.)");
                }
            }
            catch (Exception ex)
            {
                string strErr = " Exception Error in MainScheduleEventLogger LogEventAndTriggerExistingAlerts(). Details: " + ex.ToString();
                ErrorLogging.WriteEvent(strErr, EventLogEntryType.Error);
                throw ex;
            }

            return(newEventID);
        }
コード例 #3
0
 public void TriggerExistingAlertForEvent(int EventID, string customAlertMsg)
 {
     try
     {
         EventAlertsHelper eaHelper = new EventAlertsHelper();
         eaHelper.sendAlertsForEvent(EventID, customAlertMsg);
     }
     catch (Exception ex)
     {
         string strErr = " Exception Error in MainScheduleEventLogger TriggerExistingAlertForEvent(). Details: " + ex.ToString();
         ErrorLogging.WriteEvent(strErr, EventLogEntryType.Error);
         throw ex;
     }
 }
コード例 #4
0
        private void processDataSetAndSendAlertEmail(DataSet dsAlerts, DateTime timestamp)
        {
            foreach (DataRow row in dsAlerts.Tables[0].Rows)
            {
                int    alertID  = Convert.ToInt32(row["alertID"]);
                int    MSID     = (row.Table.Columns.Contains("MSID")) ? Convert.ToInt32(row["MSID"]): 0;
                string objName  = string.Empty;
                string objValue = string.Empty;
                if (row.Table.Columns.Contains("ProductID_CMS"))
                {
                    //objName = "ProductID_CMS";
                    objValue = row["ProductID_CMS"].ToString();
                }

                else if (row.Table.Columns.Contains("TankID"))
                {
                    //objName = "TankID";
                    objValue = row["TankID"].ToString();
                }

                string trailerMsg = getTruckIdentifierMessage(row);
                string tankMsg    = getTankCapacityMessage(row);

                if (alertID > 0)
                {
                    EventAlertsHelper eaHelper = new EventAlertsHelper();
                    eaHelper.createAndSendAlertEmail(alertID, trailerMsg + tankMsg);
                    eaHelper.createAndSendAlertSMS(alertID, trailerMsg + tankMsg);

                    if (row.Table.Columns.Contains("MSID"))
                    {
                        updateAlertRunsTable(alertID, timestamp, Convert.ToInt32(row["MSID"]), objValue);
                    }
                    else
                    {
                        updateAlertRunsTable(alertID, timestamp, null, objValue);
                    }
                }
            }
        }