Exemplo n.º 1
0
 public OSAEObject(string name, string description, string type, string address, string container, int enabled)
 {
     Name = name;
     Type = type;
     Address = address;
     Container = container;
     Enabled = enabled;
     Description = description;
     State = new ObjectState();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a ObjectState object
        /// </summary>
        /// <param name="ObjectName"></param>
        /// <returns></returns>
        public ObjectState GetObjectStateValue(string ObjectName)
        {
            DataSet dataset = new DataSet();
            ObjectState state = new ObjectState();
            try
            {
                using (MySqlCommand command = new MySqlCommand())
                {
                    command.CommandText = "SELECT state_label, coalesce(time_in_state, 0) as time_in_state FROM osae_v_object WHERE object_name=@ObjectName";
                    command.Parameters.AddWithValue("@ObjectName", ObjectName);
                    dataset = RunQuery(command);
                }

                if (dataset.Tables[0].Rows.Count > 0)
                {
                    state.Value = dataset.Tables[0].Rows[0]["state_label"].ToString();
                    state.TimeInState = Convert.ToInt64(dataset.Tables[0].Rows[0]["time_in_state"]);

                    return state;
                }
                else
                {
                    AddToLog("API - GetObjectStateValue error: Object does not exist | ObjectName: " + ObjectName, true);
                    return null;
                }
            }
            catch (Exception ex)
            {
                AddToLog("API - GetObjectStateValue error: " + ex.Message + " | ObjectName: " + ObjectName, true);
                return null;
            }
            finally
            {
                dataset.Dispose();
            }
        }
Exemplo n.º 3
0
 public OSAEObject()
 {
     State = new ObjectState();
 }
Exemplo n.º 4
0
 public OSAEObject()
 {
     State = new ObjectState();
 }