Пример #1
0
        /// <summary>
        /// Get Format string
        /// </summary>
        /// <returns></returns>
        protected override FormatString ExecuteCommand()
        {
            try
            {
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETFORMATSTRING);
                cmd.AddWithValue("FormatID", FormatID);
                cmd.AddWithValue("LanguageID", LanguageID);
                cmd.AddWithValue("SensorType", SensorType);
                CDAO.ExecReader(cmd);
                if (CDAO.DataReader.Read())
                {
                    ComposeString = CDAO.DataReader["FormatString"].ToStr();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        /// <summary>
        /// Get Contact state string value
        /// </summary>
        /// <returns></returns>
        protected override ContactState ExecuteCommand()
        {
            try
            {
                CSqlDbCommand cmd = new CSqlDbCommand("SP_TTGETCONTACTSENSORTEXT");
                cmd.AddWithValue("UTID", UTID);
                cmd.AddWithValue("Probe", Probe);
                cmd.AddWithValue("State", contactState);
                cmd.AddWithValue("LanguageID", LanguageID);

                CDAO.ExecReader(cmd);
                if (CDAO.DataReader.Read())
                {
                    contactStateString = CDAO.DataReader["StateText"].ToStr();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
 /// <summary>
 /// Get Sensor Format ID
 /// </summary>
 /// <returns></returns>
 protected override SensorFormatString ExecuteCommand()
 {
     try
     {
         CSqlDbCommand cmd = new CSqlDbCommand("USP_NS_GETSENSORFORMATSTRINGID");
         cmd.AddWithValue("UTID", UTID);
         cmd.AddWithValue("Probe", Probe);
         cmd.AddWithValue("FormatType", FormatType);
         cmd.AddWithValue("Action", Action);
         CDAO.ExecReader(cmd);
         if (CDAO.DataReader.Read())
         {
             SensorFormatID = CDAO.DataReader["FormatID"].ToInt();
         }
     }
     catch
     {
         throw;
     }
     finally
     {
         CDAO.CloseDataReader();
         CDAO.Dispose();
     }
     return(this);
 }
Пример #4
0
        protected override NotificationAcknowledgement ExecuteCommand()
        {
            try
            {
                /* Create command object for sql operation*/
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IS_NOTIFICATION_ACKNOWLEDGED, System.Data.CommandType.StoredProcedure);

                cmd.AddWithValue("AlarmID", AlarmID);
                cmd.AddWithValue("StoreID", StoreID);

                /* execute the command */
                CDAO.ExecReader(cmd);

                if (CDAO.DataReader.Read())
                {
                    IsAlarmCleared       = CDAO.DataReader["IsAlarmCleared"].ToBoolean();
                    ClearedTime          = CDAO.DataReader["ClearedTime"].ToDateTime();
                    IsAlarmClearedByUser = CDAO.DataReader["AlarmClearedByUser"].ToBoolean();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        protected override SensorCurrentStatus ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETCURRENTVALUE);

                //Bind  property values as input parameters for procedure
                cmd.AddWithValue("UTID", UTID);
                cmd.AddWithValue("Probe", Probe);


                //Execute command
                CDAO.ExecReader(cmd);

                //Bind output values to IvrAlarmStatus object

                if (CDAO.DataReader.Read())
                {
                    CurrentTime  = TypeCommonExtensions.IfNull(CDAO.DataReader["CurrentTime"], DateTime.UtcNow).ToDateTime();
                    CurrentValue = CDAO.DataReader["CurrentValue"].ToDecimal();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        protected override CheckBackInAccept ExecuteCommand()
        {
            try
            {
                /*Initialize the command.*/
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_CHECKBACKINACCEPT, System.Data.CommandType.StoredProcedure);

                /*add parameters to command object*/
                cmd.AddWithValue("NotificationID", NotificationID);
                cmd.AddWithValue("StoreID", StoreID);

                /*execute command*/
                CDAO.ExecReader(cmd);

                if (CDAO.DataReader.Read())
                {
                    IsBackInAcceptableRange = CDAO.DataReader["BackInRange"].ToBoolean();
                    LogCount = CDAO.DataReader["LogCount"].ToInt();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
Пример #7
0
        protected override InstanceType ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand("SELECT COUNT(TABLE_NAME) AS [Count] FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'OrganizationalUnits'", System.Data.CommandType.Text);

                //Execute command
                CDAO.ExecReader(cmd);
                if (CDAO.DataReader.Read())
                {
                    IsMultiDB = CDAO.DataReader["Count"].ToString() == "1" ? true : false;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        protected override NotifyPagerAddressList LoadList(BaseCriteria criteria)
        {
            try
            {
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYPAGERADDRESSLIST, System.Data.CommandType.StoredProcedure);
                cmd.AddWithValue("NotifyID", criteria.ID);

                //Execute command
                CDAO.ExecReader(cmd);

                while (CDAO.DataReader.Read())
                {
                    NotifyPagerAddress notifyPagerAddress = new NotifyPagerAddress();
                    notifyPagerAddress.PagerName      = CDAO.DataReader["Name"].ToStr();
                    notifyPagerAddress.PhoneNumber    = CDAO.DataReader["PagerPhone"].ToStr();
                    notifyPagerAddress.PagerDelay     = CDAO.DataReader["PagerDelay"].ToInt();
                    notifyPagerAddress.DeliveryMethod = CDAO.DataReader["PagerDeliveryMethod"].ToInt();
                    notifyPagerAddress.PagerMessage   = CDAO.DataReader["PagerMessage"].ToStr();

                    this.Add(notifyPagerAddress);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
Пример #9
0
        /// <summary>
        /// Gets all active IVR alarms.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        protected override TTIVRNotificationThreads LoadList(BaseCriteria criteria)
        {
            try
            {
                Criteria listCriteria = (Criteria)criteria;

                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETIVRNOTIFICATIONTHREADLIST, System.Data.CommandType.StoredProcedure);

                //Execute reader
                CDAO.ExecReader(cmd);

                /*fill the object and add to list.*/
                while (CDAO.DataReader.Read())
                {
                    IvrAlarm alarm = new IvrAlarm();

                    alarm.ThreadID = CDAO.DataReader["ThreadID"].ToInt();


                    this.Add(alarm);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
Пример #10
0
        protected override RelaySwitchConfig Load(Criteria criteria)
        {
            RelaySwitchConfig relaySwitchConfig = new RelaySwitchConfig();

            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYSWITCH);
                cmd.Parameters.AddWithValue("SwitchNotifyID", criteria.ID);
                //Execute reader
                CDAO.ExecReader(cmd);
                while (CDAO.DataReader.Read())
                {
                    relaySwitchConfig.NotifyID   = CDAO.DataReader["NotifyID"].ToInt();
                    relaySwitchConfig.IsEnabled  = CDAO.DataReader["isEnabled"].ToBoolean();
                    relaySwitchConfig.Name       = CDAO.DataReader["Name"].ToStr();
                    relaySwitchConfig.SwitchInfo = CDAO.DataReader["SwitchInfo"].ToStr();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(relaySwitchConfig);
        }
Пример #11
0
        protected override NotifyMobileList LoadList(BaseCriteria criteria)
        {
            try
            {
                /*Initialize the command.*/
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYMOBILELIST, System.Data.CommandType.StoredProcedure);
                cmd.AddWithValue("NotifyID", criteria.ID);

                //Execute command
                CDAO.ExecReader(cmd);

                while (CDAO.DataReader.Read())
                {
                    NotifyMobiles notifyMobiles = new NotifyMobiles();
                    notifyMobiles.MobileNumber = CDAO.DataReader["MobileNumber"].ToStr();
                    notifyMobiles.Name         = CDAO.DataReader["Name"].ToStr();
                    this.Add(notifyMobiles);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        //public int threadID { get; set; }

        protected override IvrIsInProcess ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_ISINPROCESS);


                //  cmd.AddWithValue("NotificationID", NotificationID);
                cmd.AddWithValue("StoreID", StoreID);
                // This stored procedure was changed to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0

                cmd.AddWithValue("PhoneNumber", phoneNumber);
                //   cmd.AddWithValue("AlarmID", AlarmID);
                //    cmd.AddWithValue("isSucceeded", IsSucceeded.ToInt());
                //   cmd.AddWithValue("numAttempts", numAttempts);



                //Execute command
                CDAO.ExecReader(cmd);
                //while (CDAO.DataReader.Read())
                //{
                //    IsAlarmInIVRProcess = CDAO.DataReader["IsInProcess"].ToBoolean();
                //    LastAttemptTime = TypeCommonExtensions.IfNull(CDAO.DataReader["LastAttemptTime"], DateTime.UtcNow).ToDateTime();
                //    phoneNumber = CDAO.DataReader["PhoneNumber"].ToString();
                //    IsSucceeded = CDAO.DataReader["IsSuccess"].ToBoolean();
                //    numAttempts = CDAO.DataReader["numAttempts"].ToInt();
                //    threadID = CDAO.DataReader["ThreadID"].ToInt();

                //}

                // Bind output values to IvrAlarmStatus object
                // if stored procedure returns a record, then it is either cleared,in-range, or in-process (call alert is not complete)
                if (CDAO.DataReader.Read())
                {
                    IsAlarmInIVRProcess = true;
                    // IsSucceeded = CDAO.DataReader["IsSuccess"].ToBoolean();
                    //  numAttempts = CDAO.DataReader["numAttempts"].ToInt();
                }
                else
                {
                    IsAlarmInIVRProcess = false;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            //return IvrAlarmStatus object
            return(this);
        }
Пример #13
0
        protected override NotifyPopupAddressList LoadList(BaseCriteria criteria)
        {
            try
            {
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYPOPUPADDRESSLIST, System.Data.CommandType.StoredProcedure);
                cmd.AddWithValue("NotifyID", criteria.ID);

                //Execute command
                CDAO.ExecReader(cmd);

                while (CDAO.DataReader.Read())
                {
                    if (CDAO.DataReader["NetSendTo"].ToStr().Contains(";") == true)
                    {
                        string[] notifyPopupAddressEntries = CDAO.DataReader["NetSendTo"].ToStr().Split(';');
                        foreach (string notifyPopupAddressEntry in notifyPopupAddressEntries)
                        {
                            NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress();
                            notifyPopupAddress.NetSendTo = notifyPopupAddressEntry.Trim();
                            notifyPopupAddress.Name      = CDAO.DataReader["Name"].ToStr().Trim();
                            this.Add(notifyPopupAddress);
                        }
                    }

                    else if (CDAO.DataReader["NetSendTo"].ToStr().Contains(",") == true)
                    {
                        string[] notifyPopupAddressEntries = CDAO.DataReader["NetSendTo"].ToStr().Split(',');
                        foreach (string notifyPopupAddressEntry in notifyPopupAddressEntries)
                        {
                            NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress();

                            notifyPopupAddress.NetSendTo = notifyPopupAddressEntry.Trim();
                            notifyPopupAddress.Name      = CDAO.DataReader["Name"].ToStr().Trim();
                            this.Add(notifyPopupAddress);
                        }
                    }
                    else
                    {
                        NotifyPopupAddress notifyPopupAddress = new NotifyPopupAddress();
                        notifyPopupAddress.NetSendTo = CDAO.DataReader["NetSendTo"].ToStr().Trim();
                        notifyPopupAddress.Name      = CDAO.DataReader["Name"].ToStr().Trim();
                        this.Add(notifyPopupAddress);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
        protected override EscalationList LoadList(BaseCriteria criteria)
        {
            try
            {
                /* Initialize the command object. */
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETESCALATIONPROFILEINFO, System.Data.CommandType.StoredProcedure);
                cmd.Parameters.AddWithValue("EscalationProfileID", criteria.ID);

                /* Execute the command. */
                CDAO.ExecReader(cmd);

                /* To know current escalation level*/
                short _level = 1;
                //   LogBook.Write("Looking up Escaltion List using Profile ID: " + criteria.ID);
                while (CDAO.DataReader.Read())
                {
                    EscalationInfo escalationInfo = new EscalationInfo()
                    {
                        EscalationID               = CDAO.DataReader["RecID"].ToInt(),
                        NotifyProfileID            = CDAO.DataReader["NotificationProfileID"].ToInt(),
                        ProfileName                = CDAO.DataReader["ProfileName"].ToStr(),
                        StopEscOnUserAck           = (CDAO.DataReader["Flags"].ToInt() & 1).ToBoolean(),
                        StopEscOnSesnorNormalState = (CDAO.DataReader["Flags"].ToInt() & 2).ToBoolean(),
                        SwitchBitmask              = CDAO.DataReader["SwitchBitmask"].ToInt16(),
                        WaitSecs        = CDAO.DataReader["WaitSecs"].ToInt(),
                        IsFailSafe      = (CDAO.DataReader["Ordering"].ToInt() == 6), //6 indicates the failsafe escalation. other are normal escalations.
                        PagerPrompt     = CDAO.DataReader["PagerPrompt"].ToStr(),
                        Severity        = (CooperAtkins.Interface.Alarm.Severity)CDAO.DataReader["Severity"],
                        EscalationLevel = _level
                    };

                    if (escalationInfo.StopEscOnUserAck == false && escalationInfo.StopEscOnSesnorNormalState == false)
                    {
                        LogBook.Write("Default using 'Stop Escalation on user Ack/Clear', since both user & auto are false: " + escalationInfo.ProfileName);
                        escalationInfo.StopEscOnUserAck = true;
                    }

                    this.Add(escalationInfo);
                    _level++;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
Пример #15
0
        /// <summary>
        /// to fetch the message board configuration list
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        protected override MessageBoardConfigList LoadList(BaseCriteria criteria)
        {
            //CDAO.Connection = EnterpriseModel.Net.
            try
            {
                Criteria listCriteria = (Criteria)criteria;
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETNOTIFYMSGBOARDIDLIST);
                if (listCriteria.ID == null)
                {
                    cmd.AddWithValue("MsgBoardNotifyID", System.DBNull.Value);
                }
                else
                {
                    cmd.AddWithValue("MsgBoardNotifyID", listCriteria.ID);
                }

                //Execute reader
                CDAO.ExecReader(cmd);
                while (CDAO.DataReader.Read())
                {
                    MessageBoardConfig messageBoardConfig = new MessageBoardConfig()
                    {
                        NotifyID           = CDAO.DataReader["NotifyID"].ToInt(),
                        MessageBoardName   = CDAO.DataReader["Name"].ToStr(),
                        IsNetworkConnected = CDAO.DataReader["NetworkConnection"].ToBoolean(),
                        IpAddress          = CDAO.DataReader["IPAddress"].ToStr(),
                        Port        = CDAO.DataReader["Port"].ToInt(),
                        COMSettings = CDAO.DataReader["Settings"].ToStr(),
                        IsEnabled   = CDAO.DataReader["isEnabled"].ToBoolean(),
                        //IsGroup = CDAO.DataReader["IsGroup"].ToBoolean(),
                        BoardType = CDAO.DataReader["BoardType"].ToInt()
                    };

                    this.Add(messageBoardConfig);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
Пример #16
0
        protected override IvrAlarmStatus ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ISALARMCLEARDORBACKINRANGE);

                //Bind IvrAlarmStatus  property values as input parameters for procedure
                // cmd.AddWithValue("AlarmID"    , AlarmID);
                cmd.AddWithValue("NotificationID", NotificationID);
                cmd.AddWithValue("StoreID", StoreID);
                // This stored procedure was change to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0
                //cmd.AddWithValue("IsSucceeded", Convert.ToInt32(IsSucceeded)); //call successed or not



                //Execute command
                CDAO.ExecReader(cmd);

                //Bind output values to IvrAlarmStatus object
                //if stored procedure returns a record, then it is either cleared,in-range, or in-process (call alert is not complete)
                if (CDAO.DataReader.Read())
                {
                    //if (CDAO.DataReader.HasRows)
                    IsAlarmClearedOrBackInRange = true;
                }
                else
                {
                    IsAlarmClearedOrBackInRange = false;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            //return IvrAlarmStatus object
            return(this);
        }
        protected override SensorTypeInfoList LoadList(BaseCriteria criteria)
        {
            try
            {
                Criteria listCriteria = (Criteria)criteria;
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETSENSORTYPEINFOLIST, System.Data.CommandType.Text);

                //Execute reader
                CDAO.ExecReader(cmd);
                while (CDAO.DataReader.Read())
                {
                    SensorTypeInfo sensorTypeInfo = new SensorTypeInfo()
                    {
                        ID          = CDAO.DataReader["RecID"].ToInt(),
                        Offset1     = CDAO.DataReader["Offset1"].ToDouble(),
                        Offset2     = CDAO.DataReader["Offset2"].ToDouble(),
                        Scale1      = CDAO.DataReader["Scale1"].ToDouble(1),
                        Scale2      = CDAO.DataReader["Scale2"].ToDouble(1),
                        UOM         = CDAO.DataReader["UOM"].ToStr(),
                        Description = CDAO.DataReader["Description"].ToStr(CDAO.DataReader["SensorType"].ToStr()),
                        SensorType  = CDAO.DataReader["SensorType"].ToStr(),
                        SubType     = CDAO.DataReader["SubType"].ToStr(),
                        nDecimals   = CDAO.DataReader["nDecimals"].ToInt(),
                        isTemp      = CDAO.DataReader["isTemp"].ToBoolean()
                    };

                    this.Add(sensorTypeInfo);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
Пример #18
0
        /// <summary>
        /// Record Notification
        /// </summary>
        /// <returns></returns>
        protected override RecordNotification ExecuteCommand()
        {
            //Initialize the CSqlDbCommand for execute the stored procedure
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_RECORDNOTIFICATION, System.Data.CommandType.StoredProcedure);

            cmd.AddWithValue("NotificationID", NotificationID);
            cmd.AddWithValue("TransID", TransID);
            cmd.AddWithValue("Status", (int)Status);
            cmd.AddWithValue("LogText", LogText);
            cmd.AddWithValue("NotifyType", (int)this.NotifyType);

            //Execute command
            CDAO.ExecCommand(cmd);

            //Close the data reader.
            CDAO.CloseDataReader();

            CDAO.Dispose();
            //return filled object.
            return(this);
        }
Пример #19
0
        protected override MissedCommunicationList LoadList(BaseCriteria criteria)
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETMISSEDCOMMUNICATION);
                //Execute command
                CDAO.ExecReader(cmd);

                //Create new object to assign retrieved values.
                while (CDAO.DataReader.Read())
                {
                    MissedComm missedComm = new MissedComm();
                    missedComm.GroupName       = CDAO.DataReader["GroupName"].ToStr();
                    missedComm.PuckName        = CDAO.DataReader["PuckName"].ToStr();
                    missedComm.SensorType      = CDAO.DataReader["SensorType"].ToStr();
                    missedComm.FactoryID       = CDAO.DataReader["FactoryID"].ToStr();
                    missedComm.UTID            = CDAO.DataReader["UTID"].ToStr();
                    missedComm.Probe           = CDAO.DataReader["Probe"].ToInt();
                    missedComm.Interval        = CDAO.DataReader["Interval"].ToInt();
                    missedComm.LogIntervalMins = CDAO.DataReader["LogIntervalMins"].ToInt();
                    missedComm.LastContact     = CDAO.DataReader["LastContact"].ToDateTime();
                    this.Add(missedComm);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            //return filled object.
            return(this);
        }
Пример #20
0
        protected override AlarmStatus ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ISALARMCLEARDORBACKINRANGE);

                //Bind IvrAlarmStatus  property values as input parameters for procedure
                cmd.AddWithValue("NotificationID", NotificationID);
                cmd.AddWithValue("StoreID", StoreID);

                //Execute command
                CDAO.ExecReader(cmd);

                //Bind output values to IvrAlarmStatus object
                if (CDAO.DataReader.Read())
                {
                    IsAlarmClearedOrBackInRange = true;
                }
                else
                {
                    IsAlarmClearedOrBackInRange = false;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            //return IvrAlarmStatus object
            return(this);
        }
Пример #21
0
        protected override MissedCommInfo ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETMISSEDCOMMSETTINGS);


                int storeID = ConfigurationManager.AppSettings["StoreID"].ToInt();

                cmd.AddWithValue("StoreID", storeID);

                //Execute command
                CDAO.ExecReader(cmd);

                //Create new object to assign retrieved values.
                if (CDAO.DataReader.Read())
                {
                    this.StoreID = CDAO.DataReader["StoreID"].ToInt();
                    this.NotificationProfileID = CDAO.DataReader["NotificationProfileID"].ToInt();
                    this.SwitchBitmask         = CDAO.DataReader["SwitchBitmask"].ToInt16();
                    this.PagerPrompt           = CDAO.DataReader["PagerPrompt"].ToStr();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            //return filled object.
            return(this);
        }
        /// <summary>
        /// to fetch the notify id ,based on the notify profile id
        /// </summary>
        /// <returns></returns>
        protected override NotificationProfile ExecuteCommand()
        {
            try
            {
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GETACTIVENOTIFICATIONS);
                cmd.AddWithValue("ProfileID", NotifyProfileID);
                cmd.AddWithValue("StoreID", StoreID);
                CDAO.ExecReader(cmd);

                if (CDAO.DataReader.Read())
                {
                    NotifyType       = CDAO.DataReader["NotifyType"].ToInt();
                    EmailNotifyID    = CDAO.DataReader["EmailNotifyID"].ToInt();
                    PagerNotifyID    = CDAO.DataReader["PagerNotifyID"].ToInt();
                    MsgBoardNotifyID = CDAO.DataReader["MsgBoardNotifyID"].ToInt();
                    NetSendNotifyID  = CDAO.DataReader["NetSendNotifyID"].ToInt();
                    SwitchNotifyID   = CDAO.DataReader["SwitchNotifyID"].ToInt();
                    PagerPrompt      = CDAO.DataReader["PagerPrompt"].ToStr();
                    SwitchBitMask    = CDAO.DataReader["SwitchBitMask"].ToInt();
                    IVR_UserID       = CDAO.DataReader["IVR_UserID"].ToInt();
                    IsAlertEnabled   = CDAO.DataReader["IsAlertEnabled"].ToBoolean();
                    ProfileName      = CDAO.DataReader["ProfileName"].ToStr();
                    SMSNotifyID      = CDAO.DataReader.HasColumn("SMSNotifyID") ? CDAO.DataReader["SMSNotifyID"] != null ? CDAO.DataReader["SMSNotifyID"].ToInt() : 0 : 0;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
        protected override OrganizationalUnitList LoadList(BaseCriteria criteria)
        {
            try
            {
                Criteria listCriteria = (Criteria)criteria;
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_ORGANIZATIONALUNITS);
                //Execute reader
                CDAO.ExecReader(cmd);
                while (CDAO.DataReader.Read())
                {
                    OrganizationalUnit orgUnit = new OrganizationalUnit()
                    {
                        OUID     = CDAO.DataReader["OUID"].ToInt(),
                        OGID     = CDAO.DataReader["OGID"].ToInt(),
                        OUName   = CDAO.DataReader["OUName"].ToStr(),
                        DBName   = CDAO.DataReader["DBName"].ToStr(),
                        DSN      = CDAO.DataReader["DSN"].ToStr(),
                        isActive = CDAO.DataReader["isActive"].ToBoolean()
                    };

                    this.Add(orgUnit);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
        public void UpdateGenStoreValues()
        {
            GenStoreInfo genStoreInfo = null;

            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GENSTORES);

                int storeID = ConfigurationManager.AppSettings["StoreID"].ToInt();

                cmd.AddWithValue("StoreID", storeID);

                //Execute command
                CDAO.ExecReader(cmd);


                //Create new object to assign retrieved values.
                if (CDAO.DataReader.Read())
                {
                    genStoreInfo = new GenStoreInfo
                    {
                        //JH - 10/22/15
                        //setting the StoreID value was causing issue on lines 54-59 of NotificationEligibility
                        //StoreID = CDAO.DataReader["StoreID"].ToInt(),
                        FromAddress      = CDAO.DataReader["EmailFromAddress"].ToStr(),
                        FromName         = CDAO.DataReader["EmailFromName"].ToStr(),
                        SmtpSendMethod   = CDAO.DataReader["SMTPSendMethod"].ToInt(),
                        SmtpAuthDomain   = CDAO.DataReader["SMTPAuthDomain"].ToStr(),
                        SmtpAuthPassword = CDAO.DataReader["SMTPAuthPass"].ToStr(),
                        SmtpAuthUserName = CDAO.DataReader["SMTPAuthUser"].ToStr(),
                        SmtpFlags        = CDAO.DataReader["SMTPFlags"].ToInt(),
                        SmtpPort         = CDAO.DataReader["SMTPport"].ToInt(),
                        SmtpServer       = CDAO.DataReader["SMTPserver"].ToStr(),
                        SNPPPort         = CDAO.DataReader["SNPPPort"].ToInt(),
                        SNPPServer       = CDAO.DataReader["SNPPServer"].ToStr(),
                        PagerComPort     = CDAO.DataReader["PagerCOMport"].ToInt16(),
                        ComPortInitStr   = CDAO.DataReader["COMportInitString"].ToStr(),
                        SMTPAuthMethod   = CDAO.DataReader["SMTPAuthMethod"].ToStr(),
                        //for Mobile SMS
                        PIN1                     = CDAO.DataReader["SMSPIN1"].ToStr(),
                        PIN2                     = CDAO.DataReader["SMSPIN2"].ToStr(),
                        MobileCOMPort            = CDAO.DataReader["SMSCOMPort"].ToStr(),
                        MobileCOMSettings        = CDAO.DataReader["SMSSettings"].ToStr(),
                        SMSProviderServiceCenter = CDAO.DataReader["SMSServiceContactNo"].ToStr(),
                        StoreName                = CDAO.DataReader["StoreName"].ToStr(),
                        StorePhoneNumber         = CDAO.DataReader["Telephone"].ToStr(),
                        FrequencyBand            = CDAO.DataReader.HasColumn("FrequencyBand") ? CDAO.DataReader["FrequencyBand"] != null ? CDAO.DataReader["FrequencyBand"].ToStr() : string.Empty : string.Empty,
                        CDYNE_ACCOUNT            = CDAO.DataReader.HasColumn("IVRSvcAcctID") ? CDAO.DataReader["IVRSvcAcctID"] != null ? CDAO.DataReader["IVRSvcAcctID"].ToStr() : string.Empty : string.Empty
                    };
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            _GenStoreInfo = genStoreInfo;
        }
        protected override CurrentStatusAlarmList LoadList(BaseCriteria baseCriteria)
        {
            try
            {
                Criteria      criteria = (Criteria)baseCriteria;
                CSqlDbCommand cmd      = new CSqlDbCommand(DBCommands.USP_NS_ALARMCURRENTSTATUS, System.Data.CommandType.StoredProcedure);
                cmd.Parameters.AddWithValue("action", "L");

                // This stored procedure was changed to an integer because on SQL 2000 the bit was being sent as a 'T' or an 'F' instead of a 1 or 0

                if (criteria.Fields != null)
                {
                    cmd.Parameters.AddWithValue("isServiceRestarted", Convert.ToInt32(criteria.Fields["isServiceRestarted"]));
                }
                else
                {
                    cmd.Parameters.AddWithValue("isServiceRestarted", DBNull.Value);
                }

                CDAO.ExecReader(cmd);

                while (CDAO.DataReader.Read())
                {
                    AlarmObject alarm = new AlarmObject();
                    alarm.UTID                           = CDAO.DataReader["UTID"].ToStr();
                    alarm.Probe                          = CDAO.DataReader["Probe"].ToInt();
                    alarm.ProbeName                      = CDAO.DataReader["ProbeName"].ToStr();
                    alarm.ProbeName2                     = CDAO.DataReader["ProbeName2"].ToStr();
                    alarm.FactoryID                      = CDAO.DataReader["FactoryID"].ToStr();
                    alarm.AlarmType                      = CDAO.DataReader["AlarmType"].ToInt16();
                    alarm.AlarmID                        = CDAO.DataReader["AlarmID"].ToInt();
                    alarm.SensorType                     = CDAO.DataReader["SensorType"].ToStr();
                    alarm.SensorClass                    = CDAO.DataReader["SensorClass"].ToStr();
                    alarm.SensorAlarmID                  = CDAO.DataReader["SensorAlarmID"].ToStr();
                    alarm.AlarmTime                      = CDAO.DataReader["AlarmTime"].ToDateTime();
                    alarm.AlarmStartTime                 = CDAO.DataReader["AlarmStartTime"].ToDateTime();
                    alarm.Value                          = CDAO.DataReader["Value"].ToDecimal();
                    alarm.AlarmMaxValue                  = CDAO.DataReader["AlarmMaxValue"].ToDecimal();
                    alarm.AlarmMinValue                  = CDAO.DataReader["AlarmMinValue"].ToDecimal();
                    alarm.Threshold                      = CDAO.DataReader["Threshold"].ToInt();
                    alarm.CondThresholdMins              = CDAO.DataReader["CondThresholdMins"].ToInt();
                    alarm.TimeOutOfRange                 = CDAO.DataReader["TimeOutOfRange"].ToInt();
                    alarm.NotificationID                 = CDAO.DataReader["NotificationID"].ToInt();
                    alarm.AlarmProfileID                 = CDAO.DataReader["AlarmProfileID"].ToInt();
                    alarm.NotifyProfileID                = CDAO.DataReader["NotifyProfileID"].ToInt();
                    alarm.EscalationProfileID            = CDAO.DataReader["EscalationProfileID"].ToInt();
                    alarm.PagerMessage                   = CDAO.DataReader["PagerMessage"].ToStr();
                    alarm.SwitchBitmask                  = CDAO.DataReader["SwitchBitmask"].ToInt16();
                    alarm.Severity                       = (Severity)CDAO.DataReader["Severity"].ToInt();
                    alarm.ResetNotifyOnUserAck           = CDAO.DataReader["ResetNotifyOnUserAck"].ToBoolean();
                    alarm.ResetNotifyOnSensorNormalRange = CDAO.DataReader["ResetNotifyOnSensorNormalRange"].ToBoolean();
                    alarm.DisplayValue                   = CDAO.DataReader["DisplayValue"].ToStr();
                    // Only allow "ShowCelsius" flag to be set for "TEMP" type sensors
                    alarm.IsCelsius             = CDAO.DataReader["IsCelsius"].ToBoolean();
                    alarm.GroupName             = CDAO.DataReader["GroupName"].ToStr();
                    alarm.IsResumedNitification = CDAO.DataReader["IsResumedNitification"].ToBoolean();
                    alarm.NotificationStartTime = CDAO.DataReader["NotificationStartTime"].ToDateTime();
                    alarm.IsElapsed             = CDAO.DataReader["IsElapsed"].ToBoolean();
                    alarm.NotificationType      = CDAO.DataReader["NotificationType"].ToStr();
                    alarm.EscRecID = CDAO.DataReader["EscalationRecID"].ToInt();
                    alarm.NotificationSentCount = CDAO.DataReader["NotificationSentCount"].ToInt();
                    this.Add(alarm);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            return(this);
        }
Пример #26
0
        /// <summary>
        /// Gets Email Body
        /// </summary>
        /// <returns></returns>
        protected override EmailBody ExecuteCommand()
        {
            try
            {
                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.SP_TTNOTIFY_EMAILBODY);

                cmd.AddWithValue("emailFormat", EmailFormat);
                cmd.AddWithValue("UTID", UTID);
                cmd.AddWithValue("Probe", Probe);
                //cmd.AddWithValue("logTime", LogTime);
                if (LogTime.HasValue == true)
                {
                    cmd.AddWithValue("logTime", ((DateTime)LogTime).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                else
                {
                    cmd.AddWithValue("logTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                }
                cmd.AddWithValue("tzOffset", TzOffset);
                cmd.AddWithValue("SensorReading", SensorReading);
                if (AlarmStartTime.HasValue == true)
                {
                    cmd.AddWithValue("AlarmStartTime", ((DateTime)AlarmStartTime).ToString("yyyy-MM-dd HH:mm:ss"));
                }
                else
                {
                    cmd.AddWithValue("AlarmStartTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                }

                cmd.AddWithValue("AlarmProfileRecID", AlarmProfileRecID);
                cmd.AddWithValue("ThresholdMins", ThresholdMins);
                cmd.AddWithValue("CondThresholdMins", CondThresholdMins);
                cmd.AddWithValue("CondMinValue", CondMinValue);
                cmd.AddWithValue("CondMaxValue", CondMaxValue);
                cmd.AddWithValue("IncludeHistory", IncludeHistory);
                cmd.AddWithValue("ValuesUOM", ValuesUOM);
                cmd.AddWithValue("HTMLlink", HTMLlink);
                cmd.AddWithValue("Severity", (int)Severity);

                //Execute command
                CDAO.ExecReader(cmd);

                //Create new object to assign retrieved values.
                while (CDAO.DataReader.Read())
                {
                    this.Body = this.Body + CDAO.DataReader[0].ToStr();
                    CDAO.DataReader.NextResult();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }
            //return filled object.
            return(this);
        }
        /// <summary>
        /// Gets all active IVR alarms.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        protected override IvrAlarmList LoadList(BaseCriteria criteria)
        {
            try
            {
                Criteria listCriteria = (Criteria)criteria;

                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GET_IVRALARMLIST, System.Data.CommandType.StoredProcedure);
                cmd.AddWithValue("numAttempts", NumAttempts);
                //Execute reader
                CDAO.ExecReader(cmd);

                /*fill the object and add to list.*/
                while (CDAO.DataReader.Read())
                {
                    IvrAlarm alarm = new IvrAlarm();

                    alarm.IVRPhoneNumber  = CDAO.DataReader["PhoneNumber"].ToStr();
                    alarm.AlarmID         = CDAO.DataReader["AlarmID"].ToInt();
                    alarm.IsSuccess       = CDAO.DataReader["isSuccess"].ToBoolean();
                    alarm.NotificationID  = CDAO.DataReader["Notification_RecID"].ToInt();
                    alarm.AttemptCount    = CDAO.DataReader["numAttempts"].ToInt16();
                    alarm.QueueTime       = TypeCommonExtensions.IfNull(CDAO.DataReader["QueueTime"], DateTime.UtcNow).ToDateTime();
                    alarm.LastAttemptTime = TypeCommonExtensions.IfNull(CDAO.DataReader["LastAttemptTime"], DateTime.UtcNow).ToDateTime();
                    alarm.IvrAlarmID      = CDAO.DataReader["RecID"].ToInt();

                    alarm.UTID       = CDAO.DataReader["UTID"].ToStr();
                    alarm.Probe      = CDAO.DataReader["Probe"].ToInt();
                    alarm.SensorType = CDAO.DataReader["SensorType"].ToStr();
                    if (CDAO.DataReader["IVR_SensorName"] != DBNull.Value)
                    {
                        alarm.IVR_SensorName = CDAO.DataReader["IVR_SensorName"].ToStr();
                    }
                    else
                    {
                        alarm.IVR_SensorName = (CDAO.DataReader["PuckName"].ToStr() == string.Empty ? "Sensor" : CDAO.DataReader["PuckName"].ToStr());
                    }

                    alarm.Value = CDAO.DataReader["AlarmData"].ToDecimal();

                    alarm.AlarmMaxValue     = CDAO.DataReader["CondMaxValue"].ToDecimal();
                    alarm.AlarmMinValue     = CDAO.DataReader["CondMinValue"].ToDecimal();
                    alarm.CondThresholdMins = CDAO.DataReader["CondThresholdMins"].ToInt();
                    alarm.AlarmTime         = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmTime"], DateTime.UtcNow).ToDateTime();

                    alarm.IVRUserID  = CDAO.DataReader["UserID"].ToInt();
                    alarm.PersonName = CDAO.DataReader["FirstName"].ToString() + " " + CDAO.DataReader["LastName"].ToString();

                    alarm.LanguageID     = (CDAO.DataReader["LanguageID"].ToInt() == 0 ? 1 : CDAO.DataReader["LanguageID"].ToInt());
                    alarm.IsCelsius      = CDAO.DataReader["isCelsius"].ToBoolean();
                    alarm.StoreName      = GenStoreInfo.GetInstance().StoreName;
                    alarm.IvrID          = CDAO.DataReader["RecID"].ToInt();
                    alarm.StoreNumber    = GenStoreInfo.GetInstance().StorePhoneNumber.ToString();
                    alarm.AlarmStartTime = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmStartTime"], DateTime.UtcNow).ToDateTime();

                    //if (alarm.AlarmID > 0)
                    this.Add(alarm);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                CDAO.Dispose();
            }

            return(this);
        }
Пример #28
0
        /// <summary>
        /// Gets alarm list.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        protected override AlarmList LoadList(BaseCriteria criteria)
        {
            try
            {
                Criteria listCriteria = (Criteria)criteria;

                //Initialize the CSqlDbCommand for execute the stored procedure
                CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_GET_ALARMLIST, System.Data.CommandType.StoredProcedure);

                //Execute reader
                CDAO.ExecReader(cmd);
                bool flag = true;

                System.Collections.Hashtable extFields = null;
                List <string> fields = new List <string>();

                while (CDAO.DataReader.Read())
                {
                    //For the first time get all the field names
                    if (flag)
                    {
                        for (int index = 0; index < CDAO.DataReader.FieldCount; index++)
                        {
                            fields.Add(CDAO.DataReader.GetName(index));
                        }

                        //Remove known fields from the list.
                        fields.Remove("UTID");
                        fields.Remove("Probe");
                        fields.Remove("ProbeName");
                        fields.Remove("PuckDesc2");
                        fields.Remove("FactoryID");
                        fields.Remove("AlarmType");
                        fields.Remove("AlarmID");
                        fields.Remove("SensorType");
                        fields.Remove("SensorClass");
                        fields.Remove("Options");
                        fields.Remove("AlarmData");
                        fields.Remove("CondMaxValue");
                        fields.Remove("CondMinValue");
                        fields.Remove("CondThresholdMins");
                        fields.Remove("NotificationRecID");
                        fields.Remove("AlarmProfileRecID");
                        fields.Remove("NotificationProfileID");
                        fields.Remove("EscalationProfileID");
                        fields.Remove("AlarmTime");
                        fields.Remove("AlarmStartTime");
                        fields.Remove("PagerMessage");
                        fields.Remove("SwitchBitmask");
                        fields.Remove("Severity");
                        fields.Remove("GroupName");
                        fields.Remove("NotifyResetFlags");


                        flag = false;
                    }


                    extFields = new System.Collections.Hashtable();

                    //Adding all extra fields in to a hash table.
                    foreach (string item in fields)
                    {
                        extFields.Add(item, CDAO.DataReader[item]);
                    }


                    AlarmObject alarm = new AlarmObject();
                    alarm.AddtionalFields = extFields;


                    alarm.UTID        = CDAO.DataReader["UTID"].ToStr();
                    alarm.Probe       = CDAO.DataReader["Probe"].ToInt();
                    alarm.ProbeName   = CDAO.DataReader["ProbeName"].ToStr();
                    alarm.ProbeName2  = CDAO.DataReader["PuckDesc2"].ToStr();
                    alarm.FactoryID   = CDAO.DataReader["FactoryID"].ToStr();
                    alarm.AlarmType   = CDAO.DataReader["AlarmType"].ToInt16();
                    alarm.AlarmID     = CDAO.DataReader["AlarmID"].ToInt();
                    alarm.SensorType  = CDAO.DataReader["SensorType"].ToStr();
                    alarm.SensorClass = CDAO.DataReader["SensorClass"].ToStr();
                    //alarm.IsNewAlarmRecordWasCreated = (CDAO.DataReader["Options"].ToInt() == 0 ? false : true);


                    if (alarm.AlarmType >= AlarmType.RESETMODE)
                    {
                        //if the alarm type is reset, then
                        alarm.SensorAlarmID = alarm.UTID + "_" + alarm.Probe + "_" + (alarm.AlarmType - AlarmType.RESETMODE).ToString();
                    }
                    else
                    {
                        alarm.SensorAlarmID = alarm.UTID + "_" + alarm.Probe + "_" + alarm.AlarmType.ToString();
                    }

                    alarm.AlarmTime = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmTime"], DateTime.UtcNow).ToDateTime();

                    alarm.AlarmStartTime = TypeCommonExtensions.IfNull(CDAO.DataReader["AlarmStartTime"], alarm.AlarmTime).ToDateTime();

                    if (alarm.AlarmStartTime == DateTime.MinValue || alarm.AlarmStartTime < DateTime.Parse("1/1/2000"))
                    {
                        alarm.AlarmStartTime = alarm.AlarmTime;
                    }

                    alarm.Value = CDAO.DataReader["AlarmData"].ToDecimal();

                    alarm.AlarmMaxValue                  = CDAO.DataReader["CondMaxValue"].ToDecimal();
                    alarm.AlarmMinValue                  = CDAO.DataReader["CondMinValue"].ToDecimal();
                    alarm.Threshold                      = Common.DateDiff("n", alarm.AlarmStartTime, alarm.AlarmTime);
                    alarm.CondThresholdMins              = CDAO.DataReader["CondThresholdMins"].ToInt();
                    alarm.TimeOutOfRange                 = Common.DateDiff("n", alarm.AlarmStartTime, alarm.AlarmTime);
                    alarm.NotificationID                 = CDAO.DataReader["NotificationRecID"].ToInt();
                    alarm.AlarmProfileID                 = CDAO.DataReader["AlarmProfileRecID"].ToInt();
                    alarm.NotifyProfileID                = CDAO.DataReader["NotificationProfileID"].ToInt();
                    alarm.EscalationProfileID            = CDAO.DataReader["EscalationProfileID"].ToInt();
                    alarm.PagerMessage                   = CDAO.DataReader["PagerPrompt"].ToStr();
                    alarm.SwitchBitmask                  = CDAO.DataReader["SwitchBitmask"].ToInt16();
                    alarm.Severity                       = (Severity)CDAO.DataReader["Severity"].ToInt();
                    alarm.DisplayValue                   = alarm.Value.ToString();
                    alarm.ResetNotifyOnUserAck           = (CDAO.DataReader["NotifyResetFlags"].ToInt() & 1).ToBoolean();
                    alarm.ResetNotifyOnSensorNormalRange = (CDAO.DataReader["NotifyResetFlags"].ToInt() & 2).ToBoolean();

                    if (AlarmHelper.IsContactSensor(alarm.SensorType))
                    {
                        if (alarm.Value == 0)
                        {
                            alarm.DisplayValue = "CLOSED";
                        }
                        else
                        {
                            alarm.DisplayValue = "OPEN";
                        }
                    }


                    // Only allow "ShowCelsius" flag to be set for "TEMP" type sensors
                    alarm.IsCelsius = (AlarmHelper.IsTempSensor(alarm.SensorType) ? (((CDAO.DataReader["NotifyFlags"].ToInt()) & 0x1) != 0) : false);

                    alarm.GroupName = CDAO.DataReader["GroupName"].ToStr();

                    //ProcessStatus will be returned as "O" if it is a old notification.
                    if (CDAO.DataReader["ProcessStatus"].ToStr() == "O")
                    {
                        alarm.IsResumedNitification = true;
                    }
                    else
                    {
                        alarm.IsResumedNitification = false;
                    }



                    this.Add(alarm);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                CDAO.CloseDataReader();
                // Added on 2/19/2012
                // To dispose the data reader object
                // Srinivas Rao E
                CDAO.Dispose();
            }
            return(this);
        }