示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }