Пример #1
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 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);
        }
Пример #3
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);
        }
        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);
        }
        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);
        }
Пример #6
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);
        }
Пример #7
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);
        }
        /// <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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
        /// <summary>
        /// Method to insert alarm information.
        /// </summary>
        /// <param name="entityObject"></param>
        /// <returns></returns>
        protected override PuckAlarm Insert(PuckAlarm entityObject)
        {
            /* Initializing the command object. */
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_PUCKALARM);

            cmd.Parameters.AddWithValue("action", "C");

            /* Declaring AlarmID  as output parameter.*/
            CSqlDbParamter alarmIdParam = new CSqlDbParamter("AlarmID");

            alarmIdParam.Direction = System.Data.ParameterDirection.InputOutput;
            alarmIdParam.DbType    = System.Data.DbType.Int32;
            alarmIdParam.Value     = entityObject.AlarmID;

            cmd.Parameters.Add(alarmIdParam);

            /*Bind parameters to command object.*/
            BindParameters(cmd, entityObject);

            /* Executing the procedure.*/
            CDAO.ExecCommand(cmd);

            entityObject.AlarmID = Convert.ToInt32(CDAO.Parameters["AlarmID"].Value);
            return(entityObject);
        }
 /// <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);
 }
        protected override IvrAlarmStatus ExecuteCommand()
        {
            //Initialize the CSqlDbCommand for execute the stored procedure
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_ALARMCLEARED);

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

            //Execute command
            CDAO.ExecReader(cmd);

            //Bind output values to IvrAlarmStatus object
            if (CDAO.DataReader.Read())
            {
                IsAlarmCleared = true;
            }
            else
            {
                IsAlarmCleared = false;
            }

            //return IvrAlarmStatus object
            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);
        }
Пример #15
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 IVRClearInProcessFlags ExecuteCommand()
        {
            //Initialize the CSqlDbCommand for execute the stored procedure
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_IVR_CLEARINPROCESS);

            //Execute command
            CDAO.ExecCommand(cmd);

            return(this);
        }
        protected override ServiceEntity Update(ServiceEntity entityObject)
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_SERVICE);

            cmd.Parameters.AddWithValue("action", "U");
            cmd.Parameters.AddWithValue("PID", entityObject.PID);
            CDAO.ConnectionString = entityObject.ExeName;
            CDAO.ExecScalar(cmd);
            return(entityObject);
        }
Пример #18
0
        /// <summary>
        /// Method to update isElapsed value to database based on UTID,Probe for which isElapsed is false.
        /// </summary>
        /// <param name="entityObject"></param>
        /// <returns></returns>
        protected override AlarmObject Update(AlarmObject entityObject)
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ALARMCURRENTSTATUS);

            cmd.Parameters.AddWithValue("action", "U");
            cmd.Parameters.AddWithValue("UTID", entityObject.UTID);
            cmd.Parameters.AddWithValue("Probe", entityObject.Probe);
            CDAO.ExecScalar(cmd);
            return(entityObject);
        }
Пример #19
0
        protected override NotificationCurrentStatusCommand ExecuteCommand()
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ALARMCURRENTSTATUS);

            cmd.Parameters.AddWithValue("action", "U");
            cmd.Parameters.AddWithValue("UTID", this.UTID);
            cmd.Parameters.AddWithValue("Probe", this.Probe);
            CDAO.ExecScalar(cmd);
            return(this);
        }
Пример #20
0
        protected override NotificationProcessResume ExecuteCommand()
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_DORESUMEPROCESS, System.Data.CommandType.StoredProcedure);

            cmd.AddWithValue("StoreID", StoreID);

            CDAO.ExecCommand(cmd);

            return(this);
        }
        /// <summary>
        /// Method to update alarm information.
        /// </summary>
        /// <param name="entityObject"></param>
        /// <returns></returns>
        protected override PuckAlarm Update(PuckAlarm entityObject)
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_PUCKALARM);

            cmd.Parameters.AddWithValue("action", "U");
            cmd.Parameters.AddWithValue("AlarmID", entityObject.AlarmID);
            cmd.Parameters.AddWithValue("AlarmActive", entityObject.AlarmActive);
            CDAO.ExecScalar(cmd);
            return(entityObject);
        }
        /// <summary>
        /// Method to delete alarm information.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        protected override int Remove(Criteria criteria)
        {
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_PUCKALARM);

            cmd.Parameters.AddWithValue("action", "R");
            cmd.Parameters.AddWithValue("AlarmID", criteria.ID);
            int i = CDAO.ExecCommand(cmd);

            return(i);
        }
        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);
        }
Пример #24
0
        protected override NotificationRemover ExecuteCommand()
        {
            /*Initialize the command.*/
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_REMOVE_NOTIFICATION, System.Data.CommandType.StoredProcedure);

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

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

            return(this);
        }
Пример #25
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);
        }
Пример #26
0
        /// <summary>
        /// Method to insert current alarm status into the database
        /// </summary>
        /// <param name="entityObject"></param>
        /// <returns></returns>
        protected override AlarmObject Insert(AlarmObject entityObject)
        {
            /* Initializing the command object. */
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ALARMCURRENTSTATUS);

            cmd.Parameters.AddWithValue("action", "C");

            /*Bind parameters to command object.*/
            BindParameters(cmd, entityObject);

            /* Executing the procedure.*/
            CDAO.ExecCommand(cmd);

            return(entityObject);
        }
        protected override ServiceEntity Insert(ServiceEntity entityObject)
        {
            /* Initializing the command object. */
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_SERVICE);

            cmd.Parameters.AddWithValue("action", "C");

            /*Bind parameters to command object.*/
            BindParameters(cmd, entityObject);

            /* Executing the procedure.*/
            CDAO.ExecScalar(cmd);

            return(entityObject);
        }
        protected override NotificationStatusUpdate ExecuteCommand()
        {
            /*Initialize the command.*/
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_UPDATENOTIFICATIONSTATUS, System.Data.CommandType.StoredProcedure);

            /*add parameters to command object*/
            cmd.AddWithValue("StoreID", StoreID);
            cmd.AddWithValue("NotificationID", NotificationID);
            // 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("IsProcessCompleted", Convert.ToInt32(IsProcessCompleted));

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

            return(this);
        }
Пример #29
0
        protected override AlarmNote ExecuteCommand()
        {
            /*Initialize the command.*/
            CSqlDbCommand cmd = new CSqlDbCommand(DBCommands.USP_NS_ADDNOTE, System.Data.CommandType.StoredProcedure);

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

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

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

            cmd.AddWithValue("StoreID", StoreID);
            cmd.AddWithValue("AlarmID", AlarmID);
            cmd.AddWithValue("UTID", UTID);
            cmd.AddWithValue("AlarmType", AlarmType);
            cmd.AddWithValue("Probe", Probe);

            object count = CDAO.ExecScalar(cmd);

            /*If the procedure returns count more than zero, consider it as the sensor comes to the normal range.*/
            SensorIsInRange = count.ToInt() > 0;

            return(this);
        }