/// <summary> /// 保存选中的病区 /// </summary> private void SavSelDwards() { frmPacCHK.wardSelList.Clear(); //清空原有选中的病区 frmPacCHK.wardUnSelList.Clear(); //清空原有没选中的病区 if (flpWards.Controls.Count > 0) { Dward Selward = null; foreach (Control c in flpWards.Controls) { if (c is ucDwardInfo) { ucDwardInfo wardInfo = (ucDwardInfo)c; Selward = wardInfo.ward; if (wardInfo.flag == true)//选中的情况 { frmPacCHK.wardSelList.Add(Selward); } else { frmPacCHK.wardUnSelList.Add(Selward); } } } } }
/// <summary> /// 显示所有病区 /// </summary> private void showDwards() { if (wardSelList.Count > 0)//有选中的病区的情况 { for (int i = 0; i < wardSelList.Count; i++) { Dward ward = new Dward(); ward = wardSelList[i]; ucDwardInfo wardInfo = new ucDwardInfo(ward); wardInfo.autoSelected(); flpWards.Controls.Add(wardInfo); //wardInfo.Width = (flpWards.Width - 30) / 5; // wardInfo.Height = (flpWards.Height-60) / 8; } if (wardUnSelList.Count > 0)//存在没有选中的的病区的情况 { for (int i = 0; i < wardUnSelList.Count; i++) { Dward ward = new Dward(); ward = wardUnSelList[i]; ucDwardInfo wardInfo = new ucDwardInfo(ward); wardInfo.antoUnSelected(); flpWards.Controls.Add(wardInfo); // wardInfo.Width = (flpWards.Width - 30) / 5; // wardInfo.Height = (flpWards.Height - 60) / 8; } } } else //加载全部病区 { DataSet ds = new DataSet(); //ds = sel.getAllDward(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; Dward ward = new Dward(); ward.WardCode = dr["WardCode"].ToString(); ward.WardName = dr["WardName"].ToString(); ward.WardSimName = dr["WardSimName"].ToString(); ward.WardArea = dr["WardArea"].ToString(); ucDwardInfo wardInfo = new ucDwardInfo(ward); wardInfo.antoUnSelected(); cbSelAll.Checked = false; flpWards.Controls.Add(wardInfo); wardInfo.Width = (flpWards.Width - 30) / 5; wardInfo.Height = (flpWards.Height - 60) / 8; } } } }
/// <summary> /// 构造方法 /// </summary> /// <param name="dr">数据库一条病区对象</param> public ucDwardInfo(Dward dWard) { InitializeComponent(); ward = dWard; }