//保存 private void btSave_Click(object sender, EventArgs e) { if (this.txtName.Text.Trim() == "") { MessageBox.Show("请先填写模板名称!", "提示"); return; } try { HIS.EMR_BLL.EmrMould mould = new HIS.EMR_BLL.EmrMould(); mould.MouldClass = -1; mould.MouldCreateDate = XcDate.ServerDateTime; mould.MouldCreateDept = (int)Public.PublicStaticFunction.CurrentDeptId; mould.MouldCreateEmp = (int)Public.PublicStaticFunction.CurrentEmployeeId; mould.MouldLevel = _level; mould.MouldName = this.txtName.Text.Trim(); mould.MouldType = Public.PublicStaticFunction.GetEMRTypeCode(_currentType);; mould.MouldContent = _control.GetValue(); mould.Add(); MessageBox.Show("保存成功!", "提示"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); } }
//选择模板 private void tWMould_AfterSelect(object sender, TreeViewEventArgs e) { this.plCenter.Controls.Clear(); if (this.tWMould.SelectedNode.Parent != null) { _currentMould = (HIS.EMR_BLL.EmrMould) this.tWMould.SelectedNode.Tag; _control = EMRRecordControlFactory.CreateEMRRecordControl(_currentMould.MouldType.Trim(), _currentMould.MouldContent); this.plCenter.AutoScroll = true; this.plCenter.Controls.Add(_control); this.txtName.Text = _currentMould.MouldName; } }
/// <summary> /// 创建模板列表 /// </summary> /// <param name="node"></param> /// <param name="classId"></param> /// <param name="mouldTable"></param> private void CreateMouldTreeNode(TreeNode node, int classId, DataTable mouldTable) { if (mouldTable == null || mouldTable.Rows.Count <= 0) { return; } DataRow[] rows = mouldTable.Select(HIS.BLL.Tables.emr_mould_class.MOULDCLASS + "=" + classId, HIS.BLL.Tables.emr_mould_class.MOULDID); if (rows != null && rows.Length > 0) { foreach (DataRow row in rows) { HIS.EMR_BLL.EmrMould mould = (HIS.EMR_BLL.EmrMould)HIS.MZDoc_BLL.Public.Function.DataRowToObject <HIS.EMR_BLL.EmrMould>(row); TreeNode childnode = new TreeNode(mould.MouldName, 21, 7); childnode.Tag = mould; node.Nodes.Add(childnode); CreateMouldTreeNode(childnode, mould.MouldId, mouldTable); } } }
/// <summary> /// 新增模板 /// </summary> public void AddMould() { FrmEmrMouldInfo form = new FrmEmrMouldInfo(); form.ShowDialog(); if (form.IsSure) { HIS.EMR_BLL.EmrMould mould = new HIS.EMR_BLL.EmrMould(); mould.MouldClass = -1; mould.MouldCreateDate = XcDate.ServerDateTime; mould.MouldCreateDept = (int)_view.currentDept.DeptID; mould.MouldCreateEmp = (int)_view.currentUser.EmployeeID; mould.MouldLevel = _view.CurrentMouldLevel; mould.MouldName = form.MouldName; mould.MouldType = _view.CurrentChiefElement.ElementCode; mould.MouldContent = EMRRecordControlFactory.CreateEMRRecordControl(_view.CurrentChiefElement.ElementCode).GetValue(); mould.Add(); _view.CurrentMould = mould; LoadMouldData(); } }