Exemplo n.º 1
0
        /// <summary>
        /// Load the logs from the DB and updates the DataGrid
        /// </summary>
        public void LoadLoags()
        {
            DataSet dataSet = OSAESql.RunSQL("SELECT log_time,object_name,event_label,parameter_1,parameter_2,from_object_name FROM osae_v_event_log ORDER BY log_time DESC, object_name LIMIT 1000");

            this.logDataGrid.ItemsSource = dataSet.Tables[0].DefaultView;
        }
        private void objectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataSet dataSet = OSAESql.RunSQL("SELECT method_name FROM osae_v_object_method where object_name = '" + objectComboBox.SelectedValue + "' order by method_name");

            methodComboBox.ItemsSource = dataSet.Tables[0].DefaultView;
        }
Exemplo n.º 3
0
 private void loadProperties()
 {
     gvProperties.DataSource = OSAESql.RunSQL("SELECT property_name, property_datatype, property_object_type, property_default, track_history, property_id FROM osae_v_object_type_property where object_type='" + hdnSelectedObjectName.Text + "' ORDER BY property_name");
     gvProperties.DataBind();
 }
Exemplo n.º 4
0
 private void loadProperties()
 {
     gvProperties.DataSource = OSAESql.RunSQL("SELECT property_name, property_value, property_datatype, object_property_id, DATE_FORMAT(last_updated,'%m/%d %h:%i:%s %p') as last_updated,source_name, trust_level,interest_level,property_object_type FROM osae_v_object_property where object_name='" + gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString().Replace("'", "''") + "' ORDER BY property_name");
     gvProperties.DataBind();
     gvProperties.SelectedIndex = 0;
 }
Exemplo n.º 5
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     OSAEObjectManager.ObjectUpdate(gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString(), txtName.Text, txtAlias.Text, txtDescr.Text, ddlType.SelectedValue, txtAddress.Text, ddlContainer.SelectedValue, Convert.ToInt16(txtTrustLevel.Text), chkEnabled.Checked);
     gvObjects.DataSource = OSAESql.RunSQL(objectSQL);
     gvObjects.DataBind();
 }
 private void loadRecurring()
 {
     gvRecurring.DataSource = OSAESql.RunSQL("SELECT recurring_id, interval_unit, schedule_name, COALESCE(active, 1) as active, recurring_time, COALESCE(script_name, CONCAT(object_name,'.',method_name)) AS command_name FROM osae_v_schedule_recurring ORDER BY schedule_name");
     gvRecurring.DataBind();
 }
