private void btnAdd_Click(object sender, EventArgs e) { if (this.cmbStation.SelectedIndex < 0) { return; } if (this.cmbPerson.SelectedIndex < 0) { return; } string text = string.Format("添加 {0}, {1}, {2} ?", cmbPerson.Text, cmbStation.Text, this.dtpInsertDT.Value); if (MessageBox.Show(text, "cap", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } DB db = DBFactory.GetDB(); tblTmData tmdata = new tblTmData(); tmdata.tblDevice = db.tblDevice.Single(c => c.DeviceID == GetSelectedDeviceID()); int tmid = GetSelectedTmID(db); tmdata.tblTM = db.tblTM.Single(c => c.TmID == tmid); tmdata.TmDataDT = this.dtpInsertDT.Value; db.tblTmData.InsertOnSubmit(tmdata); db.SubmitChanges(); MessageBox.Show("添加成功"); }
partial void DeletetblTmData(tblTmData instance);
partial void UpdatetblTmData(tblTmData instance);
partial void InserttblTmData(tblTmData instance);
private void detach_tblTmData(tblTmData entity) { this.SendPropertyChanging(); entity.tblTM = null; }
private void attach_tblTmData(tblTmData entity) { this.SendPropertyChanging(); entity.tblTM = this; }