/// <summary> /// 向摆药台列表中插入新节点 /// </summary> /// <param name="drugControl">摆药台信息</param> /// <returns>插入的节点信息</returns> private ListViewItem AddDrugControlToListView(DrugControl drugControl) { //设置插入的节点信息 ListViewItem lvi = new ListViewItem( ); //区别新增加和已保存的图标 if (drugControl.ID != "") { lvi.ImageIndex = 0; } else { lvi.ImageIndex = 1; } lvi.Text = drugControl.Name; //Tag属性保存摆药单分类实体 lvi.Tag = drugControl; //设置listView的子节点 lvi.SubItems.Add(drugControl.DrugAttribute.Name); lvi.SubItems.Add(drugControl.SendType == 0 ? "全部" : (drugControl.SendType == 1 ? "集中" : "临时")); lvi.SubItems.Add(this.GetShowTypeName(drugControl.SendType)); lvi.SubItems.Add(this.currentDept.Name); lvi.SubItems.Add(drugControl.Memo); //返回插入的节点 return(this.lvDrugControlList.Items.Add(lvi)); }
/// <summary> /// 增加摆药单 /// </summary> private void AddDrugControl( ) { //清理摆药单选择状态 this.ResetDrugBill( ); //清理摆药台选状态 //置所有的非当前摆药台为未选中状态 foreach (ListViewItem L in this.lvDrugControlList.CheckedItems) { L.Checked = false; } //设置要插入的节点 DrugControl newInfo = new DrugControl( ); newInfo.Name = "新建摆药台"; //在ListView中插入新节点 ListViewItem lvi = this.AddDrugControlToListView(newInfo); //选中新增加的节点 lvi.Selected = true; lvi.Checked = true; //在编辑信息中显示新增加的摆药台并切换到tabpage2 this.SetDrugControlInfo(newInfo); this.neuTabControl1.TabPages.Remove(this.tabPage2); this.neuTabControl1.TabPages.Add(this.tabPage2); this.neuTabControl1.SelectedIndex = 1; }
/// <summary> /// 设置要编辑摆药台的详细信息( to tabpage2) /// </summary> /// <param name="drugControl">当前编辑的摆药台</param> public void SetDrugControlInfo(DrugControl drugControl) { this.currentDrugControlInfo = drugControl; this.txtName.Text = this.currentDrugControlInfo.Name; this.CbxUser.Tag = this.currentDrugControlInfo.DrugAttribute.ID; this.CbxSendType.SelectedIndex = this.currentDrugControlInfo.SendType; this.CbxShowGrade.SelectedIndex = this.currentDrugControlInfo.ShowLevel; this.RtxMark.Text = this.currentDrugControlInfo.Memo; }
/// <summary> /// 保存有效性查询 /// </summary> /// <returns>成功返回True 失败返回False</returns> private bool IsSaveDrugControlValid(DrugControl drugControl) { foreach (ListViewItem lv in this.lvDrugControlList.Items) { DrugControl tempDrugControl = lv.Tag as DrugControl; if (tempDrugControl != null && tempDrugControl.ID != drugControl.ID && tempDrugControl.Name == drugControl.Name) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(drugControl.Name + " 摆药台名称重复")); return(false); } } return(true); }
/// <summary> /// 摆药台类表双击进入摆药台编辑状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvDrugControlList_DoubleClick(object sender, EventArgs e) { if (this.lvDrugControlList.SelectedItems.Count > 0) { //显示摆药单编辑信息 this.neuTabControl1.TabPages.Remove(this.tabPage2); this.neuTabControl1.TabPages.Add(this.tabPage2); this.SetDrugControlInfo(this.lvDrugControlList.SelectedItems[0].Tag as DrugControl); } else { //重新置摆药单为未选中状态 this.ResetDrugBill(); this.currentDrugControlInfo = new DrugControl( ); } }
/// <summary> /// 摆药台选择改变时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvDrugControlList_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvDrugControlList.SelectedItems.Count > 0) { //设置当前摆药台信息 this.SetDrugControlInfo(this.lvDrugControlList.SelectedItems[0].Tag as DrugControl); //显示摆药台对应的摆药单信息 this.ShowBillListByDrugControl( ); } else { //重新置摆药单为未选中状态 this.ResetDrugBill( ); this.currentDrugControlInfo = new DrugControl( ); } }
/// <summary> /// 设置要编辑摆药台的详细信息( to tabpage2) /// </summary> /// <param name="drugControl">当前编辑的摆药台</param> public void SetDrugControlInfo(DrugControl drugControl) { this.currentDrugControlInfo = drugControl; //摆药台名称 this.txtName.Text = this.currentDrugControlInfo.Name; //摆药台属性 this.cmbUser.Tag = this.currentDrugControlInfo.DrugAttribute.ID; //发送类型 this.cmbSendType.SelectedIndex = this.currentDrugControlInfo.SendType; //显示等级 this.cmbShowGrade.SelectedIndex = this.currentDrugControlInfo.ShowLevel; //是否自动打印摆药单 this.cbxAutoPrint.Checked = this.currentDrugControlInfo.IsAutoPrint; //说明 this.RtxMark.Text = this.currentDrugControlInfo.Memo; }
/// <summary> /// 向摆药台列表中插入新节点 /// </summary> /// <param name="drugControl">摆药台信息</param> /// <returns>插入的节点信息</returns> private ListViewItem AddDrugControlToListView(DrugControl drugControl) { //设置插入的节点信息 ListViewItem lvi = new ListViewItem( ); //区别新增加和已保存的图标 if (drugControl.ID != "") { lvi.ImageIndex = 0; } else { lvi.ImageIndex = 1; } lvi.Text = drugControl.Name; //Tag属性保存摆药单分类实体 lvi.Tag = drugControl; //设置listView的子节点 //用途 lvi.SubItems.Add(drugControl.DrugAttribute.Name); //发送类型 lvi.SubItems.Add(drugControl.SendType == 0 ? "全部" : (drugControl.SendType == 1 ? "集中" : "临时")); //显示等级 lvi.SubItems.Add(this.GetShowTypeName(drugControl.ShowLevel)); //是否自动打印摆药单 lvi.SubItems.Add(drugControl.IsAutoPrint ? "是" : "否"); //摆药单是否需要预览 打印门诊标签时该字段无效 lvi.SubItems.Add(drugControl.IsBillPreview ? "是" : "否"); //是否打印门诊标签 该参数只对出院带药摆药有效 lvi.SubItems.Add(drugControl.IsPrintLabel ? "是" : "否"); //所属药房 lvi.SubItems.Add(this.currentDept.Name); //备注 lvi.SubItems.Add(drugControl.Memo); //返回插入的节点 return(this.lvDrugControlList.Items.Add(lvi)); }
/// <summary> /// 摆药台选择改变时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lvDrugControlList_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvDrugControlList.SelectedItems.Count > 0) { //置所有的非当前摆药台为未选中状态 foreach (ListViewItem lvi in this.lvDrugControlList.CheckedItems) { lvi.Checked = false; } this.lvDrugControlList.SelectedItems[0].Checked = true; //设置当前摆药台信息 this.SetDrugControlInfo(this.lvDrugControlList.SelectedItems[0].Tag as DrugControl); //显示摆药台对应的摆药单信息 this.ShowBillListByDrugControl( ); } else { //重新置摆药单为未选中状态 this.ResetDrugBill( ); this.currentDrugControlInfo = new DrugControl( ); } }
/// <summary> /// 增加摆药台 /// </summary> private void AddDrugControl( ) { if (currentDept.ID == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请选择具体的科室")); return; } if (this.neuTabControl1.TabPages.ContainsKey(this.tabPage2.Name)) { this.neuTabControl1.TabPages.Remove(this.tabPage2); } //清理摆药台选状态 //置所有的非当前摆药台为未选中状态 foreach (ListViewItem L in this.lvDrugControlList.Items) { L.Selected = false; L.Checked = false; } //清理摆药单选择状态 this.ResetDrugBill(); //设置要插入的节点 DrugControl newInfo = new DrugControl( ); newInfo.Name = "新建摆药台"; //在ListView中插入新节点 ListViewItem lvi = this.AddDrugControlToListView(newInfo); //选中新增加的节点 lvi.Selected = true; lvi.Checked = true; //在编辑信息中显示新增加的摆药台并切换到tabpage2 this.SetDrugControlInfo(newInfo); this.neuTabControl1.TabPages.Add(this.tabPage2); this.neuTabControl1.SelectedIndex = 1; }