Exemplo n.º 7
0
    public void RaisePostBackEvent(string eventArgument)
    {
        string[] args = eventArgument.Split('_');

        if (args[0] == "gvObjects")
        {
            alert.Visible              = false;
            gvObjects.SelectedIndex    = Int32.Parse(args[1]);
            hdnSelectedObjectName.Text = gvObjects.DataKeys[gvProperties.SelectedIndex]["object_name"].ToString();
            panelEditForm.Visible      = true;
            btnUpdate.Visible          = true;
            panelPropForm.Visible      = false;
            divParameters.Visible      = false;
            loadDDLs();
            loadProperties();
            loadDetails();
        }
        else if (args[0] == "gvProperties")
        {
            panelPropForm.Visible      = true;
            gvProperties.SelectedIndex = Int32.Parse(args[1]);
            hdnSelectedPropName.Text   = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_name"].ToString();
            lblPropName.Text           = hdnSelectedPropName.Text;
            lblSourceName.Text         = "Source: " + gvProperties.DataKeys[gvProperties.SelectedIndex]["source_name"].ToString();
            lblTrustLevel.Text         = "Trust Level: " + gvProperties.DataKeys[gvProperties.SelectedIndex]["trust_level"].ToString();
            lblInterestLevel.Text      = "Interest Level: " + gvProperties.DataKeys[gvProperties.SelectedIndex]["interest_level"].ToString();
            lblPropLastUpd.Text        = "Last Updated: " + gvProperties.DataKeys[gvProperties.SelectedIndex]["last_updated"].ToString();
            hdnSelectedPropType.Text   = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString();
            lblPropType.Text           = "Type: " + hdnSelectedPropType.Text;

            if (gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString() == "List")
            {
                loadPropertyList();
                txtPropValue.Visible     = false;
                btnPropSave.Visible      = false;
                lblPropName.Visible      = false;
                lblSourceName.Visible    = false;
                lblTrustLevel.Visible    = false;
                lblInterestLevel.Visible = false;
                btnEditPropList.Visible  = true;
                ddlPropValue.Visible     = false;
            }
            else if (gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString() == "Boolean")
            {
                ddlPropValue.Items.Clear();
                ddlPropValue.Items.Add(new ListItem("TRUE", "TRUE"));
                ddlPropValue.Items.Add(new ListItem("FALSE", "FALSE"));
                if (!string.IsNullOrEmpty(gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString()) && ddlPropValue.Items.FindByValue(gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString()) != null)
                {
                    ddlPropValue.SelectedValue = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString();
                }

                txtPropValue.Visible     = false;
                btnPropSave.Visible      = true;
                lblPropName.Visible      = true;
                lblSourceName.Visible    = true;
                lblTrustLevel.Visible    = true;
                lblInterestLevel.Visible = true;
                btnEditPropList.Visible  = false;
                ddlPropValue.Visible     = true;
            }
            else if (gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString() == "Object")
            {
                ddlPropValue.Items.Clear();
                DataSet options = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_type NOT IN ('CONTROL','SCREEN') ORDER BY object_name");
                foreach (DataRow dr in options.Tables[0].Rows)
                {
                    ddlPropValue.Items.Add(new ListItem(dr["object_name"].ToString()));
                }

                txtPropValue.Visible     = false;
                btnPropSave.Visible      = true;
                lblPropName.Visible      = true;
                lblSourceName.Visible    = true;
                lblTrustLevel.Visible    = true;
                lblInterestLevel.Visible = true;
                btnEditPropList.Visible  = false;
                ddlPropValue.Visible     = true;
            }
            else if (gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString() == "Object Type")
            {
                ddlPropValue.Items.Clear();
                DataSet options = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_type ='" + gvProperties.DataKeys[gvProperties.SelectedIndex]["property_object_type"].ToString() + "' ORDER BY object_name");
                foreach (DataRow dr in options.Tables[0].Rows)
                {
                    ddlPropValue.Items.Add(new ListItem(dr["object_name"].ToString()));
                }

                txtPropValue.Visible     = false;
                btnPropSave.Visible      = true;
                lblPropName.Visible      = true;
                lblSourceName.Visible    = true;
                lblTrustLevel.Visible    = true;
                lblInterestLevel.Visible = true;
                btnEditPropList.Visible  = false;
                ddlPropValue.Visible     = true;
            }
            else
            {
                string  propID  = gvProperties.DataKeys[gvProperties.SelectedIndex]["object_property_id"].ToString();
                DataSet options = OSAESql.RunSQL("SELECT option_name FROM osae_object_type_property_option ootpo INNER JOIN osae_object_property oop ON oop.object_type_property_id = ootpo.property_id WHERE oop.object_property_id=" + propID + " ORDER BY option_name");
                ddlPropValue.Items.Clear();
                if (options.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in options.Tables[0].Rows)
                    {
                        ddlPropValue.Items.Add(new ListItem(dr["option_name"].ToString(), dr["option_name"].ToString()));
                    }

                    if (!string.IsNullOrEmpty(gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString()) && ddlPropValue.Items.FindByValue(gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString()) != null)
                    {
                        ddlPropValue.SelectedValue = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString();
                    }

                    txtPropValue.Visible = false;
                    ddlPropValue.Visible = true;
                }
                else
                {
                    txtPropValue.Text    = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_value"].ToString();
                    txtPropValue.Visible = true;
                    ddlPropValue.Visible = false;
                }

                btnPropSave.Visible     = true;
                lblPropName.Visible     = true;
                btnEditPropList.Visible = false;
            }
            if (ddlType.Text == "PERSON")
            {
                string pTrust    = gvProperties.DataKeys[gvProperties.SelectedIndex]["trust_level"].ToString();
                string pName     = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_name"].ToString();
                string pType     = gvProperties.DataKeys[gvProperties.SelectedIndex]["property_datatype"].ToString();
                string oName     = gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString();
                string oMinTrust = gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString();
                applyPersonPropertySecurity(oName, oMinTrust, pName, pType, pTrust);
            }
            if (Convert.ToInt32(Session["TrustLevel"].ToString()) < Convert.ToInt32(gvProperties.DataKeys[gvProperties.SelectedIndex]["trust_level"].ToString()))
            {
                txtPropValue.Visible     = false;
                btnPropSave.Visible      = false;
                lblPropName.Visible      = false;
                lblSourceName.Visible    = false;
                lblTrustLevel.Visible    = true;
                lblInterestLevel.Visible = false;
                btnEditPropList.Visible  = false;
                ddlPropValue.Visible     = false;
            }
        }
    }
 private void loadScripts()
 {
     gvScripts.DataSource = OSAESql.RunSQL("SELECT script_name, os.script_id, script_sequence, pattern_script_id FROM osae_script os INNER JOIN osae_pattern_script s ON s.script_id = os.script_id INNER JOIN osae_pattern p ON p.pattern_id = s.pattern_id WHERE pattern = '" + hdnSelectedPatternName.Text + "' ORDER BY script_sequence ASC");
     gvScripts.DataBind();
 }
 private void loadScriptDDL()
 {
     ddlScript.DataSource = OSAESql.RunSQL("SELECT script_name as Text, script_id as Value FROM osae_script ORDER BY script_name");;
     ddlScript.DataBind();
 }
 private void loadPatterns()
 {
     gvPatterns.DataSource = OSAESql.RunSQL("SELECT pattern, pattern_id FROM osae_pattern ORDER BY pattern");
     gvPatterns.DataBind();
 }
 private void loadMatches()
 {
     gvMatches.DataSource = OSAESql.RunSQL("SELECT `match`, match_id FROM osae_v_pattern_match WHERE pattern = '" + hdnSelectedPatternName.Text + "' ORDER BY `match`");
     gvMatches.DataBind();
 }
