예제 #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
        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);
                    }
                }
            }
        }