Example #1
0
        private Boolean RemoveEmptyEvents(Event evt, AdoDataConnection connection)
        {
            GSF.Data.Model.TableOperations <DataSeries> dataSeriesTable = new GSF.Data.Model.TableOperations <DataSeries>(connection);
            GSF.Data.Model.TableOperations <Event>      evtTable        = new GSF.Data.Model.TableOperations <Event>(connection);

            int nEvents = dataSeriesTable.QueryRecordCountWhere("EventID = {0} ", evt.ID);

            if (nEvents == 0)
            {
                evtTable.DeleteRecord(evt);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #2
0
        private Boolean RemoveEmptyChannel(Channel channel, AdoDataConnection connection)
        {
            GSF.Data.Model.TableOperations <DataSeries> dataSeriesTable = new GSF.Data.Model.TableOperations <DataSeries>(connection);
            GSF.Data.Model.TableOperations <Channel>    channelTable    = new GSF.Data.Model.TableOperations <Channel>(connection);

            int nEvents = dataSeriesTable.QueryRecordCountWhere("ChannelID = {0} ", channel.ID);

            if (nEvents == 0)
            {
                //remove corresponsing MeasurmentID
                channelTable.DeleteRecord(channel);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #3
0
        private Boolean RemoveEmptyEvents(PQds.Model.Event evt)
        {
            using (AdoDataConnection connection = new AdoDataConnection("systemSettings"))
            {
                GSF.Data.Model.TableOperations <PQds.Model.DataSeries> dataSeriesTable = new GSF.Data.Model.TableOperations <PQds.Model.DataSeries>(connection);
                GSF.Data.Model.TableOperations <PQds.Model.Event>      evtTable        = new GSF.Data.Model.TableOperations <PQds.Model.Event>(connection);

                int nEvents = dataSeriesTable.QueryRecordCountWhere("EventID = {0} ", evt.ID);

                if (nEvents == 0)
                {
                    evtTable.DeleteRecord(evt);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Example #4
0
        private void SaveField()
        {
            if (this.alreadySavedFlag)
            {
                return;
            }

            this.alreadySavedFlag = true;
            string activeTab = tabControl1.SelectedTab.Text;

            Control[] ctrls = tabControl1.SelectedTab.Controls.Find("listView1-" + activeTab, false);
            ListView  list  = (ListView)ctrls[0];

            ctrls = tabControl1.SelectedTab.Controls.Find("editkey", false);
            TextBox txtkey = (TextBox)ctrls[0];

            ctrls = tabControl1.SelectedTab.Controls.Find("editvalue", false);
            TextBox txtvalue = (TextBox)ctrls[0];

            ctrls = tabControl1.SelectedTab.Controls.Find("editType", false);
            ComboBox txtType = (ComboBox)ctrls[0];

            int index = (int)list.SelectedItems[0].Tag;

            using (AdoDataConnection connection = new AdoDataConnection(connectionstring, dataprovider))
            {
                GSF.Data.Model.TableOperations <PQio.Model.CustomField> customFldTbl = new GSF.Data.Model.TableOperations <PQio.Model.CustomField>(connection);
                PQio.Model.CustomField fld;

                if (index == -1)
                {
                    fld         = new Model.CustomField();
                    fld.domain  = activeTab;
                    fld.AssetID = (int)this.m_channel.AssetID;
                    fld.EventID = (int)this.m_evt.ID;
                }
                else
                {
                    fld = customFldTbl.QueryRecordWhere("ID = {0}", index);
                }


                if (txtvalue.Text == "" && index != -1)
                {
                    DialogResult confirm = System.Windows.Forms.MessageBox.Show("This will delete the MetaDataTag " + fld.key, "Warning",
                                                                                System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Warning);
                    if (confirm == DialogResult.OK)
                    {
                        customFldTbl.DeleteRecord(fld);
                        HideTextEditor();
                        this.UpdateCustomFields();
                        return;
                    }
                }

                fld.key   = txtkey.Text;
                fld.Value = txtvalue.Text;
                fld.Type  = TextToType(txtType.Text);

                customFldTbl.AddNewOrUpdateRecord(fld);
                HideTextEditor();
                this.UpdateCustomFields();
            }
        }