Exemplo n.º 12
0
 private void loadStates()
 {
     gvStates.DataSource = OSAESql.RunSQL("SELECT DISTINCT object_name FROM osae_v_object_state_change_history ORDER BY object_name");
     gvStates.DataBind();
 }
Exemplo n.º 13
0
 private void loadProperties()
 {
     gvProperties.DataSource = OSAESql.RunSQL("SELECT DISTINCT CONCAT(object_name,' - ',property_name) as prop_name, object_name, property_name, LEFT(property_datatype, 1) AS property_datatype FROM osae_v_object_property_history WHERE property_datatype IN ('Integer', 'Float', 'Boolean') ORDER BY prop_name");
     gvProperties.DataBind();
 }
        /// <summary>
        /// Load the object types from the DB into the combo box
        /// </summary>
        private void LoadObjects()
        {
            DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_Type = '" + defaultAssocObject + "' ORDER BY object_name");

            objectsComboBox.ItemsSource = dataSet.Tables[0].DefaultView;
        }
        /// <summary>
        /// Load the objects from the DB into the combo box
        /// </summary>
        private void LoadObjects()
        {
            DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_type !='SCREEN' AND base_type != 'CONTROL' order by object_name");

            cboObject.ItemsSource = dataSet.Tables[0].DefaultView;
        }
Exemplo n.º 16
0
 private void loadScripts()
 {
     gvScripts.DataSource = OSAESql.RunSQL("SELECT script_name, script_id, s.script_processor_id, script_processor_name FROM osae_script s INNER JOIN osae_script_processors sp ON sp.script_processor_id = s.script_processor_id ORDER BY script_name");
     gvScripts.DataBind();
 }
 private void loadQueue()
 {
     gvQueue.DataSource = OSAESql.RunSQL("SELECT schedule_id, DAYNAME(queue_datetime) AS day_of_week, queue_datetime, schedule_name, COALESCE(script_name, CONCAT(object_name,'.',method_name)) AS command_name FROM osae_v_schedule_queue ORDER BY queue_datetime");
     gvQueue.DataBind();
 }
