public void DataBind() { IList <aers_tbl_staff> list = dal.staffFindAll(); foreach (aers_tbl_staff item in list) { if (item.RoleState.Contains("147")) { item.StringRoleState = "省厅"; } else if (item.RoleState.Contains("148")) { item.StringRoleState = "区域"; } else if (item.RoleState.Contains("145")) { item.StringRoleState = "护理部"; } else if (item.RoleState.Contains("146")) { item.StringRoleState = "护士长"; } else { item.StringRoleState = "未知状态"; } if (item.Sex == "107") { item.Sex = "女"; } else if (item.Sex == "108") { item.Sex = "男"; } else { item.Sex = "未知"; } } string Pram = txtfind.Text.Trim(); if (!string.IsNullOrEmpty(Pram)) { list = list.Where(o => o.Name.Contains(Pram)).ToList(); } this.gridControl1.DataSource = new BindingList <aers_tbl_staff>(list);; lblcount.Text = "共 " + list.Count + " 条"; }
private void txt_HospId_EditValueChanged(object sender, EventArgs e) { string HospId = txt_HospId.EditValue.ToString(); IList <aers_tbl_hospdep> listhospdep = dalhospdep.hospdepFindAll(); IList <aers_tbl_staff> liststaff = dalstaff.staffFindAll(); foreach (aers_tbl_staff item in liststaff) { aers_tbl_hospdep hospdep = listhospdep.FirstOrDefault(o => o.HospdepId == item.DepId); if (hospdep != null) { item.HospId = hospdep.HospId; item.HospdepName = hospdep.HospdepName; } } this.txt_HospdepId.FieldValue = "HospdepId"; this.txt_HospdepId.DisplayValue = "HospdepName"; this.txt_HospdepId.DataSource = listhospdep.Where(o => o.HospId == HospId).ToList(); }