Ejemplo n.º 1
0
        /// <summary>
        /// Method to retrieve orders information
        /// </summary>
        /// <returns>All orders</returns>
        public List <OrderInfo> GetOrders()
        {
            List <OrderInfo> orders = new List <OrderInfo>();

            try {
                //Execute a query to read the orders
                using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_ORDER_GETORDERS, null)) {
                    while (rdr.Read())
                    {
                        OrderInfo order = new OrderInfo();
                        order.LscID      = ComUtility.DBNullInt32Handler(rdr["LscID"]);
                        order.TargetID   = ComUtility.DBNullInt32Handler(rdr["TargetID"]);
                        order.TargetType = ComUtility.DBNullNodeTypeHandler(rdr["TargetType"]);
                        order.OrderType  = ComUtility.DBNullActTypeHandler(rdr["OrderType"]);
                        order.RelValue1  = ComUtility.DBNullStringHandler(rdr["RelValue1"]);
                        order.RelValue2  = ComUtility.DBNullStringHandler(rdr["RelValue2"]);
                        order.RelValue3  = ComUtility.DBNullStringHandler(rdr["RelValue3"]);
                        order.RelValue4  = ComUtility.DBNullStringHandler(rdr["RelValue4"]);
                        order.RelValue5  = ComUtility.DBNullStringHandler(rdr["RelValue5"]);
                        order.UpdateTime = ComUtility.DBNullDateTimeHandler(rdr["UpdateTime"]);

                        orders.Add(order);
                    }
                }

                return(orders);
            } catch {
                throw;
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Syn Alarms
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>Alarms</returns>
        public List <AlarmInfo> SynAlarms(int lscId, string connectionString)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@LscID",  SqlDbType.Int),
                                         new SqlParameter("@AIType", SqlDbType.Int),
                                         new SqlParameter("@DIType", SqlDbType.Int) };
                parms[0].Value = lscId;
                parms[1].Value = (int)EnmNodeType.Aic;
                parms[2].Value = (int)EnmNodeType.Dic;

                List <AlarmInfo> alarms = new List <AlarmInfo>();
                SqlHelper.TestConnection(connectionString);
                using (DataTable dt = SqlHelper.ExecuteTable(connectionString, CommandType.Text, SqlText.SQL_SELECT_ALARM_SYNALARMS, parms)) {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            AlarmInfo alarm = new AlarmInfo();
                            alarm.LscID          = ComUtility.DBNullInt32Handler(dr["LscID"]);
                            alarm.SerialNO       = ComUtility.DBNullInt32Handler(dr["SerialNO"]);
                            alarm.Area1Name      = ComUtility.DBNullStringHandler(dr["Area1Name"]);
                            alarm.Area2Name      = ComUtility.DBNullStringHandler(dr["Area2Name"]);
                            alarm.Area3Name      = ComUtility.DBNullStringHandler(dr["Area3Name"]);
                            alarm.Area4Name      = ComUtility.DBNullStringHandler(dr["Area4Name"]);
                            alarm.StaName        = ComUtility.DBNullStringHandler(dr["StaName"]);
                            alarm.DevName        = ComUtility.DBNullStringHandler(dr["DevName"]);
                            alarm.DevDesc        = ComUtility.DBNullStringHandler(dr["DevDesc"]);
                            alarm.NodeID         = ComUtility.DBNullInt32Handler(dr["NodeID"]);
                            alarm.NodeType       = ComUtility.DBNullNodeTypeHandler(dr["NodeType"]);
                            alarm.NodeName       = ComUtility.DBNullStringHandler(dr["NodeName"]);
                            alarm.AlarmID        = ComUtility.DBNullInt32Handler(dr["AlarmID"]);
                            alarm.AlarmValue     = ComUtility.DBNullFloatHandler(dr["AlarmValue"]);
                            alarm.AlarmLevel     = ComUtility.DBNullAlarmLevelHandler(dr["AlarmLevel"]);
                            alarm.AlarmStatus    = ComUtility.DBNullAlarmStatusHandler(dr["AlarmStatus"]);
                            alarm.AlarmDesc      = ComUtility.DBNullStringHandler(dr["AlarmDesc"]);
                            alarm.AuxAlarmDesc   = ComUtility.DBNullStringHandler(dr["AuxAlarmDesc"]);
                            alarm.StartTime      = ComUtility.DBNullDateTimeHandler(dr["StartTime"]);
                            alarm.EndTime        = ComUtility.DBNullDateTimeHandler(dr["EndTime"]);
                            alarm.ConfirmName    = ComUtility.DBNullStringHandler(dr["ConfirmName"]);
                            alarm.ConfirmMarking = ComUtility.DBNullConfirmMarkingHandler(dr["ConfirmMarking"]);
                            alarm.ConfirmTime    = ComUtility.DBNullDateTimeHandler(dr["ConfirmTime"]);
                            alarm.AuxSet         = ComUtility.DBNullStringHandler(dr["AuxSet"]);
                            alarm.TaskID         = ComUtility.DBNullStringHandler(dr["TaskID"]);
                            alarm.ProjName       = ComUtility.DBNullStringHandler(dr["ProjName"]);
                            alarm.TurnCount      = ComUtility.DBNullInt32Handler(dr["TurnCount"]);
                            alarm.UpdateTime     = ComUtility.DBNullDateTimeHandler(dr["UpdateTime"]);

                            alarms.Add(alarm);
                        }

                        SqlHelper.ExecuteBulkCopy(SqlHelper.ConnectionStringLocalTransaction, SqlText.TN_Alarm, dt);
                    }
                }

                return(alarms);
            } catch {
                throw;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Syn Frequency Alarms
        /// </summary>
        /// <param name="lscId">lscId</param>
        /// <param name="connectionString">connectionString</param>
        /// <returns>Frequency Alarms</returns>
        public List <FrequencyAlarmInfo> SynFrequencyAlarms(int lscId, string connectionString)
        {
            SqlParameter[] parms = { new SqlParameter("@LscID", SqlDbType.Int) };
            parms[0].Value = lscId;

            var alarms = new List <FrequencyAlarmInfo>();

            SqlHelper.TestConnection(connectionString);
            using (var dt = SqlHelper.ExecuteTable(connectionString, CommandType.Text, SqlText.SQL_SELECT_ALARM_SYNFREQUENCYALARMS, parms)) {
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        var alarm = new FrequencyAlarmInfo();
                        alarm.LscID                 = ComUtility.DBNullInt32Handler(dr["LscID"]);
                        alarm.Area1Name             = ComUtility.DBNullStringHandler(dr["Area1Name"]);
                        alarm.Area2Name             = ComUtility.DBNullStringHandler(dr["Area2Name"]);
                        alarm.Area3Name             = ComUtility.DBNullStringHandler(dr["Area3Name"]);
                        alarm.Area4Name             = String.Empty;
                        alarm.StaName               = ComUtility.DBNullStringHandler(dr["StaName"]);
                        alarm.DevName               = ComUtility.DBNullStringHandler(dr["DevName"]);
                        alarm.NodeID                = ComUtility.DBNullInt32Handler(dr["NodeID"]);
                        alarm.NodeType              = ComUtility.DBNullNodeTypeHandler(dr["NodeType"]);
                        alarm.NodeName              = ComUtility.DBNullStringHandler(dr["NodeName"]);
                        alarm.AlarmStatus           = ComUtility.DBNullInt32Handler(dr["AlarmStatus"]);
                        alarm.AlarmLevel            = ComUtility.DBNullInt32Handler(dr["AlarmLevel"]);
                        alarm.FreAlarmValue         = ComUtility.DBNullInt32Handler(dr["FreAlarmValue"]);
                        alarm.FreRightValue         = ComUtility.DBNullInt32Handler(dr["FreRightValue"]);
                        alarm.FreCompareValue       = ComUtility.DBNullInt32Handler(dr["FreCompareValue"]);
                        alarm.StartTime             = ComUtility.DBNullDateTimeHandler(dr["StartTime"]);
                        alarm.AlarmTime             = ComUtility.DBNullDateTimeHandler(dr["AlarmTime"]);
                        alarm.EventTime             = ComUtility.DBNullDateTimeHandler(dr["EventTime"]);
                        alarm.ConfirmName           = ComUtility.DBNullStringHandler(dr["ConfirmName"]);
                        alarm.ConfirmTime           = ComUtility.DBNullDateTimeHandler(dr["ConfirmTime"]);
                        alarm.EndName               = ComUtility.DBNullStringHandler(dr["EndName"]);
                        alarm.EndTime               = ComUtility.DBNullDateTimeHandler(dr["EndTime"]);
                        alarm.StartIsAddAlarmList   = ComUtility.DBNullBooleanHandler(dr["StartIsAddAlarmList"]);
                        alarm.EndIsAddAlarmList     = ComUtility.DBNullBooleanHandler(dr["EndIsAddAlarmList"]);
                        alarm.ConfirmIsAddAlarmList = ComUtility.DBNullBooleanHandler(dr["ConfirmIsAddAlarmList"]);
                        alarms.Add(alarm);
                    }

                    SqlHelper.ExecuteBulkCopy(SqlHelper.ConnectionStringLocalTransaction, SqlText.TN_FrequencyAlarm, dt);
                }
            }

            return(alarms);
        }