Exemplo n.º 18
0
 private void loadLinkage(string id)
 {
     gvLinkage.DataSource = OSAESql.RunSQL("SELECT object_name, event_name FROM osae_v_object_event_script WHERE script_id=" + id);
     gvLinkage.DataBind();
 }
 private void loadMethods()
 {
     ddlMethod.DataSource = OSAESql.RunSQL("SELECT method_label as Text, method_name as Value FROM osae_v_object_method WHERE object_name = '" + ddlObject.SelectedValue + "' ORDER BY method_label");
     ddlMethod.Items.Insert(0, new ListItem(String.Empty, String.Empty));
     ddlMethod.DataBind();
 }
        public void LoadPlugins()
        {
            this.Log.Info("Entered LoadPlugins");

            var types = PluginFinder.FindPlugins();

            this.Log.Info("Loading Plugins");

            foreach (var type in types)
            {
                this.Log.Debug("type.TypeName: " + type.TypeName);
                this.Log.Debug("type.AssemblyName: " + type.AssemblyName);

                var domain = Common.CreateSandboxDomain("Sandbox Domain", type.Location, SecurityZone.Internet, typeof(ClientService));

                plugins.Add(new Plugin(type.AssemblyName, type.TypeName, domain, type.Location));
            }

            this.Log.Info("Found " + plugins.Count.ToString() + " plugins");

            foreach (Plugin plugin in plugins)
            {
                try
                {
                    this.Log.Info("---------------------------------------");
                    this.Log.Info("plugin name: " + plugin.PluginName);
                    this.Log.Info("plugin type: " + plugin.PluginType);

                    if (plugin.PluginName != string.Empty)
                    {
                        OSAEObject obj = OSAEObjectManager.GetObjectByName(plugin.PluginName);

                        this.Log.Info("setting found: " + obj.Name + " - " + obj.Enabled.ToString());
                        bool isSystemPlugin = false;
                        foreach (OSAEObjectProperty p in obj.Properties)
                        {
                            if (p.Name == "System Plugin")
                            {
                                if (p.Value == "TRUE")
                                {
                                    isSystemPlugin = true;
                                }
                                break;
                            }
                        }
                        this.Log.Info("isSystemPlugin?: " + isSystemPlugin.ToString());
                        if (!isSystemPlugin)
                        {
                            if (obj.Enabled == 1)
                            {
                                try
                                {
                                    enablePlugin(plugin);
                                }
                                catch (Exception ex)
                                {
                                    this.Log.Error("Error activating plugin (" + plugin.PluginName + ")", ex);
                                }
                            }
                            else
                            {
                                plugin.Enabled = false;
                            }

                            this.Log.Info("status: " + plugin.Enabled.ToString());
                            this.Log.Info("PluginName: " + plugin.PluginName);
                            this.Log.Info("PluginVersion: " + plugin.PluginVersion);

                            NetworkComms.SendObject("Plugin", Common.WcfServer, 10000, plugin.PluginName + "|" + plugin.Status + "|" + plugin.PluginVersion + "|" + plugin.Enabled);
                        }
                    }
                    else
                    {
                        //add code to create the object.  We need the plugin to specify the type though
                        this.Log.Info("Plugin object doesn't exist");
                        DataSet dataset = OSAESql.RunSQL("SELECT * FROM osae_object_type_property p inner join osae_object_type t on p.object_type_id = t.object_type_id WHERE object_type='" + plugin.PluginType + "' AND property_name='Computer Name'");
                        this.Log.Info("dataset count: " + dataset.Tables[0].Rows.Count.ToString());

                        // if object type has a property called 'Computer Name' we know it is not a System Plugin
                        if (dataset.Tables[0].Rows.Count > 0)
                        {
                            plugin.PluginName = plugin.PluginType + "-" + Common.ComputerName;

                            this.Log.Info("Plugin object does not exist in DB: " + plugin.PluginName);
                            OSAEObjectManager.ObjectAdd(plugin.PluginName, plugin.PluginName, plugin.PluginType, "", "System", false);
                            OSAEObjectPropertyManager.ObjectPropertySet(plugin.PluginName, "Computer Name", Common.ComputerName, "Client Service");

                            this.Log.Info("Plugin added to DB: " + plugin.PluginName);
                            NetworkComms.SendObject("Plugin", Common.WcfServer, 10000, plugin.PluginName + "|" + plugin.Status
                                                    + "|" + plugin.PluginVersion + "|" + plugin.Enabled);
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.Log.Error("Error loading plugin", ex);
                }
            }
            this.Log.Info("Done loading plugins");
        }
Exemplo n.º 21
0
    private void loadDDLs()
    {
        ddlState.DataSource = OSAESql.RunSQL("SELECT state_label as Text, state_name as Value FROM osae_object_type_state ts INNER JOIN osae_object o ON o.object_type_id = ts.object_type_id where object_name = '" + gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString().Replace("'", "''") + "' ORDER BY state_label");
        ddlState.DataBind();
        if (ddlState.Items.Count == 0)
        {
            divState.Visible = false;
        }
        else
        {
            divState.Visible = true;
        }

        ddlMethod.DataSource = OSAESql.RunSQL("SELECT method_label as Text, method_name as Value FROM osae_object_type_method ts INNER JOIN osae_object o ON o.object_type_id = ts.object_type_id where object_name = '" + gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString().Replace("'", "''") + "' ORDER BY method_label");
        ddlMethod.DataBind();
        if (ddlMethod.Items.Count == 0)
        {
            divMethod.Visible = false;
        }
        else
        {
            divMethod.Visible = true;
        }

        ddlMethod.Items.Insert(0, new ListItem(string.Empty, string.Empty));

        ddlEvent.DataSource = OSAESql.RunSQL("SELECT event_label as Text, event_name as Value FROM osae_object_type_event ts INNER JOIN osae_object o ON o.object_type_id = ts.object_type_id where object_name = '" + gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString().Replace("'", "''") + "' ORDER BY event_label");
        ddlEvent.DataBind();
        if (ddlEvent.Items.Count == 0)
        {
            divEvent.Visible = false;
        }
        else
        {
            divEvent.Visible = true;
        }

        ddlEvent.Items.Insert(0, new ListItem(string.Empty, string.Empty));

        ddlType.DataSource = OSAESql.RunSQL("SELECT object_type as Text, object_type as Value FROM osae_object_type ORDER BY object_type");
        ddlType.DataBind();
        if (ddlType.Items.Count == 0)
        {
            ddlType.Visible = false;
        }
        else
        {
            ddlType.Visible = true;
        }

        ddlType.Items.Insert(0, new ListItem(string.Empty, string.Empty));

        ddlContainer.DataSource = OSAESql.RunSQL("SELECT object_name as Text, object_name as Value FROM osae_v_object where container = 1 ORDER BY object_name");;
        ddlContainer.DataBind();
        if (ddlContainer.Items.Count == 0)
        {
            ddlContainer.Visible = false;
        }
        else
        {
            ddlContainer.Visible = true;
        }

        ddlContainer.Items.Insert(0, new ListItem(string.Empty, string.Empty));
    }
Exemplo n.º 22
0
 private void loadReaders()
 {
     gvReaders.DataSource = OSAESql.RunSQL("SELECT object_name,property_name,object_property_scraper_id,object_id,object_property_id,URL,search_prefix,search_prefix_offset,search_suffix,update_interval FROM osae_v_object_property_scraper ORDER BY object_name,property_name");
     gvReaders.DataBind();
 }
Exemplo n.º 23
0
 private void loadPropertyList()
 {
     gvPropList.DataSource = OSAESql.RunSQL("SELECT item_name, item_label FROM osae_object_property_array WHERE object_property_id = " + gvProperties.DataKeys[gvProperties.SelectedIndex]["object_property_id"].ToString());
     gvPropList.DataBind();
     btnListItemUpdate.Enabled = false;
 }
Exemplo n.º 24
0
 private void loadObjects()
 {
     ddlObjects.DataSource = OSAESql.RunSQL("SELECT DISTINCT(object_name) as object_name, object_id FROM osae_v_object_property ORDER BY object_name");
     ddlObjects.DataBind();
 }
        /// <summary>
        /// Load the objects from the DB into the combo box
        /// </summary>
        private void LoadObjects()
        {
            DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object order by object_name");

            objectComboBox.ItemsSource = dataSet.Tables[0].DefaultView;
        }
Exemplo n.º 26
0
 private void loadProperties()
 {
     ddlProperties.DataSource = OSAESql.RunSQL("SELECT DISTINCT(property_name) as property_name,property_id FROM osae_v_object_property WHERE object_id=" + ddlObjects.SelectedValue + " ORDER BY property_name");
     ddlProperties.DataBind();
 }
Exemplo n.º 27
0
 private void loadObjectTypes()
 {
     gvObjectTypes.DataSource = OSAESql.RunSQL("SELECT base_type, object_type, object_type_description FROM osae_v_object_type ORDER BY base_type, object_type");
     gvObjectTypes.DataBind();
 }
Exemplo n.º 28
0
        private void Load_Settings()
        {
            try
            {
                AddToLog("OSA Settings:");
                AddToLog("--  Object Name: " + gAppName);
                String temp = OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "VR Input Muted").Value.ToString();
                if (temp == "FALSE")
                {
                    gVRMuted          = false;
                    lblStatus.Content = "I am awake.";
                }
                else
                {
                    gVRMuted          = true;
                    lblStatus.Content = "I am sleeping.  Zzzz";
                }
                AddToLog("--  VR Muted: " + gVRMuted);

                temp = "";
                temp = OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "VR Enabled").Value.ToString();
                if (temp == "FALSE")
                {
                    gVREnabled = false;
                }
                else
                {
                    gVREnabled = true;
                }
                AddToLog("--  VR Enabled: " + gVREnabled);

                temp         = "";
                temp         = OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "VR Wake Pattern").Value.ToString();
                gWakePattern = temp;
                AddToLog("--  VR Wake Pattern: " + gWakePattern);
                DataSet dsWakeResults = new DataSet();
                try
                {
                    //Load all unique patterns with no place-holders into a single grammer, our main one.
                    dsWakeResults = OSAESql.RunSQL("SELECT `match` FROM osae_v_pattern_match WHERE pattern ='" + gWakePattern + "' ORDER BY `match`");
                    for (int i = 0; i < dsWakeResults.Tables[0].Rows.Count; i++)
                    {
                        wakeList.Add(dsWakeResults.Tables[0].Rows[i][0].ToString());
                    }
                }
                catch (Exception ex)
                {
                    AddToLog("Error getting Wake matches from the DB!");
                    AddToLog("Error: " + ex.Message);
                }

                temp          = "";
                temp          = OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "VR Sleep Pattern").Value.ToString();
                gSleepPattern = temp;
                AddToLog("--  VR Sleep Pattern: " + gSleepPattern);
                DataSet dsSleepResults = new DataSet();
                try
                {
                    //Load all unique patterns with no place-holders into a single grammer, our main one.
                    dsSleepResults = OSAESql.RunSQL("SELECT `match` FROM osae_v_pattern_match WHERE pattern='" + gSleepPattern + "' ORDER BY `match`");
                    for (int i = 0; i < dsSleepResults.Tables[0].Rows.Count; i++)
                    {
                        sleepList.Add(dsSleepResults.Tables[0].Rows[i][0].ToString());
                    }
                }
                catch (Exception ex)
                {
                    AddToLog("Error getting Sleep matches from the DB!");
                    AddToLog("Error: " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                AddToLog("Error in Load Settings: " + ex.Message);
            }
        }
Exemplo n.º 29
0
 private void loadStates()
 {
     gvStates.DataSource = OSAESql.RunSQL("SELECT state_name, state_label FROM osae_v_object_type_state where object_type='" + hdnSelectedObjectName.Text + "' ORDER BY state_name");
     gvStates.DataBind();
 }
Exemplo n.º 30
0
        private void objectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataSet dataSet = OSAESql.RunSQL("select property_name from osae_v_object_property where object_name='" + (sender as ComboBox).SelectedValue.ToString() + "' Union select 'State' order by property_name");

            propertyComboBox.ItemsSource = dataSet.Tables[0].DefaultView;
        }