public void Delete(int recNo)
        {
            CalibratorDataSet    row      = Resource.Db.CalibratorSet;
            CalibratorRowDataSet rowSet   = Resource.Db.CalibratorRowSet;
            CalibPointDataSet    pointSet = Resource.Db.CalibPointSet;

            BeginTrans();

            try
            {
                rowSet.Select(recNo);

                for (int i = 0; i < rowSet.GetRowCount(); i++)
                {
                    rowSet.Fetch(i);
                    pointSet.Delete(rowSet.RecNo, Trans);
                }

                rowSet.Delete(recNo, Trans);
                row.Delete(recNo, Trans);
                CommitTrans();
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                RollbackTrans();
            }
        }
 public CalorimeterDatabase(FbServerType type = FbServerType.Default) : base(type)
 {
     UserSet          = new UserDataSet(connect, null, null);
     CalibratorSet    = new CalibratorDataSet(connect, null, null);
     CalibratorRowSet = new CalibratorRowDataSet(connect, null, null);
     CalibPointSet    = new CalibPointDataSet(connect, null, null);
 }
        public void Save(int recNo, int userNo, DateTime regTime, string memo)
        {
            List <CalibratorRow> allRows =
                Resource.Server.Devices.Calibrators.Category["All"].Values.ToList();

            BeginTrans();

            try
            {
                CalibratorDataSet set = CalibratorSet;

                set.RecNo   = recNo;
                set.UserNo  = userNo;
                set.RegTime = regTime.ToString(Resource.csDateTimeFormat);
                set.Memo    = memo;
                set.Insert(Trans);

                foreach (CalibratorRow row in allRows)
                {
                    int rowRecNo = (int)GetGenNo("GN_CALIBRATOR_ROW");
                    CalibratorRowDataSet rowSet = CalibratorRowSet;

                    rowSet.RecNo        = rowRecNo;
                    rowSet.CalibratorNo = recNo;
                    rowSet.Channel      = row.No;
                    rowSet.RawA         = row.Calibrator.RawA;
                    rowSet.RawB         = row.Calibrator.RawB;
                    rowSet.RawC         = row.Calibrator.RawC;
                    rowSet.DiffA        = row.Calibrator.DiffA;
                    rowSet.DiffB        = row.Calibrator.DiffB;
                    rowSet.DiffC        = row.Calibrator.DiffC;
                    rowSet.Insert(Trans);

                    int i = 0;
                    CalibPointDataSet pointSet = CalibPointSet;

                    foreach (CalibrationPoint point in row.Calibrator.Points)
                    {
                        int pointRecNo = (int)GetGenNo("GN_CALIBPOINT");

                        pointSet.RecNo           = pointRecNo;
                        pointSet.CalibratorRowNo = rowRecNo;
                        pointSet.PointNo         = i++;
                        pointSet.PV = point.PV;
                        pointSet.SV = point.SV;
                        pointSet.Insert(Trans);
                    }
                }

                CommitTrans();
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                RollbackTrans();
            }
        }
        public void Load(int recNo)
        {
            CalibratorDataSet set = CalibratorSet;
            Dictionary <int, CalibratorRow> allRows =
                Resource.Server.Devices.Calibrators.Category["All"];

            try
            {
                set.Select(recNo);

                if (set.GetRowCount() > 0)
                {
                    set.Fetch();

                    CalibratorRowDataSet rowSet = CalibratorRowSet;
                    rowSet.Select(set.RecNo);

                    for (int i = 0; i < rowSet.GetRowCount(); i++)
                    {
                        rowSet.Fetch(i);
                        CalibratorRow row = null;

                        if (allRows.TryGetValue(rowSet.Channel, out row) == true)
                        {
                            row.No = rowSet.Channel;
                            row.Calibrator.Active = true;
                            row.Calibrator.RawA   = rowSet.RawA;
                            row.Calibrator.RawB   = rowSet.RawB;
                            row.Calibrator.RawC   = rowSet.RawC;
                            row.Calibrator.DiffA  = rowSet.DiffA;
                            row.Calibrator.DiffB  = rowSet.DiffB;
                            row.Calibrator.DiffC  = rowSet.DiffC;

                            CalibPointDataSet pointSet = CalibPointSet;
                            pointSet.Select(rowSet.RecNo);

                            for (int j = 0; j < pointSet.GetRowCount(); j++)
                            {
                                pointSet.Fetch(j);

                                row.Calibrator.Points[j].PV = (float)pointSet.PV;
                                row.Calibrator.Points[j].SV = (float)pointSet.SV;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                throw new Exception("Occurred loading error of calibrator in UlFirebird.Load");
            }
        }