/// <summary> /// 获取界面信息填充表 /// </summary> /// <returns></returns> private DataTable GetUIInfo() { try { if (m_extensionTable == null) { m_extensionTable = new DataTable(); } if (!m_extensionTable.Columns.Contains("iemName")) { AddDataElement(m_extensionTable, "iemName"); } if (!m_extensionTable.Columns.Contains("iemValue")) { AddDataElement(m_extensionTable, "iemValue"); } if (m_extensionTable.Rows.Count > 0) { m_extensionTable.Rows.Clear(); } foreach (Control control in this.flowLayoutPanel1.Controls) { IemMainPageExceptUse iemUse = null; if (control is IIemMainPageExcept) { /*记录每个用户控件对应的使用对象信息*/ iemUse = (control as IIemMainPageExcept).GetIemMainPageExceptUse(); } if (iemUse == null) { iemUse = new IemMainPageExceptUse(); } //var iemUseEntity=from a in iemExcept select a.IemExId=iemUse.IemexId; IemMainPageExcept iemExceptEntity = null; foreach (var item in iemExcept) { if (item.IemExId == iemUse.IemexId) { iemExceptEntity = item; break; } } if (iemExceptEntity == null) { iemExceptEntity = new IemMainPageExcept(); } DataRow dataRow = m_extensionTable.NewRow(); dataRow["iemValue"] = iemUse.Value; dataRow["iemName"] = iemExceptEntity.IemExName; m_extensionTable.Rows.Add(dataRow); } return(m_extensionTable); } catch (Exception ex) { throw ex; } }
/// <summary> /// 重载构造 /// </summary> /// <param name="iemExcept"></param> /// <param name="iemExceptUse"></param> public UcCheckBox(IemMainPageExcept iemExcept, IemMainPageExceptUse iemExceptUse) : this() { try { if (iemExcept == null || iemExceptUse == null) { return; } this.iemExceptEntity = iemExcept; this.iemExceptUseEntity = iemExceptUse; if (string.IsNullOrEmpty(iemExcept.IemOtherName)) { iemExcept.IemOtherName = "未指定列"; } this.checkEdit1.Text = iemExcept.IemOtherName + ":"; int width = TextRenderer.MeasureText(checkEdit1.Text, checkEdit1.Font).Width + 5; this.Width = width; InitDefault(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 保存方法 /// </summary> private void Save() { try { IemMainPageExceptUse iemExceptUse = null; /*编辑界面用户控件选择值并记录相应的病案维护对象*/ foreach (Control control in this.flowLayoutPanel1.Controls) { if (control is IIemMainPageExcept) { /*记录每个用户控件对应的使用对象信息*/ iemExceptUse = (control as IIemMainPageExcept).GetIemMainPageExceptUse(); } sqlUtil.SaveIemUse(iemExceptUse); } MessageBox.Show("更新成功"); GetUIInfo(); } catch (Exception ex) { MessageBox.Show("更新失败"); throw ex; } }
private IemMainPageExceptUse iemExceptUse; /*使用对象*/ /// <summary> /// 构造函数 /// </summary> /// <param name="iemExcept"></param> /// <param name="iemUse"></param> public CtrlDate(IemMainPageExcept iemExcept, IemMainPageExceptUse iemUse /*使用对象*/) { try { this.iemEntity = iemExcept; this.iemExceptUse = iemUse; } catch (Exception ex) { throw ex; } }
private IemMainPageExceptUse iemMainPageExceptUse; /*使用对象*/ /// <summary> /// 构造函数 /// </summary> /// <param name="iemExcept"></param> /// <param name="iemExceptUse"></param> public CtrlSpinEdit(IemMainPageExcept iemExcept, IemMainPageExceptUse iemExceptUse) { try { this.iemExceptEntity = iemExcept; this.iemMainPageExceptUse = iemExceptUse; InitData(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 重载构造函数 /// </summary> /// <param name="iemExcept">扩展维护对象</param> /// <param name="iemUseEntity">使用对象信息</param> public UcMemoEdit(IemMainPageExcept iemExcept, IemMainPageExceptUse iemUseEntity) : this() { try { this.iemExceptEntity = iemExcept; iemExceptUse = iemUseEntity; this.Width = memoEdit1.Width; InitDefault(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 重载构造 /// </summary> /// <param name="iemExcept"></param> public UcDate(IemMainPageExcept iemExcept, IemMainPageExceptUse iemUse /*使用对象*/) : this() { try { this.iemEntity = iemExcept; this.iemExceptUse = iemUse; this.Width = dateEdit1.Width; InitData(); } catch (Exception) { throw; } }
/// <summary> /// 重载构造函数 /// </summary> /// <param name="iemExcept"></param> public UcSpinEdit(IemMainPageExcept iemExcept, IemMainPageExceptUse iemExceptUse) : this() { try { this.iemExceptEntity = iemExcept; this.iemMainPageExceptUse = iemExceptUse; this.Width = spinEditIem.Width; InitData(); } catch (Exception ex) { throw ex; } }
IemMainPageExceptUse myIemMainPageExceptUse; //使用对象 /// <summary> /// 构造函数 /// </summary> /// <param name="iem"></param> /// <param name="iemMainUse"></param> public CtrlText(IemMainPageExcept iem, IemMainPageExceptUse iemMainUse) { try { if (iem == null || iemMainUse == null) { return; } this.iemExcept = iem; myIemMainPageExceptUse = iemMainUse; InitData(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 重载构造 /// </summary> /// <param name="iemExcept"></param> public UcPopControl( IemMainPageExcept iemExcept, IemMainPageExceptUse iemExceptUse) : this() { try { this.iemMainExcept = iemExcept; this.iemMainPageExceptUse = iemExceptUse; this.Width = popupContainerEditDX.Width; InitData(); RegisterEvent(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 构造重载 /// </summary> /// <param name="iemMainPageExcept"></param> public UcLookUpEdit(IemMainPageExcept iemMainPageExcept /*扩展维护对象*/, IemMainPageExceptUse iemUse /*使用对象*/) : this() { try { if (iemMainPageExcept == null || iemUse == null) { return; } this.iemEntity = iemMainPageExcept; this.iemExceptUse = iemUse; this.Width = lookUpEditorIem.Width + 5; InitLookUpEditor(iemEntity.DateElement); InitData(); } catch (Exception) { throw; } }
/// <summary> /// 保存使用记录信息 /// Add by xlb 2013-04-12 /// </summary> /// <param name="iemExceptUse"></param> /// <returns></returns> public bool SaveIemUse(IemMainPageExceptUse iemExceptUse) { try { if (iemExceptUse == null) { return(false); } if (string.IsNullOrEmpty(iemExceptUse.IemexUseId)) { iemExceptUse.IemexUseId = Guid.NewGuid().ToString(); } SqlParameter[] sps = { new SqlParameter("@iemExUserId", SqlDbType.NVarChar), new SqlParameter("@iemExId", SqlDbType.NVarChar), new SqlParameter("@nOofInpat", SqlDbType.NVarChar), new SqlParameter("@value", SqlDbType.NVarChar), new SqlParameter("@createDocId", SqlDbType.NVarChar), new SqlParameter("@modifyDocId", SqlDbType.VarChar), new SqlParameter("@modifyDateTime", SqlDbType.NVarChar) }; sps[0].Value = iemExceptUse.IemexUseId; sps[1].Value = iemExceptUse.IemexId; sps[2].Value = iemExceptUse.Noofinpat; sps[3].Value = iemExceptUse.Value;; sps[4].Value = DS_Common.currentUser.DoctorId; sps[5].Value = DS_Common.currentUser.DoctorId; sps[6].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); DS_SqlHelper.ExecuteNonQuery("MainPageExtenSion.ADDORMODIFYIEMUS", sps, CommandType.StoredProcedure); return(true); } catch (Exception ex) { throw ex; } }
/// <summary> /// 构造函数重载 /// </summary> /// <param name="iem"></param> public UcText(IemMainPageExcept iem, IemMainPageExceptUse iemMainPageExceptUse) : this() { try { if (iem == null || iemMainPageExceptUse == null) { return; } this.iemExcept = iem; myIemMainPageExceptUse = iemMainPageExceptUse; if (string.IsNullOrEmpty(iemExcept.IemOtherName)) { iemExcept.IemOtherName = "未指定列"; } this.Width = textEdit1.Width; InitData(); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据数据元类型返回相应的用户控件 /// </summary> /// <param name="iemExcept">扩展对象</param> /// <param name="dataEntity">数据元对象实体</param> /// <param name="iemMainPageExceptUse">扩展适用对象</param> /// <returns>对应用户控件</returns> public static UserControl CreateControl(IemMainPageExcept iemExcept, DateElementEntity dataEntity, IemMainPageExceptUse iemMainPageExceptUse) { try { if (dataEntity == null || string.IsNullOrEmpty(dataEntity.ElementId)) { return(null); } UserControl userControl = new UserControl(); string elementType = dataEntity.ElementType.ToUpper().Trim(); switch (elementType.ToLower()) { case "s1": /*普通文本*/ userControl = new UcText(iemExcept, iemMainPageExceptUse); break; case "s2": /*单选类型*/ case "s3": /*单选类型*/ userControl = new UcLookUpEdit(iemExcept, iemMainPageExceptUse); break; case "s4": /*大文本型*/ userControl = new UcMemoEdit(iemExcept, iemMainPageExceptUse); break; case "d": /*日期型*/ userControl = new UcDate(iemExcept, iemMainPageExceptUse); break; case "n": /*数值型*/ userControl = new UcSpinEdit(iemExcept, iemMainPageExceptUse); break; case "s9": /*多选型*/ userControl = new UcPopControl(iemExcept, iemMainPageExceptUse); break; } return(userControl); } catch (Exception ex) { throw ex; } }
/// <summary> /// 初始化界面 /// 控件名预留 /// Add by xlb 2013-04-09 /// 便于扩展后期工程 /// </summary> private void InitControl(List <IemMainPageExcept> iemList /*维护对象集合*/, List <IemMainPageExceptUse> iemMainPageExceptUseList) { try { foreach (var item in iemList) /*遍历集合中每个对象,每个对象对应一个数据元*/ { if (string.IsNullOrEmpty(item.IemControl)) /*控件名为空则按数据元类型进行处理*/ { IemMainPageExceptUse iemMainPageExceptUse = null; var ieExceptUseList = (from obj in iemMainPageExceptUseList where obj.IemexId == item.IemExId select obj).ToList(); if (ieExceptUseList == null || ieExceptUseList.Count <= 0) { iemMainPageExceptUse = new IemMainPageExceptUse(); iemMainPageExceptUse.Noofinpat = this.noofInpat; } else { //返回序列中的第一个对象 iemMainPageExceptUse = ieExceptUseList.First(); } if (string.IsNullOrEmpty(item.IemOtherName)) { item.IemOtherName = "未指定列"; } TextEdit textEdit = new TextEdit(); textEdit.Text = item.IemOtherName + ":"; textEdit.BackColor = Color.Transparent; textEdit.ForeColor = Color.Black; textEdit.Width = 150; textEdit.Enabled = false; textEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; textEdit.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; this.flowLayoutPanel1.Controls.Add(textEdit); if (item.IemOtherName == "是") { this.flowLayoutPanel1.SetFlowBreak(textEdit, true); } /*通过数据元类型返回相应用户控件*/ UserControl userControl = CreateControlFactory.CreateControl(item, item.DateElement, iemMainPageExceptUse); userControl.Width = 105; this.flowLayoutPanel1.Controls.Add(userControl); //确定用户控件是否需换行 if (item.IsOtherLine /*1:表示换行,0:不换行*/ == "是") { //流布局是否换行 this.flowLayoutPanel1.SetFlowBreak(userControl /*控件*/, true /*Bool类型表示是否换行*/); } } else { //SetControl("","");//预留的接口用于以后需要维护特定数据添加对应用户控件 } } //控制流方向 this.flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight; this.flowLayoutPanel1.Margin = new Padding(0, 0, 0, 0); } catch (Exception ex) { throw ex; } }