Example #1
0
        /// <summary>
        /// Method to get the specified node
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="nodeId">nodeId</param>
        /// <param name="nodeType">nodeType</param>
        /// <returns>node information</returns>
        public NodeInfo GetNode(int lscId, int nodeId, EnmNodeType nodeType)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",    SqlDbType.Int),
                                         new SqlParameter("@NodeID",   SqlDbType.Int),
                                         new SqlParameter("@NodeType", SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = nodeId;
                parms[2].Value = (int)nodeType;

                NodeInfo node = null;
                using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_NODE_GETNODE, parms)) {
                    if (rdr.Read())
                    {
                        node            = new NodeInfo();
                        node.LscID      = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        node.NodeID     = ComUtility.DBNullInt32Handler(rdr["NodeID"]);
                        node.NodeType   = ComUtility.DBNullNodeTypeHandler(rdr["NodeType"]);
                        node.Value      = ComUtility.DBNullFloatHandler(rdr["Value"]);
                        node.Status     = ComUtility.DBNullStateHandler(rdr["Status"]);
                        node.DateTime   = ComUtility.DBNullDateTimeHandler(rdr["DateTime"]);
                        node.UpdateTime = ComUtility.DBNullDateTimeHandler(rdr["UpdateTime"]);
                    }
                }

                return(node);
            } catch {
                throw;
            }
        }