// Residents private void btnCreate_Click(object sender, EventArgs e) { MissionAddResident addResident = new MissionAddResident(new ResidentMission()); if (addResident.ShowDialog() == DialogResult.OK) { addResident.Mission.CreatedTime = DateTime.Now; addResident.Mission.Resident = ResidentService.Get(CurrentUser.UserId); addResident.Mission.State = MissionStatus.未接受; ResidentMissionService.Add(addResident.Mission); QueryAll(CurrentUser); } }
// Residents private void btnEdit_Click(object sender, EventArgs e) { ResidentMission mission = MissionBindingSource.Current as ResidentMission; if (mission == null) { MessageBox.Show("请选择一个需求进行修改"); return; } if (mission.State == MissionStatus.已接受) { MessageBox.Show("订单已接受,无法修改!如有特殊情况请联系管理员。"); return; } mission = ResidentMissionService.Get(mission.ResidentMissionId); MissionAddResident addResident = new MissionAddResident(mission); if (addResident.ShowDialog() == DialogResult.OK) { ResidentMissionService.Update(addResident.Mission); QueryAll(CurrentUser); } }