public void SetEditFromDataSet()
        {
            NoteParamDataSet set = context.DB.NoteParamSet;

            noteCompanyEdit.Text = set.Company;
            noteTestNameEdit.Text = set.TestName;
            noteTestNoEdit.Text = set.TestNo;
            noteObserverEdit.Text = set.Observer;
            noteMakerCombo.Text = set.Maker;
            noteModel1Combo.Text = set.Model1;
            noteSerial1Combo.Text = set.Serial1;
            noteModel2Edit.Text = set.Model2;
            noteSerial2Edit.Text = set.Serial2;
            noteModel3Edit.Text = set.Model3;
            noteSerial3Edit.Text = set.Serial3;
            noteExpDeviceEdit.Text = set.ExpDevice;
            noteRefrigerantCombo.Text = set.Refrig;
            noteRefChargeEdit.Text = set.RefCharge;
            noteMemoEdit.Text = set.Memo;

            foreach (TabPage page in ratedTab.TabPages)
            {
                CtrlTestRated ctrl = page.Controls[0] as CtrlTestRated;

                RatedParamDataSet ratedSet = context.DB.RatedParamSet;
                ratedSet.Select(set.RecNo, ctrl.Index);

                if (ratedSet.GetRowCount() == 2)
                {
                    ratedSet.Fetch(0);
                    ctrl.CoolingRecNo = ratedSet.RecNo;
                    ctrl.coolingCapacityEdit.EditValue = ratedSet.Capacity;
                    ctrl.coolingPowerInEdit.EditValue = ratedSet.Power;
                    ctrl.coolingEepEdit.EditValue = ratedSet.EER_COP;
                    ctrl.coolingVoltEdit.EditValue = ratedSet.Volt;
                    ctrl.coolingCurrentEdit.EditValue = ratedSet.Amp;
                    ctrl.coolingFreqCombo.Text = ratedSet.Freq;
                    ctrl.coolingPowerMeter1Combo.SelectedIndex = ratedSet.PM_IDU;
                    ctrl.coolingPowerMeter2Combo.SelectedIndex = ratedSet.PM_ODU;
                    ctrl.coolingPhaseCombo.SelectedValue = ratedSet.Phase;

                    ratedSet.Fetch(1);
                    ctrl.HeatingRecNo = ratedSet.RecNo;
                    ctrl.heatingCapacityEdit.EditValue = ratedSet.Capacity;
                    ctrl.heatingPowerInEdit.EditValue = ratedSet.Power;
                    ctrl.heatingEepEdit.EditValue = ratedSet.EER_COP;
                    ctrl.heatingVoltEdit.EditValue = ratedSet.Volt;
                    ctrl.heatingCurrentEdit.EditValue = ratedSet.Amp;
                    ctrl.heatingFreqCombo.Text = ratedSet.Freq;
                    ctrl.heatingPowerMeter1Combo.SelectedIndex = ratedSet.PM_IDU;
                    ctrl.heatingPowerMeter2Combo.SelectedIndex = ratedSet.PM_ODU;
                    ctrl.heatingPhaseCombo.SelectedValue = ratedSet.Phase;
                }
            }

            methodCapaCoolingUnitCombo.SelectedValue = set.CoolUnit;
            methodCapaHeatingUnitCombo.SelectedValue = set.HeatUnit;

            ThermoPressParamDataSet thermoPressSet = context.DB.ThermoPressParamSet;

            thermoPressSet.Select(set.RecNo, 0);
            if (context.Condition.TC1.Count == thermoPressSet.GetRowCount())
            {
                for (int i = 0; i < thermoPressSet.GetRowCount(); i++)
                {
                    thermoPressSet.Fetch(i);
                    context.Condition.TC1[i].RecNo = thermoPressSet.RecNo;
                    context.Condition.TC1[i].Name = thermoPressSet.Name;
                }
            }
            thermo1GridView.RefreshData();

            thermoPressSet.Select(set.RecNo, 1);
            if (context.Condition.TC2.Count == thermoPressSet.GetRowCount())
            {
                for (int i = 0; i < thermoPressSet.GetRowCount(); i++)
                {
                    thermoPressSet.Fetch(i);
                    context.Condition.TC2[i].RecNo = thermoPressSet.RecNo;
                    context.Condition.TC2[i].Name = thermoPressSet.Name;
                }
            }
            thermo2GridView.RefreshData();

            thermoPressSet.Select(set.RecNo, 2);
            if (context.Condition.TC3.Count == thermoPressSet.GetRowCount())
            {
                for (int i = 0; i < thermoPressSet.GetRowCount(); i++)
                {
                    thermoPressSet.Fetch(i);
                    context.Condition.TC3[i].RecNo = thermoPressSet.RecNo;
                    context.Condition.TC3[i].Name = thermoPressSet.Name;
                }
            }
            thermo3GridView.RefreshData();

            thermoPressSet.Select(set.RecNo, 3);
            if (context.Condition.Pressures.Count == thermoPressSet.GetRowCount())
            {
                for (int i = 0; i < thermoPressSet.GetRowCount(); i++)
                {
                    thermoPressSet.Fetch(i);
                    context.Condition.Pressures[i].RecNo = thermoPressSet.RecNo;
                    context.Condition.Pressures[i].Name = thermoPressSet.Name;
                }
            }
            pressureGridView.RefreshData();
        }
        private void LoadCondition(int paramNo)
        {
            NoteParamDataSet noteSet = Context.DB.NoteParamSet;

            noteSet.Select(paramNo);
            noteSet.Fetch();
            int noteNo = noteSet.RecNo;

            CtrlTestCondition ctrl = Context.Condition.Control;

            ctrl.noteCompanyEdit.Text      = noteSet.Company;
            ctrl.noteTestNameEdit.Text     = noteSet.TestName;
            ctrl.noteTestNoEdit.Text       = noteSet.TestNo;
            ctrl.noteObserverEdit.Text     = noteSet.Observer;
            ctrl.noteMakerCombo.Text       = noteSet.Maker;
            ctrl.noteModel1Combo.Text      = noteSet.Model1;
            ctrl.noteSerial1Combo.Text     = noteSet.Serial1;
            ctrl.noteModel2Edit.Text       = noteSet.Model2;
            ctrl.noteSerial2Edit.Text      = noteSet.Serial2;
            ctrl.noteModel3Edit.Text       = noteSet.Model3;
            ctrl.noteSerial3Edit.Text      = noteSet.Serial3;
            ctrl.noteExpDeviceEdit.Text    = noteSet.ExpDevice;
            ctrl.noteRefrigerantCombo.Text = noteSet.Refrig;
            ctrl.noteMemoEdit.Text         = noteSet.Memo;

            MethodParamDataSet methodSet = Context.DB.MethodParamSet;

            methodSet.Select(noteNo);
            methodSet.Fetch();

            ctrl.methodIntegralCountEdit.Value             = methodSet.IntegCount;
            ctrl.methodIntegralTimeEdit.Value              = methodSet.IntegTime;
            ctrl.methodScanTimeCombo.Text                  = methodSet.ScanTime.ToString();
            ctrl.methodCapaCoolingUnitCombo.SelectedValue  = methodSet.CoolCapacityUnit;
            ctrl.methodCapaHeatingUnitCombo.SelectedValue  = methodSet.HeatCapacityUnit;
            ctrl.methodAirFlowUnitCombo.SelectedValue      = methodSet.AirFlowUnit;
            ctrl.methodEnthalpyUnitCombo.SelectedValue     = methodSet.EnthalpyUnit;
            ctrl.methodPressureUnitCombo.SelectedValue     = methodSet.PressureUnit;
            ctrl.methodTempUnitCombo.SelectedValue         = methodSet.TemperatureUnit;
            ctrl.methodDiffPressureUnitCombo.SelectedValue = methodSet.DiffPressureUnit;
            ctrl.methodAtmPressureUnitCombo.SelectedValue  = methodSet.AtmPressureUnit;
            ctrl.methodAutoCtrlSetCheck.Checked            = methodSet.AutoSetController;
            ctrl.methodUsePmIntegCheck.Checked             = methodSet.UsePowerMeter;

            foreach (TabPage page in Context.Condition.Control.ratedTab.TabPages)
            {
                CtrlTestRated rated = page.Controls[0] as CtrlTestRated;

                RatedParamDataSet ratedSet = Context.DB.RatedParamSet;
                ratedSet.Select(noteNo, rated.Index);

                if (ratedSet.GetRowCount() == 2)
                {
                    ratedSet.Fetch(0);
                    rated.CoolingRecNo = ratedSet.RecNo;
                    rated.coolingCapacityEdit.EditValue         = ratedSet.Capacity;
                    rated.coolingPowerInEdit.EditValue          = ratedSet.Power;
                    rated.coolingEepEdit.EditValue              = ratedSet.EER_COP;
                    rated.coolingVoltEdit.EditValue             = ratedSet.Volt;
                    rated.coolingCurrentEdit.EditValue          = ratedSet.Amp;
                    rated.coolingFreqCombo.Text                 = ratedSet.Freq;
                    rated.coolingPowerMeter1Combo.SelectedIndex = ratedSet.PM_IDU;
                    rated.coolingPowerMeter2Combo.SelectedIndex = ratedSet.PM_ODU;
                    rated.coolingPhaseCombo.SelectedValue       = ratedSet.Phase;

                    ratedSet.Fetch(1);
                    rated.HeatingRecNo = ratedSet.RecNo;
                    rated.heatingCapacityEdit.EditValue         = ratedSet.Capacity;
                    rated.heatingPowerInEdit.EditValue          = ratedSet.Power;
                    rated.heatingEepEdit.EditValue              = ratedSet.EER_COP;
                    rated.heatingVoltEdit.EditValue             = ratedSet.Volt;
                    rated.heatingCurrentEdit.EditValue          = ratedSet.Amp;
                    rated.heatingFreqCombo.Text                 = ratedSet.Freq;
                    rated.heatingPowerMeter1Combo.SelectedIndex = ratedSet.PM_IDU;
                    rated.heatingPowerMeter2Combo.SelectedIndex = ratedSet.PM_ODU;
                    rated.heatingPhaseCombo.SelectedValue       = ratedSet.Phase;
                }
            }

            ThermoPressParamDataSet tcSet = Context.DB.ThermoPressParamSet;

            tcSet.Select(noteNo, 0);
            for (int i = 0; i < tcSet.GetRowCount(); i++)
            {
                MeasureRow row = Context.Condition.TC1[i];

                tcSet.Fetch(i);
                row.Name = tcSet.Name;
            }

            tcSet.Select(noteNo, 1);
            for (int i = 0; i < tcSet.GetRowCount(); i++)
            {
                MeasureRow row = Context.Condition.TC2[i];

                tcSet.Fetch(i);
                row.Name = tcSet.Name;
            }

            tcSet.Select(noteNo, 2);
            for (int i = 0; i < tcSet.GetRowCount(); i++)
            {
                MeasureRow row = Context.Condition.TC3[i];

                tcSet.Fetch(i);
                row.Name = tcSet.Name;
            }

            tcSet.Select(noteNo, 3);
            for (int i = 0; i < tcSet.GetRowCount(); i++)
            {
                MeasureRow row = Context.Condition.Pressures[i];

                tcSet.Fetch(i);
                row.Name = tcSet.Name;
            }

            Context.Condition.Control.RefreshData();
        }