示例#1
0
        public void InsertYAxes()
        {
            Resource.TestDB[handle].Lock();
            FbTransaction trans = Resource.TestDB[handle].BeginTrans();

            try
            {
                YAxisSettingDataSet yAxisSet = Resource.TestDB[handle].YAxisSettingSet;

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

                    yAxisSet.Ip        = Resource.Ip;
                    yAxisSet.Mode      = 0;
                    yAxisSet.GraphNo   = Index;
                    yAxisSet.Checked   = row.Checked;
                    yAxisSet.Align     = row.Align;
                    yAxisSet.Name      = row.Name;
                    yAxisSet.Desc      = row.Description;
                    yAxisSet.Unit      = row.Unit;
                    yAxisSet.VisualMin = row.VisualMin;
                    yAxisSet.VisualMax = row.VisualMax;
                    yAxisSet.WholeMin  = row.WholeMin;
                    yAxisSet.WholeMax  = row.WholeMax;

                    if (row.RecNo == -1)
                    {
                        row.RecNo      = (int)Resource.TestDB[handle].GetGenNo("GN_YAXISSETTING");
                        yAxisSet.RecNo = row.RecNo;
                        yAxisSet.Insert(trans);
                    }
                    else
                    {
                        yAxisSet.RecNo = row.RecNo;
                        yAxisSet.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();
            }
        }
示例#2
0
        private void LoadYAxes()
        {
            Resource.TestDB[handle].Lock();

            try
            {
                YAxisSettingDataSet set = Resource.TestDB[handle].YAxisSettingSet;

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

                if (set.GetRowCount() > 0)
                {
                    if (YAxisRows.Count != set.GetRowCount())
                    {
                        Resource.TLog.Log((int)ELogItem.Error, "Y-Axes count is mismatched in CtrlViewGraphPanel.LoadYAxes");
                    }
                    else
                    {
                        for (int i = 0; i < set.GetRowCount(); i++)
                        {
                            set.Fetch(i);

                            YAxisRows[i].RecNo     = set.RecNo;
                            YAxisRows[i].Align     = set.Align;
                            YAxisRows[i].Checked   = set.Checked;
                            YAxisRows[i].VisualMin = set.VisualMin;
                            YAxisRows[i].VisualMax = set.VisualMax;
                            YAxisRows[i].WholeMin  = set.WholeMin;
                            YAxisRows[i].WholeMax  = set.WholeMax;
                        }
                    }
                }
            }
            finally
            {
                Resource.TestDB[handle].Unlock();
            }
        }