///// <summary> ///// 展开节点触发的事件 ///// xlb 2013-01-29 ///// 解决存在大量数据时一次加载引起的卡屏 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //private void treeListInpat_AfterExpand(object sender, DevExpress.XtraTreeList.NodeEventArgs e) //{ // try // { // //如果有子节点则展开 // if (e.Node.HasChildren) // { // e.Node.ExpandAll(); // } // TreeListNode parentNode = e.Node;//以当前要展开的节点为父节点 // InPatientSim inpatient=new InPatientSim(); // if (e.Node.Tag is InPatientSim) // { // inpatient = e.Node.Tag as InPatientSim; // } // List<InCommonNoteEnmtity> inCommonNoteList = m_inCommonNoteBiz.GetSimInCommonNote(inpatient.NoofInpat.ToString()); // MakeTreeATwo(inCommonNoteList, parentNode); // } // catch (Exception ex) // { // MyMessageBox.Show(1, ex); // } //} #endregion /// <summary> /// 右键新增事件 /// xlb 2013-01-19 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { InPatientSim inpatient = null; TreeListNode node = treeListInpat.FocusedNode; //父节点 TreeListNode node2 = null; //子节点 if (node != null && node.Tag != null && node.Tag is InPatientSim) { inpatient = node.Tag as InPatientSim; } CommonChooseForm commonChooseForm = new Core.CommonTableConfig.CommonNoteUse.CommonChooseForm("护理单据模板选择", m_app); //窗体运行起始位置居中 commonChooseForm.StartPosition = FormStartPosition.CenterScreen; if (commonChooseForm.ShowDialog() != DialogResult.OK) { return; } InCommonNoteEnmtity inCommonNote = ConvertToByCommonNote(commonChooseForm.SelectCommonNoteEntity, inpatient); if (inCommonNote == null) { return; } InCommonNoteBiz icbiz = new InCommonNoteBiz(m_app); icbiz.GetDetaliInCommonNote(ref inCommonNote); string createTIme = DateUtil.getDateTime(inCommonNote.CreateDateTime, DateUtil.NORMAL_LONG); string commmonNote = "创建人:" + inCommonNote.CreateDoctorName + "|" + "时间:" + createTIme; node2 = treeListInpat.AppendNode(new object[] { inCommonNote.InCommonNoteName, "Leaf", commmonNote }, node); node2.Tag = inCommonNote; treeListInpat.FocusedNode = node2;//定位在新增子节点上 } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 将CommonNoeEntity->InCommonNoteEnmtity; /// xlb 2013-01-19 /// </summary> /// <param name="commonNote"></param> /// <returns></returns> private InCommonNoteEnmtity ConvertToByCommonNote(CommonNoteEntity commonNote, InPatientSim inPatient) { try { //用来接收选择的模板的新模板名称 string commonNoteNames = commonNote.CommonNoteName == null ? "" : commonNote.CommonNoteName; CommonNoteBiz commonNoteBiz = new CommonNoteBiz(m_app); commonNote = commonNoteBiz.GetDetailCommonNote(commonNote.CommonNoteFlow); commonNote.CommonNoteName = commonNoteNames;//模板名称修改 InCommonNoteEnmtity inCommonNote = InCommonNoteBiz.ConvertCommonToInCommon(commonNote); InCommonNoteBiz incommonNoteBiz = new InCommonNoteBiz(m_app); DataTable dtPatient = incommonNoteBiz.GetInpatient(inPatient.NoofInpat.ToString()); inCommonNote.CurrDepartID = dtPatient.Rows[0]["OUTHOSDEPT"].ToString(); inCommonNote.CurrDepartName = dtPatient.Rows[0]["DEPARTNAME"].ToString(); inCommonNote.CurrWardID = dtPatient.Rows[0]["OUTHOSWARD"].ToString(); inCommonNote.CurrWardName = dtPatient.Rows[0]["WARDNAME"].ToString(); inCommonNote.NoofInpatient = inPatient.NoofInpat.ToString(); inCommonNote.InPatientName = dtPatient.Rows[0]["NAME"].ToString(); inCommonNote.CreateDateTime = DateTime.Now.ToString(); inCommonNote.Valide = "1"; string message = ""; bool saveResult = incommonNoteBiz.SaveInCommomNoteAll(inCommonNote, ref message); if (saveResult) { return(inCommonNote); } else { MessageBox.Show("创建单据失败"); return(null); } } catch (Exception ex) { throw ex; } }