private void saveButton_Click(object sender, EventArgs e) { standardEdit.Focus(); string standard = standardEdit.Text.Trim(); string name = nameEdit.Text.Trim(); if ((standard == "") || (name == "")) { MessageBox.Show("You must fill Standard and Name fields!", Resource.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); standardEdit.Focus(); return; } db.Lock(); try { ScheduleParamDataSet set = db.ScheduleParamSet; SetEditToDataSet(); if (mode == EDataSetMode.New) { set.RecNo = (int)db.GetGenNo("GN_SCHEDULEPARAM"); set.ParamNo = -1; set.Insert(); } else { db.ScheduleParamSet.Update(); } } finally { db.Unlock(); } SetDataSetMode(EDataSetMode.View); searchButton.PerformClick(); }
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(); }
private void InsertSchedule(int paramNo) { foreach (ConditionSchedule sch in Context.Condition.Schedules) { ScheduleParamDataSet schSet = Context.DB.ScheduleParamSet; schSet.RecNo = (int)Context.DB.GetGenNo("GN_SCHEDULEPARAM"); schSet.ParamNo = paramNo; schSet.Standard = sch.Standard; schSet.Name = sch.Name; schSet.NoOfSteady = sch.NoOfSteady; schSet.Preparation = sch.PreRun; schSet.Judgement = sch.Judge; schSet.Repeat = sch.Repeat; schSet.ID1Use = sch.Indoor1Use; schSet.ID1Mode1 = sch.Indoor1Mode1; schSet.ID1Duct1 = sch.Indoor1Duct1; schSet.ID1Mode2 = sch.Indoor1Mode2; schSet.ID1Duct2 = sch.Indoor1Duct2; schSet.ID1EdbSetup = sch.Indoor1DB; schSet.ID1EdbAvg = sch.Indoor1DBAvg; schSet.ID1EdbDev = sch.Indoor1DBDev; schSet.ID1EwbSetup = sch.Indoor1WB; schSet.ID1EwbAvg = sch.Indoor1WBAvg; schSet.ID1EwbDev = sch.Indoor1WBDev; schSet.ID1Ldb1Dev = sch.Indoor1LDB1Dev; schSet.ID1Lwb1Dev = sch.Indoor1LWB1Dev; schSet.ID1Af1Dev = sch.Indoor1AirFlow1Dev; schSet.ID1Ldb2Dev = sch.Indoor1LDB2Dev; schSet.ID1Lwb2Dev = sch.Indoor1LWB2Dev; schSet.ID1Af2Dev = sch.Indoor1AirFlow2Dev; schSet.ID1Cdp1Setup = sch.Indoor1CP1; schSet.ID1Cdp1Avg = sch.Indoor1CP1Avg; schSet.ID1Cdp1Dev = sch.Indoor1CP1Dev; schSet.ID1Cdp2Setup = sch.Indoor1CP2; schSet.ID1Cdp2Avg = sch.Indoor1CP2Avg; schSet.ID1Cdp2Dev = sch.Indoor1CP2Dev; schSet.ID2Use = sch.Indoor2Use; schSet.ID2Mode1 = sch.Indoor2Mode1; schSet.ID2Duct1 = sch.Indoor2Duct1; schSet.ID2Mode2 = sch.Indoor2Mode2; schSet.ID2Duct2 = sch.Indoor2Duct2; schSet.ID2EdbSetup = sch.Indoor2DB; schSet.ID2EdbAvg = sch.Indoor2DBAvg; schSet.ID2EdbDev = sch.Indoor2DBDev; schSet.ID2EwbSetup = sch.Indoor2WB; schSet.ID2EwbAvg = sch.Indoor2WBAvg; schSet.ID2EwbDev = sch.Indoor2WBDev; schSet.ID2Ldb1Dev = sch.Indoor2LDB1Dev; schSet.ID2Lwb1Dev = sch.Indoor2LWB1Dev; schSet.ID2Af1Dev = sch.Indoor2AirFlow1Dev; schSet.ID2Ldb2Dev = sch.Indoor2LDB2Dev; schSet.ID2Lwb2Dev = sch.Indoor2LWB2Dev; schSet.ID2Af2Dev = sch.Indoor2AirFlow2Dev; schSet.ID2Cdp1Setup = sch.Indoor2CP1; schSet.ID2Cdp1Avg = sch.Indoor2CP1Avg; schSet.ID2Cdp1Dev = sch.Indoor2CP1Dev; schSet.ID2Cdp2Setup = sch.Indoor2CP2; schSet.ID2Cdp2Avg = sch.Indoor2CP2Avg; schSet.ID2Cdp2Dev = sch.Indoor2CP2Dev; schSet.ODUse = sch.OutdoorUse; schSet.ODDp = sch.OutdoorDpSensor; schSet.ODAutoVolt = sch.OutdoorAutoVolt; schSet.ODEdbSetup = sch.OutdoorDB; schSet.ODEdbAvg = sch.OutdoorDBAvg; schSet.ODEdbDev = sch.OutdoorDBDev; schSet.ODEwbSetup = sch.OutdoorWB; schSet.ODEwbAvg = sch.OutdoorWBAvg; schSet.ODEwbDev = sch.OutdoorWBDev; schSet.ODEdpSetup = sch.OutdoorDP; schSet.ODEdpAvg = sch.OutdoorDPAvg; schSet.ODEdpDev = sch.OutdoorDPDev; schSet.ODVolt1Setup = sch.OutdoorVolt1; schSet.ODVolt1Avg = sch.OutdoorVolt1Avg; schSet.ODVolt1Dev = sch.OutdoorVolt1Dev; schSet.ODVolt2Setup = sch.OutdoorVolt2; schSet.ODVolt2Avg = sch.OutdoorVolt2Avg; schSet.ODVolt2Dev = sch.OutdoorVolt2Dev; schSet.Insert(Context.DB.Trans); } }