Exemplo n.º 1
0
        private void copyButton_Click(object sender, EventArgs e)
        {
            if (mode != EDataSetMode.View)
            {
                return;
            }
            if (scheduleGridView.FocusedRowHandle < 0)
            {
                return;
            }

            if (MessageBox.Show("Would you like to copy a record focused?",
                                Resource.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }

            db.Lock();

            try
            {
                ScheduleParamDataSet set = db.ScheduleParamSet;

                standardEdit.Focus();
                SetEditToDataSet();

                set.RecNo = (int)db.GetGenNo("GN_SCHEDULEPARAM");
                set.Insert();
            }
            finally
            {
                db.Unlock();
            }

            searchButton.PerformClick();
        }
Exemplo n.º 2
0
        private void InsertNote()
        {
            FbTransaction trans = db.BeginTrans();

            try
            {
                NoteParamDataSet noteSet = db.NoteParamSet;
                noteSet.RecNo     = (int)db.GetGenNo("GN_CONDITION_NOTEPARAM");
                noteSet.ParamNo   = -1;
                noteSet.Company   = noteCompanyEdit.Text;
                noteSet.TestName  = noteTestNameEdit.Text;
                noteSet.TestNo    = noteTestNoEdit.Text;
                noteSet.Observer  = noteObserverEdit.Text;
                noteSet.Maker     = noteMakerEdit.Text;
                noteSet.Model1    = noteModel1Edit.Text;
                noteSet.Serial1   = noteSerial1Edit.Text;
                noteSet.Model2    = noteModel2Edit.Text;
                noteSet.Serial2   = noteSerial2Edit.Text;
                noteSet.Model3    = noteModel3Edit.Text;
                noteSet.Serial3   = noteSerial3Edit.Text;
                noteSet.ExpDevice = noteExpDeviceEdit.Text;
                noteSet.Refrig    = noteRefrigerantCombo.Text;
                noteSet.RefCharge = noteRefChargeEdit.Text;
                noteSet.Memo      = noteMemoEdit.Text;
                noteSet.CoolUnit  = (EUnitCapacity)methodCapaCoolingUnitCombo.SelectedValue;
                noteSet.HeatUnit  = (EUnitCapacity)methodCapaHeatingUnitCombo.SelectedValue;
                noteSet.Insert(trans);

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

                    ratedSet.RecNo    = (int)db.GetGenNo("GN_CONDITION_RATEDPARAM");
                    ratedSet.NoteNo   = noteSet.RecNo;
                    ratedSet.PageNo   = ctrl.Index;
                    ratedSet.Mode     = ETestMode.Cooling;
                    ratedSet.Capacity = float.Parse(ctrl.coolingCapacityEdit.Text);
                    ratedSet.Power    = float.Parse(ctrl.coolingPowerInEdit.Text);
                    ratedSet.EER_COP  = float.Parse(ctrl.coolingEepEdit.Text);
                    ratedSet.Volt     = float.Parse(ctrl.coolingVoltEdit.Text);
                    ratedSet.Amp      = float.Parse(ctrl.coolingCurrentEdit.Text);
                    ratedSet.Freq     = ctrl.coolingFreqCombo.Text;
                    ratedSet.PM_IDU   = ctrl.coolingPowerMeter1Combo.SelectedIndex;
                    ratedSet.PM_ODU   = ctrl.coolingPowerMeter2Combo.SelectedIndex;
                    ratedSet.Phase    = (EWT330Wiring)ctrl.coolingPhaseCombo.SelectedValue;
                    ratedSet.Insert(trans);

                    ratedSet.RecNo    = (int)db.GetGenNo("GN_CONDITION_RATEDPARAM");
                    ratedSet.NoteNo   = noteSet.RecNo;
                    ratedSet.PageNo   = ctrl.Index;
                    ratedSet.Mode     = ETestMode.Heating;
                    ratedSet.Capacity = float.Parse(ctrl.heatingCapacityEdit.Text);
                    ratedSet.Power    = float.Parse(ctrl.heatingPowerInEdit.Text);
                    ratedSet.EER_COP  = float.Parse(ctrl.heatingEepEdit.Text);
                    ratedSet.Volt     = float.Parse(ctrl.heatingVoltEdit.Text);
                    ratedSet.Amp      = float.Parse(ctrl.heatingCurrentEdit.Text);
                    ratedSet.Freq     = ctrl.heatingFreqCombo.Text;
                    ratedSet.PM_IDU   = ctrl.heatingPowerMeter1Combo.SelectedIndex;
                    ratedSet.PM_ODU   = ctrl.heatingPowerMeter2Combo.SelectedIndex;
                    ratedSet.Phase    = (EWT330Wiring)ctrl.heatingPhaseCombo.SelectedValue;
                    ratedSet.Insert(trans);
                }

                ThermoPressParamDataSet tcSet = db.ThermoPressParamSet;
                foreach (MeasureRow row in id1TCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 0;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in id2TCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 1;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in odTCs)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 2;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                foreach (MeasureRow row in presses)
                {
                    tcSet.RecNo  = (int)db.GetGenNo("GN_CONDITION_THERMOPRESSPARAM");
                    tcSet.NoteNo = noteSet.RecNo;
                    tcSet.ChType = 3;
                    tcSet.ChNo   = row.No;
                    tcSet.Name   = row.Value;
                    tcSet.Insert(trans);
                }

                db.CommitTrans();
            }
            catch (Exception e)
            {
                Resource.TLog.Log((int)ELogItem.Exception, e.ToString());
                db.RollbackTrans();
            }
        }