/// <summary> /// 重载实现过滤效果 /// </summary> protected override void DoFilter() { DataTable dtNewSource = EntityTools.ConvertToDataTable <EntityCodeOperator>(GlobalDic.DataSourceEmployee); dtNewSource.BeginLoadData(); DataColumn filterCol = new DataColumn("superFilterCol", Type.GetType("System.String")); dtNewSource.Columns.Add(filterCol); foreach (DataRow dr in dtNewSource.Rows) { string filterValue = ""; foreach (PopupTreeColumn col in base.columns) { filterValue += dr[col.FieldName].ToString() + "^"; } dr[filterCol] = filterValue; } dtNewSource.EndLoadData(); string filter = this.Text.Trim().Replace("'", "''").Replace("[", "[[]"); dtNewSource.DefaultView.RowFilter = "superFilterCol like '%" + filter + "%'"; dtNewSource = dtNewSource.DefaultView.ToTable(); this.DataSource = dtNewSource; if (dtNewSource.Rows.Count > 0) { base.ctlTreeList.FocusedNode = ctlTreeList.FindNodeByFieldValue(base.ValueMember, dtNewSource.Rows[0][base.ValueMember]); } }
/// <summary> /// NewOperRole /// </summary> internal void NewOperRole() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先保存职工主信息。"); return; } frmNew frm = new frmNew(EntityTools.ConvertToDataTable <EntityCodeRole>(DataSourceRole), "roleCode", "roleCode", "roleName"); if (frm.ShowDialog() == DialogResult.OK) { if (frm.lstNo.Count > 0) { foreach (int index in frm.lstNo) { EntityDefOperatorRole vo1 = new EntityDefOperatorRole(); vo1.operCode = vo.operCode; vo1.roleCode = DataSourceRole[index].roleCode; using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.SaveOperatorRole(vo1) < 0) { DialogBox.Msg("保存职工所属角色失败。"); return; } } } LoadOperRole(vo.operCode); } } }
/// <summary> /// NewFormDept /// </summary> internal void NewFormDept() { EntityEmrBasicInfo caseVo = GetCaseVo(); if (caseVo == null) { DialogBox.Msg("请先保存病历基础信息。"); return; } frmNew frm = new frmNew(EntityTools.ConvertToDataTable <EntityCodeDepartment>(GlobalDic.DataSourceDepartment), "deptCode", "deptCode", "deptName"); if (frm.ShowDialog() == DialogResult.OK) { if (frm.lstNo.Count > 0) { foreach (int index in frm.lstNo) { EntityEmrDept emrDept = new EntityEmrDept(); emrDept.caseCode = caseVo.caseCode; emrDept.deptCode = GlobalDic.DataSourceDepartment[index].deptCode; emrDept.attrFlag = 1; using (ProxyCommon proxy = new ProxyCommon()) { if (proxy.Service.SaveCaseDept(emrDept) < 0) { DialogBox.Msg("保存病历所属专科失败。"); return; } } } LoadCaseDept(caseVo.caseCode); } } }
/// <summary> /// SetDisplayText 通过设置DisplayText 来设置DBValue /// </summary> /// <param name="displayText"></param> public void SetDisplayText <T>(string displayText) where T : BaseDataContract { this.Properties.ForbidPoput = true; if (this.Properties.DataSource != null) { try { List <BaseDataContract> data = (Properties.gvDataBindingSource.DataSource as BindingListView <BaseDataContract>).LookUpItemSource.ToList(); List <T> lstT = new List <T>(); foreach (var item in data) { lstT.Add(item as T); } DataTable dt = EntityTools.ConvertToDataTable <T>(lstT); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][this.Properties.DisplayColumn].ToString() == displayText) { this.Properties.DBRow = this.Properties.DataSource[i]; this.Properties.DBValue = dt.Rows[i][this.Properties.ValueColumn].ToString(); break; } } } //if (Properties.gvData.RowCount > 0) //{ // for (int i = 0; i < Properties.gvData.RowCount; i++) // { // if (this.Properties.gvData.GetRowCellDisplayText(i, this.Properties.DisplayColumn) == displayText) // { // this.Properties.DBRow = (this.Properties.gvData.GetRow(i) as BaseDataContract); // this.Properties.DBValue = this.Properties.gvData.GetRowCellValue(i, this.Properties.ValueColumn).ToString(); // break; // } // } //} } catch (Exception ex) { } } this.Text = displayText; this.Properties.DisplayValue = displayText; this.Properties.ForbidPoput = false; }
/// <summary> /// 原因: 自定义单只在InitializeComponent后调用有效,非自定义单只在OnLoaded后调用后有效,所以2个地方都调 /// </summary> private void LoadData() { //字典信息处理 if (!DesignMode && this.DataSource == null) { this.Properties.PopupFormMinSize = new Size(450, 350); this.KeyFieldName = "IcdCode"; this.ParentFieldName = "ParentCode"; this.DisplayMember = "IcdName"; this.ValueMember = "IcdCode"; PopTreeColumnCollection cols = new PopTreeColumnCollection(); cols.Add(new PopupTreeColumn("IcdCode", "ICD码", 200)); cols.Add(new PopupTreeColumn("IcdName", "中文名称", 250)); cols.Add(new PopupTreeColumn("PyCode", "拼音码", 0)); cols.Add(new PopupTreeColumn("WbCode", "五笔码", 0)); this.Columns = cols; this.DataSource = EntityTools.ConvertToDataTable <EntityIcd>(GlobalDic.DataSourceICD); } }
/// <summary> /// NewOperDept /// </summary> internal void NewOperDept() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先保存职工主信息。"); return; } frmNew frm = new frmNew(EntityTools.ConvertToDataTable <EntityCodeDepartment>(GlobalDic.DataSourceDepartment), "deptCode", "deptCode", "deptName"); if (frm.ShowDialog() == DialogResult.OK) { if (frm.lstNo.Count > 0) { bool isDefault = false; foreach (int index in frm.lstNo) { EntityDefDeptemployee vo1 = new EntityDefDeptemployee(); vo1.operCode = vo.operCode; vo1.deptCode = GlobalDic.DataSourceDepartment[index].deptCode; if (Viewer.gvDept.RowCount == 0 && isDefault == false) { vo1.defaultFlag = 1; isDefault = true; } else { vo1.defaultFlag = 0; } using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.SaveOperatorDept(vo1) < 0) { DialogBox.Msg("保存职工所属科室失败。"); return; } } } LoadOperDept(vo.operCode, string.Empty); } } }
/// <summary> /// 原因: 自定义单只在InitializeComponent后调用有效,非自定义单只在OnLoaded后调用后有效,所以2个地方都调 /// </summary> private void LoadData() { //字典信息处理 if (!DesignMode && this.DataSource == null) { this.Properties.PopupFormMinSize = new Size(250, 300); this.KeyFieldName = "operCode"; this.ParentFieldName = ""; this.DisplayMember = "operName"; this.ValueMember = "operName"; PopTreeColumnCollection cols = new PopTreeColumnCollection(); cols.Add(new PopupTreeColumn("operCode", "工号", 100)); cols.Add(new PopupTreeColumn("operName", "姓名", 150)); cols.Add(new PopupTreeColumn("pyCode", "拼音码", 0)); cols.Add(new PopupTreeColumn("wbCode", "五笔码", 0)); this.Columns = cols; this.SetToGridMode(); this.DataSource = EntityTools.ConvertToDataTable <EntityCodeOperator>(GlobalDic.DataSourceEmployee); } }
/// <summary> /// 获取数据源 /// </summary> /// <returns></returns> private DataTable m_dtGetDataSource() { DataTable dtResult = null; if (this.m_dtSource == null && intClassID != 0) { System.Collections.Hashtable hsFilter = new System.Collections.Hashtable(); hsFilter["Classid"] = intClassID; hsFilter["Status"] = 1; clsProxyEntityFactory objFacProxy = new clsProxyEntityFactory(); m_dtSource = objFacProxy.m_GetTable(string.Empty, new clsEntityFactory(new clsEntityCommon()), hsFilter, true); m_dtSource = EntityTools.ConvertToDataTable <EntityIcd>(GlobalDic.DataSourceICD); } if (m_dtSource != null) { dtResult = m_dtSource.Copy(); } return(dtResult); }