public ResidentAccessManagement(Resident res, double temp, InOut inout, string notes) { Resident = res; Tempreture = temp; In_Out = inout; Notes = notes; }
//更新 public static void Update(Resident resident) { using (var entity = new CommunityEpidemicManagementSystemContext()) { try { entity.Residents.Remove(Get(resident.ResidentId)); entity.Residents.Add(resident); entity.SaveChanges(); } catch (Exception ex) { string errorInfo = ex.Message; if (ex is DbEntityValidationException) { foreach (var validationResult in ((DbEntityValidationException)ex).EntityValidationErrors) { foreach (var error in validationResult.ValidationErrors) { errorInfo = $"{errorInfo}" + "\n" + $"{error.ErrorMessage}"; } } } throw new ApplicationException("更新时出错!\n" + $"{errorInfo}"); } } }
public ResidentMission(string id, string description, DateTime ddl_time, Resident resident) { ResidentMissionId = id; Description = description; DDLTime = ddl_time; Resident = resident; }
public Emergency(Resident res, string addr, string emergDetails, string notes) : this() { this.resident = res; this.Address = addr; this.Details = emergDetails; this.RaiseTime = DateTime.Now; this.Notes = notes; }
public TravelRecord(string id, User user, Resident resident, string departure, string destination, DateTime dateLeave, DateTime dateCome, string transport, string transportNumber, string remarks) : this() { TravelRecordId = id; User = user; Resident = resident; Departure = departure; Destination = destination; DateLeave = dateLeave; DateCome = dateCome; Transport = transport; TransportNumber = transportNumber; Remarks = remarks; }
private void btnEdit_Click(object sender, EventArgs e) { Resident resident = ResidentBindingSource.Current as Resident; if (resident == null) { MessageBox.Show("请选择一个家庭成员进行修改"); return; } InformationEdit information = new InformationEdit(resident); if (information.ShowDialog() == DialogResult.OK) { ResidentBindingSource.ResetBindings(false); } }
private void btnDelete_Click(object sender, EventArgs e) { Resident resident = UserBindingSource.Current as Resident; if (resident == null) { MessageBox.Show("请选择一个家庭成员进行删除"); return; } DialogResult MsgBoxResult; MsgBoxResult = MessageBox.Show("您确定要删除吗?", "提示", MessageBoxButtons.YesNo); if (MsgBoxResult == DialogResult.Yes) { ResidentService.Remove(resident.ResidentId); UserBindingSource.ResetBindings(false); } }
private void btnEdit_Click(object sender, EventArgs e) { Resident resident = InfoBindingSource.Current as Resident; if (resident == null) { MessageBox.Show("请选择一个信息进行修改"); return; } resident = ResidentService.Get(resident.ResidentId); InformationEdit informationEdit = new InformationEdit(resident); if (informationEdit.ShowDialog() == DialogResult.OK) { ResidentService.Update(informationEdit.Resident); InfoBindingSource.DataSource = ResidentService.QueryByUser(CurrentUser.UserId); InfoBindingSource.ResetBindings(false); } }
public InformationEdit(Resident resident) : this() { this.Resident = resident; this.ResidentBindingSource.DataSource = resident; }
public HealthInformation(Resident resident) : this() { this.Resident = resident; }