Example #1
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);
        }
        /// <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);
 }
 private void BindParameters(CSqlDbCommand cmd, ServiceEntity entityObject)
 {
     cmd.Parameters.AddWithValue("OUID", entityObject.OUID);
     cmd.Parameters.AddWithValue("PID", entityObject.PID);
     cmd.Parameters.AddWithValue("ExeName", entityObject.ExeName);
     cmd.Parameters.AddWithValue("TimeStamp", entityObject.TimeStamp);
 }
Example #5
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>
        /// 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);
        }
        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);
        }
Example #8
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);
        }
        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);
        }
Example #10
0
        private void BindParams(CSqlDbCommand cmd, TTIvrNotifications entityObject)
        {
            CSqlDbParamter parm = new CSqlDbParamter("RecID", entityObject.RecID);

            parm.DbType    = System.Data.DbType.Int32;
            parm.Direction = System.Data.ParameterDirection.InputOutput;
            cmd.Parameters.Add(parm);

            CSqlDbParamter phoneNumber = new CSqlDbParamter("PhoneNumber", entityObject.PhoneNumber);

            phoneNumber.DbType    = System.Data.DbType.String;
            phoneNumber.Size      = 20;
            phoneNumber.Direction = System.Data.ParameterDirection.InputOutput;
            cmd.Parameters.Add(phoneNumber);

            cmd.AddWithValue("QueueTime", entityObject.QueueTime);
            // cmd.AddWithValue("RecID", entityObject.RecID);
            cmd.AddWithValue("Notification_RecID", entityObject.Notification_RecID);
            cmd.AddWithValue("TransID", entityObject.TransID);
            cmd.AddWithValue("AlarmID", entityObject.AlarmID);
            cmd.AddWithValue("isSuccess", entityObject.isSuccess);
            cmd.AddWithValue("isInProcess", entityObject.isInProcess);
            cmd.AddWithValue("LastAttemptTime", entityObject.LastAttemptTime);
            cmd.AddWithValue("UserID", entityObject.UserID);
        }
        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);
        }
Example #12
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);
        }
Example #14
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);
        }
Example #15
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);
        }
        //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);
        }
Example #17
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);
        }
Example #18
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);
        }
        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);
        }
Example #20
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);
        }
        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);
        }
Example #22
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);
        }
 /// <summary>
 /// Method to bind parameter values to entity object
 /// </summary>
 /// <param name="cmd"></param>
 /// <param name="entity"></param>
 private void BindParameters(CSqlDbCommand cmd, PuckAlarm entity)
 {
     cmd.Parameters.AddWithValue("UTID", entity.UTID);
     cmd.Parameters.AddWithValue("Probe", entity.Probe);
     cmd.Parameters.AddWithValue("ProbeName", entity.ProbeName);
     cmd.Parameters.AddWithValue("AlarmType", entity.AlarmType);
     cmd.Parameters.AddWithValue("AlarmTime", entity.AlarmTime);
     cmd.Parameters.AddWithValue("AlarmData", entity.AlarmData);
     cmd.Parameters.AddWithValue("AlarmActive", entity.AlarmActive);
     cmd.Parameters.AddWithValue("MinTemp", entity.MinTemp);
     cmd.Parameters.AddWithValue("MaxTemp", entity.MaxTemp);
     cmd.Parameters.AddWithValue("AlarmProfileRecID", entity.AlarmProfileRecID);
     cmd.Parameters.AddWithValue("NotificationID", entity.NotificationID);
 }
Example #27
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);
        }
Example #28
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);
        }
Example #29
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);
        }