private void btnAdd_Click(object sender, EventArgs e) { TravelExperienceEdit experienceEdit = new TravelExperienceEdit(new TravelRecord()); if (experienceEdit.ShowDialog() == DialogResult.OK) { experienceEdit.record.User = CurrentUser; TravelRecordService.Add(experienceEdit.record); QueryAll(CurrentUser); } }
private void btnEdit_Click(object sender, EventArgs e) { TravelRecord record = TravelBindingSource.Current as TravelRecord; if (record == null) { MessageBox.Show("请选择一个记录进行修改"); return; } TravelExperienceEdit experienceEdit = new TravelExperienceEdit(record); if (experienceEdit.ShowDialog() == DialogResult.OK) { TravelRecordService.Update(experienceEdit.record); QueryAll(CurrentUser); } }