Exemplo n.º 1
0
        private void InsertSeries()
        {
            Resource.TestDB[handle].Lock();
            FbTransaction trans = Resource.TestDB[handle].BeginTrans();

            try
            {
                SeriesSettingDataSet seriesSet = Resource.TestDB[handle].SeriesSettingSet;

                for (int i = 0; i < PlotSeriesRows.Count; i++)
                {
                    SeriesRow row = PlotSeriesRows[i];

                    seriesSet.Ip       = Resource.Ip;
                    seriesSet.Mode     = 0;
                    seriesSet.GraphNo  = Index;
                    seriesSet.Checked  = row.Checked;
                    seriesSet.Color    = row.Color;
                    seriesSet.Name     = row.Name;
                    seriesSet.UnitType = row.UnitType;

                    if (row.RecNo == -1)
                    {
                        row.RecNo       = (int)Resource.TestDB[handle].GetGenNo("GN_SERIESSETTING");
                        seriesSet.RecNo = row.RecNo;
                        seriesSet.Insert(trans);
                    }
                    else
                    {
                        seriesSet.RecNo = row.RecNo;
                        seriesSet.Update(trans);
                    }
                }

                Resource.TestDB[handle].CommitTrans();
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                Resource.TestDB[handle].RollbackTrans();
            }
            finally
            {
                Resource.TestDB[handle].Unlock();
            }
        }
Exemplo n.º 2
0
        private void LoadPlotSeries()
        {
            Resource.TestDB[handle].Lock();

            try
            {
                SeriesSettingDataSet set = Resource.TestDB[handle].SeriesSettingSet;

                set.Ip      = Resource.Ip;
                set.Mode    = 0;
                set.GraphNo = Index;
                set.Select();

                if (set.GetRowCount() > 0)
                {
                    if (PlotSeriesRows.Count != set.GetRowCount())
                    {
                        Resource.TLog.Log((int)ELogItem.Error, "Plot series count is mismatched in CtrlViewGraphPanel.LoadPlotSeries");
                    }
                    else
                    {
                        for (int i = 0; i < set.GetRowCount(); i++)
                        {
                            set.Fetch(i);

                            PlotSeriesRows[i].RecNo   = set.RecNo;
                            PlotSeriesRows[i].Checked = set.Checked;
                            PlotSeriesRows[i].Color   = set.Color;
                        }

                        plotSeriesGridView.RefreshData();
                    }
                }
            }
            finally
            {
                Resource.TestDB[handle].Unlock();
            }
        }