public InformationResident(User user) : this() { CurrentUser = user; List <Resident> residents = ResidentService.QueryByUser(CurrentUser.UserId); InfoBindingSource.DataSource = residents; }
private void btnQuery_Click(object sender, EventArgs e) { switch (cmbQuery.SelectedIndex) { case 0: // 全部 InfoBindingSource.DataSource = ResidentService.GetAll(); break; case 1: // 根据姓名查询 InfoBindingSource.DataSource = ResidentService.QueryByName(txtQuery.Text); break; case 2: // 根据用户名查询 InfoBindingSource.DataSource = ResidentService.QueryByUser(txtQuery.Text); break; case 3: //查询健康的居民 InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.Health); break; case 4: //查询隔离的居民 InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.quarantine); break; case 5: //查询患病的居民 InfoBindingSource.DataSource = ResidentService.QueryByHealthStatus(HealthStatus.sick); break; } }
public HealthInfoResident(User user) : this() { CurrentUser = user; List <Resident> residents = ResidentService.QueryByUser(CurrentUser.UserId); List <HealthInformation> healthInformation = null; for (int i = 0; i < residents.Count(); i++) { healthInformation.Add(new HealthInformation(residents[i])); } TodayBindingSource.DataSource = healthInformation; HealthBindingSource.DataSource = HealthInformationService.QueryByUser(CurrentUser.UserId); }
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); } }