public short ModifySortIndex(HdpUIConfig model) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0}='{1}'" , SystemData.HdpUIConfigTable.SORT_INDEX, model.SortIndex); string szCondition = string.Format("{0}='{1}'", SystemData.HdpUIConfigTable.UI_CONFIG_ID, model.UIConfigID); string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.HDP_UICONFIG_T, sbField.ToString(), szCondition); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } if (nCount <= 0) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!"); return(SystemData.ReturnValue.EXCEPTION); } return(SystemData.ReturnValue.OK); }
private void toolbtnRight_Click(object sender, EventArgs e) { DataTableViewRow currRow = this.dataGridView1.CurrentRow; if (currRow == null) { return; } int rowIndex = currRow.Index; HdpUIConfig hdpUIConfig = this.dataGridView1.Rows[rowIndex].Tag as HdpUIConfig; string szShowName = string.Empty; if (this.dataGridView1.Rows[rowIndex].Cells[this.colShowName.Index].Value != null) { hdpUIConfig.ShowName = this.dataGridView1.Rows[rowIndex].Cells[this.colShowName.Index].Value.ToString().Trim(); } //降级处理 hdpUIConfig.UIGrade = hdpUIConfig.UIGrade + 1; //级别标记为空格 string flag = string.Empty; for (int index = 0; index < hdpUIConfig.UIGrade; index++) { flag += " "; } this.dataGridView1.Rows[rowIndex].Cells[this.colShowName.Index].Value = flag + hdpUIConfig.ShowName; this.dataGridView1.SetRowState(rowIndex, RowState.Update); }
/// <summary> /// 设置指定行显示的数据,以及绑定的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="hdpUIConfig">绑定的数据</param> /// <returns>bool</returns> private bool SetRowData(DataGridViewRow row, HdpUIConfig hdpUIConfig) { if (row == null || row.Index < 0 || hdpUIConfig == null) { return(false); } row.Tag = hdpUIConfig; //级别标记为空格 string flag = string.Empty; for (int index = 0; index < hdpUIConfig.UIGrade; index++) { flag += " "; } row.Cells[this.colShowName.Index].Value = flag + hdpUIConfig.ShowName; row.Cells[this.colShortCuts.Index].Value = hdpUIConfig.ShortCuts; row.Cells[this.colRightKey.Index].Value = hdpUIConfig.UIRightKey; row.Cells[this.colRightDesc.Index].Value = hdpUIConfig.UIRightDesc; row.Cells[this.colUICommand.Index].Value = hdpUIConfig.UICommand; row.Cells[this.colUIIcon.Index].Value = hdpUIConfig.UIIcon; row.Cells[this.colMicroHelp.Index].Value = hdpUIConfig.MicroHelp; row.Cells[this.colUIIconSize.Index].Value = hdpUIConfig.UIIconSize; return(true); }
/// <summary> /// 保存质控反馈问题类型列表的修改 /// </summary> /// <returns>bool</returns> public bool CommitModify() { if (this.dataGridView1.Rows.Count <= 0) { return(true); } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); int index = 0; int count = 0; short shRet = SystemData.ReturnValue.OK; this.dataGridView1.EndEdit(); while (index < this.dataGridView1.Rows.Count) { DataTableViewRow row = this.dataGridView1.Rows[index]; bool bIsDeletedRow = this.dataGridView1.IsDeletedRow(row); shRet = this.SaveRowData(row); if (shRet == SystemData.ReturnValue.OK) { count++; } else if (shRet == SystemData.ReturnValue.FAILED) { break; } if (!bIsDeletedRow) { index++; } } this.UpdateUIState(); GlobalMethods.UI.SetCursor(this, Cursors.Default); string szMessageText = null; if (shRet == SystemData.ReturnValue.FAILED) { szMessageText = string.Format("保存中止,已保存{0}条记录!", count); MessageBoxEx.Show(szMessageText, MessageBoxIcon.Information); } else { szMessageText = string.Format("保存成功,已保存{0}条记录!", count); } shRet = SystemData.ReturnValue.OK; foreach (DataGridViewRow item in this.dataGridView1.Rows) { HdpUIConfig hdpUIConfig = item.Tag as HdpUIConfig; hdpUIConfig.SortIndex = item.Index; shRet = HdpUIConfigAccess.Instance.ModifySortIndex(hdpUIConfig); } return(shRet == SystemData.ReturnValue.OK); }
/// <summary> /// 管理平台,保存一条界面配置信息 /// </summary> /// <param name="HdpUIConfig">界面配置信息</param> /// <returns>SystemData.ReturnValue</returns> public short SaveHdpUIConfig(HdpUIConfig hdpUIConfig) { string szField = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}" , SystemData.HdpUIConfigTable.MICRO_HELP , SystemData.HdpUIConfigTable.PARENT_ID , SystemData.HdpUIConfigTable.POPMENU_RESOURCE , SystemData.HdpUIConfigTable.PRODUCT , SystemData.HdpUIConfigTable.SHORTCUTS , SystemData.HdpUIConfigTable.SHOW_NAME , SystemData.HdpUIConfigTable.SHOW_TYPE , SystemData.HdpUIConfigTable.SORT_INDEX , SystemData.HdpUIConfigTable.UI_COMMAND , SystemData.HdpUIConfigTable.UI_GRADE , SystemData.HdpUIConfigTable.UI_ICON , SystemData.HdpUIConfigTable.UI_ICON_SIZE , SystemData.HdpUIConfigTable.UI_RIGHT_DESC , SystemData.HdpUIConfigTable.UI_RIGHT_KEY , SystemData.HdpUIConfigTable.UI_TYPE , SystemData.HdpUIConfigTable.UI_CONFIG_ID); string szValue = string.Format("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}'" , hdpUIConfig.MicroHelp , hdpUIConfig.ParentID , hdpUIConfig.PopMenuResource , hdpUIConfig.Product , hdpUIConfig.ShortCuts , hdpUIConfig.ShowName , hdpUIConfig.ShowType , hdpUIConfig.SortIndex , hdpUIConfig.UICommand , hdpUIConfig.UIGrade , hdpUIConfig.UIIcon , hdpUIConfig.UIIconSize , hdpUIConfig.UIRightDesc , hdpUIConfig.UIRightKey , hdpUIConfig.UIType , hdpUIConfig.UIConfigID ); string szSQL = string.Format(SystemData.SQL.INSERT, SystemData.DataTable.HDP_UICONFIG_T, szField, szValue); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("HDPDBAccess.SaveHdpUIConfig", new string[] { "SQL" }, new object[] { szSQL }, "SQL执行失败!", ex); return(SystemData.ReturnValue.EXCEPTION); } return(nCount > 0 ? SystemData.ReturnValue.OK : SystemData.ReturnValue.EXCEPTION); }
private void toolbtn_Click(object sender, System.EventArgs e) { ToolStripItem toolbtn = sender as ToolStripItem; if (toolbtn == null) { return; } HdpUIConfig hdp = this.m_dicHdpUIConfig[toolbtn.Name]; if (hdp.UICommand == string.Empty) { return; } CommandHandler.Instance.SendCommand(hdp.UICommand, this.m_mainForm, toolbtn); }
/// <summary> /// 管理平台,修改一条产品信息 /// </summary> /// <param name="hdpUIConfig">产品信息</param> /// <param name="szOldNameShort">旧的产品缩写</param> /// <returns>SystemData.ReturnValue</returns> public short ModifyHdpUIConfig(HdpUIConfig hdpUIConfig) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } string szField = string.Format("{0}='{1}',{2}='{3}',{4}='{5}',{6}='{7}',{8}='{9}',{10}='{11}',{12}='{13}',{14}='{15}',{16}='{17}',{18}='{19}',{20}='{21}',{22}='{23}',{24}='{25}',{26}='{27}',{28}='{29}'" , SystemData.HdpUIConfigTable.MICRO_HELP, hdpUIConfig.MicroHelp , SystemData.HdpUIConfigTable.PARENT_ID, hdpUIConfig.ParentID , SystemData.HdpUIConfigTable.POPMENU_RESOURCE, hdpUIConfig.PopMenuResource , SystemData.HdpUIConfigTable.PRODUCT, hdpUIConfig.Product , SystemData.HdpUIConfigTable.SHORTCUTS, hdpUIConfig.ShortCuts , SystemData.HdpUIConfigTable.SHOW_NAME, hdpUIConfig.ShowName , SystemData.HdpUIConfigTable.SHOW_TYPE, hdpUIConfig.ShowType , SystemData.HdpUIConfigTable.SORT_INDEX, hdpUIConfig.SortIndex , SystemData.HdpUIConfigTable.UI_COMMAND, hdpUIConfig.UICommand , SystemData.HdpUIConfigTable.UI_GRADE, hdpUIConfig.UIGrade , SystemData.HdpUIConfigTable.UI_ICON, hdpUIConfig.UIIcon , SystemData.HdpUIConfigTable.UI_ICON_SIZE, hdpUIConfig.UIIconSize , SystemData.HdpUIConfigTable.UI_RIGHT_DESC, hdpUIConfig.UIRightDesc , SystemData.HdpUIConfigTable.UI_RIGHT_KEY, hdpUIConfig.UIRightKey , SystemData.HdpUIConfigTable.UI_TYPE, hdpUIConfig.UIType ); string szCondition = string.Format("{0}='{1}'" , SystemData.HdpUIConfigTable.UI_CONFIG_ID, hdpUIConfig.UIConfigID); string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.HDP_UICONFIG_T, szField, szCondition); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("HDPDBAccess.ModifyHdpProduct", new string[] { "SQL" }, new object[] { szSQL }, "SQL执行失败!", ex); return(SystemData.ReturnValue.EXCEPTION); } return(nCount > 0 ? SystemData.ReturnValue.OK : SystemData.ReturnValue.EXCEPTION); }
/// <summary> /// 装载病案质量问题分类信息 /// </summary> private void LoadHdpUIConfigList() { this.dataGridView1.Rows.Clear(); if (this.toolcboProduct.SelectedItem == null) { return; } string szProduct = (this.toolcboProduct.SelectedItem as HdpProduct).NAME_SHORT; List <HdpUIConfig> lstHdpUIConfigs = null; string szUIType = SystemData.UIType.MENU; string szPopMenuResource = string.Empty; szUIType = SystemData.UIType.MENU; if (szPopMenuResource == string.Empty && szUIType == SystemData.UIType.POPMENU) { return; } short shRet = HdpUIConfigAccess.Instance.GetHdpUIConfigList(szProduct, szUIType, szPopMenuResource, ref lstHdpUIConfigs); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取产品信息失败!"); return; } if (lstHdpUIConfigs == null || lstHdpUIConfigs.Count <= 0) { return; } for (int index = 0; index < lstHdpUIConfigs.Count; index++) { HdpUIConfig hdpUIConfig = lstHdpUIConfigs[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; row.Tag = hdpUIConfig; //将记录信息保存到该行 this.SetRowData(row, hdpUIConfig); this.dataGridView1.SetRowState(row, RowState.Normal); } }
/// <summary> /// 增加一行记录 /// </summary> private void AddNewItem() { try { //int index = 0; //if (this.dataGridView1.SelectedRows.Count > 0) // index = this.dataGridView1.SelectedRows[0].Index + 1; ////创建数据 //HdpUIConfig hdpUIConfig = new HdpUIConfig(); ////创建行 ////int index = this.dataGridView1.Rows.Add(); //DataTableViewRow row = new DataTableViewRow(); //this.dataGridView1.Rows.Insert(index, row); ////DataTableViewRow row = this.dataGridView1.Rows[index]; //hdpUIConfig.UIConfigID = hdpUIConfig.MakeUIConfigID(); //row.Tag = hdpUIConfig; //row.State = RowState.New; ////this.dataGridView1.SetRowState(row, RowState.New); //this.UpdateUIState(); ////this.dataGridView1.CurrentCell = row.Cells[this.colShowName.Index]; //this.dataGridView1.BeginEdit(true); HdpUIConfig hdpUIConfig = null; DataTableViewRow currRow = this.dataGridView1.CurrentRow; if (currRow != null && currRow.Index >= 0) { hdpUIConfig = currRow.Tag as HdpUIConfig; } if (hdpUIConfig == null) { hdpUIConfig = new HdpUIConfig(); } else { hdpUIConfig = hdpUIConfig.Clone() as HdpUIConfig; } hdpUIConfig.UIConfigID = hdpUIConfig.MakeUIConfigID(); int nRowIndex = 0; if (currRow != null) { nRowIndex = currRow.Index + 1; DataTableViewRow dataTableViewRow = new DataTableViewRow(); this.dataGridView1.Rows.Insert(nRowIndex, dataTableViewRow); } else { nRowIndex = this.dataGridView1.Rows.Add(); } DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, hdpUIConfig); this.dataGridView1.Focus(); this.dataGridView1.SelectRow(row); this.dataGridView1.SetRowState(row, RowState.New); this.dataGridView1.CurrentCell = row.Cells[this.colShowName.Index]; this.dataGridView1.BeginEdit(true); } catch (Exception ex) { MessageBoxEx.ShowError("新增操作失败", ex.ToString()); LogManager.Instance.WriteLog(ex.ToString()); } }
/// <summary> /// 保存指定行的数据到远程数据表,需要注意的是:行的删除状态会与其他状态共存 /// </summary> /// <param name="row">指定行</param> /// <returns>SystemData.ReturnValue</returns> private short SaveRowData(DataTableViewRow row) { if (row == null || row.Index < 0) { return(SystemData.ReturnValue.FAILED); } if (this.dataGridView1.IsNormalRow(row) || this.dataGridView1.IsUnknownRow(row)) { if (!this.dataGridView1.IsDeletedRow(row)) { return(SystemData.ReturnValue.CANCEL); } } HdpUIConfig hdpUIConfig = row.Tag as HdpUIConfig; if (hdpUIConfig == null) { return(SystemData.ReturnValue.FAILED); } string szUIConfigID = hdpUIConfig.UIConfigID; hdpUIConfig = null; if (!this.MakeRowData(row, ref hdpUIConfig)) { return(SystemData.ReturnValue.FAILED); } short shRet = SystemData.ReturnValue.OK; if (this.dataGridView1.IsDeletedRow(row)) { if (!this.dataGridView1.IsNewRow(row)) { shRet = HdpUIConfigAccess.Instance.DeleteHdpUIConfig(szUIConfigID); } if (shRet != SystemData.ReturnValue.OK) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("无法删除当前记录!"); return(SystemData.ReturnValue.FAILED); } this.dataGridView1.Rows.Remove(row); } else if (this.dataGridView1.IsModifiedRow(row)) { shRet = HdpUIConfigAccess.Instance.ModifyHdpUIConfig(hdpUIConfig); if (shRet != SystemData.ReturnValue.OK) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("无法更新当前记录!"); return(SystemData.ReturnValue.FAILED); } row.Tag = hdpUIConfig; this.dataGridView1.SetRowState(row, RowState.Normal); } else if (this.dataGridView1.IsNewRow(row)) { shRet = HdpUIConfigAccess.Instance.SaveHdpUIConfig(hdpUIConfig); if (shRet != SystemData.ReturnValue.OK) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("无法保存当前记录!"); return(SystemData.ReturnValue.FAILED); } row.Tag = hdpUIConfig; this.dataGridView1.SetRowState(row, RowState.Normal); } return(SystemData.ReturnValue.OK); }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="hdpUIConfig">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref HdpUIConfig hdpUIConfig) { if (row == null || row.Index < 0) { return(false); } hdpUIConfig = new HdpUIConfig(); HdpUIConfig oldHdpUIConfig = row.Tag as HdpUIConfig; if (!this.dataGridView1.IsNewRow(row)) { if (oldHdpUIConfig == null) { MessageBoxEx.Show("质量问题分类字典行数据信息为空!"); return(false); } } if (this.dataGridView1.IsDeletedRow(row)) { hdpUIConfig = oldHdpUIConfig; return(true); } if (this.toolcboProduct.SelectedItem == null || this.toolcboProduct.Text == string.Empty) { MessageBoxEx.Show("您必须选择产品!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colShowName.Index].Value)) { this.dataGridView1.CurrentCell = row.Cells[this.colShowName.Index]; this.dataGridView1.BeginEdit(true); MessageBoxEx.Show("您必须设置菜单显示名称!"); return(false); } if (hdpUIConfig == null) { hdpUIConfig = new HdpUIConfig(); } hdpUIConfig.UIConfigID = oldHdpUIConfig.UIConfigID; hdpUIConfig.Product = (this.toolcboProduct.SelectedItem as HdpProduct).NAME_SHORT; hdpUIConfig.ShowName = row.Cells[this.colShowName.Index].Value.ToString().Trim(); if (row.Cells[this.colShortCuts.Index].Value != null) { hdpUIConfig.ShortCuts = (string)row.Cells[this.colShortCuts.Index].Value; } if (row.Cells[this.colRightKey.Index].Value != null) { hdpUIConfig.UIRightKey = (string)row.Cells[this.colRightKey.Index].Value; } if (row.Cells[this.colRightDesc.Index].Value != null) { hdpUIConfig.UIRightDesc = (string)row.Cells[this.colRightDesc.Index].Value; } if (row.Cells[this.colUICommand.Index].Value != null) { hdpUIConfig.UICommand = (string)row.Cells[this.colUICommand.Index].Value; } else { hdpUIConfig.UICommand = string.Empty; } if (row.Cells[this.colUIIcon.Index].Value != null) { hdpUIConfig.UIIcon = (string)row.Cells[this.colUIIcon.Index].Value; } if (row.Cells[this.colUIIconSize.Index].Value != null) { hdpUIConfig.UIIconSize = (string)row.Cells[this.colUIIconSize.Index].Value; } if (row.Cells[this.colMicroHelp.Index].Value != null) { hdpUIConfig.MicroHelp = (string)row.Cells[this.colMicroHelp.Index].Value; } hdpUIConfig.SortIndex = row.Index; hdpUIConfig.UIGrade = oldHdpUIConfig.UIGrade; if (this.toolbtnMenu.Checked) { hdpUIConfig.UIType = SystemData.UIType.MENU; } //向上一行找父级菜单 for (int index = row.Index; index >= 0; index--) { if (index <= 0) { break; } HdpUIConfig preHdpUIConfig = this.dataGridView1.Rows[index - 1].Tag as HdpUIConfig; if (preHdpUIConfig.UIGrade < hdpUIConfig.UIGrade) { hdpUIConfig.ParentID = preHdpUIConfig.UIConfigID; break; } } return(true); }
/// <summary> /// 管理平台,获取界面配置管理列表 /// </summary> /// <param name="szProduct">产品缩写</param> /// <param name="szUIType">元件类型</param> /// <param name="lstHdpOperationType">操作类型信息列表</param> /// <returns>SystemData.ReturnValue</returns> public short GetHdpUIConfigList(string szProduct, string szUIType, string szPopMenuResource, ref List <HdpUIConfig> lstHdpUIConfig) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } string szField = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15}" , SystemData.HdpUIConfigTable.UI_CONFIG_ID , SystemData.HdpUIConfigTable.SHOW_NAME , SystemData.HdpUIConfigTable.PRODUCT , SystemData.HdpUIConfigTable.SHORTCUTS , SystemData.HdpUIConfigTable.SHOW_TYPE , SystemData.HdpUIConfigTable.UI_ICON , SystemData.HdpUIConfigTable.UI_ICON_SIZE , SystemData.HdpUIConfigTable.UI_RIGHT_KEY , SystemData.HdpUIConfigTable.UI_RIGHT_DESC , SystemData.HdpUIConfigTable.UI_COMMAND , SystemData.HdpUIConfigTable.MICRO_HELP , SystemData.HdpUIConfigTable.UI_TYPE , SystemData.HdpUIConfigTable.PARENT_ID , SystemData.HdpUIConfigTable.SORT_INDEX , SystemData.HdpUIConfigTable.UI_GRADE , SystemData.HdpUIConfigTable.POPMENU_RESOURCE ); string szCondition = string.Format(" 1=1 and {0}='{1}' and {2}='{3}'" , SystemData.HdpUIConfigTable.PRODUCT, szProduct , SystemData.HdpUIConfigTable.UI_TYPE, szUIType); if (!string.IsNullOrEmpty(szPopMenuResource)) { szCondition = string.Format("{0} and {1}='{2}'" , szCondition , SystemData.HdpUIConfigTable.POPMENU_RESOURCE, szPopMenuResource); } string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC, szField , SystemData.DataTable.HDP_UICONFIG_T , szCondition , SystemData.HdpUIConfigTable.SORT_INDEX); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (lstHdpUIConfig == null) { lstHdpUIConfig = new List <HdpUIConfig>(); } do { HdpUIConfig hdpUIConfig = new HdpUIConfig(); if (!dataReader.IsDBNull(0)) { hdpUIConfig.UIConfigID = dataReader.GetValue(0).ToString(); } if (!dataReader.IsDBNull(1)) { hdpUIConfig.ShowName = dataReader.GetString(1); } if (!dataReader.IsDBNull(2)) { hdpUIConfig.Product = dataReader.GetString(2); } if (!dataReader.IsDBNull(3)) { hdpUIConfig.ShortCuts = dataReader.GetString(3); } if (!dataReader.IsDBNull(4)) { hdpUIConfig.ShowType = dataReader.GetString(4); } if (!dataReader.IsDBNull(5)) { hdpUIConfig.UIIcon = dataReader.GetString(5); } if (!dataReader.IsDBNull(6)) { hdpUIConfig.UIIconSize = dataReader.GetString(6); } if (!dataReader.IsDBNull(7)) { hdpUIConfig.UIRightKey = dataReader.GetString(7); } if (!dataReader.IsDBNull(8)) { hdpUIConfig.UIRightDesc = dataReader.GetString(8); } if (!dataReader.IsDBNull(9)) { hdpUIConfig.UICommand = dataReader.GetString(9); } if (!dataReader.IsDBNull(10)) { hdpUIConfig.MicroHelp = dataReader.GetString(10); } if (!dataReader.IsDBNull(11)) { hdpUIConfig.UIType = dataReader.GetString(11); } if (!dataReader.IsDBNull(12)) { hdpUIConfig.ParentID = dataReader.GetString(12); } if (!dataReader.IsDBNull(13)) { hdpUIConfig.SortIndex = int.Parse(dataReader.GetValue(13).ToString()); } if (!dataReader.IsDBNull(14)) { hdpUIConfig.UIGrade = int.Parse(dataReader.GetValue(14).ToString()); } if (!dataReader.IsDBNull(15)) { hdpUIConfig.PopMenuResource = dataReader.GetString(15); } lstHdpUIConfig.Add(hdpUIConfig); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("HDPDBAccess.GetHdpUIConfigList", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); dataReader = null; } base.MedQCAccess.CloseConnnection(false); } }
public void RefreshUIConfig() { if (lstHdpUIConfig == null) { lstHdpUIConfig = new List <HdpUIConfig>(); } lstHdpUIConfig.Clear(); string szProductShortName = DataCache.Instance.HdpProduct.NAME_SHORT; if (string.IsNullOrEmpty(szProductShortName)) { szProductShortName = RightResource.PRODUCT_MEDQC; } short shRet = HdpUIConfigAccess.Instance.GetHdpUIConfigList(szProductShortName, SystemData.UIType.MENU, string.Empty, ref lstHdpUIConfig); this.Items.Clear(); this.InitializeComponent(); this.m_IsHideFuncTool = SystemConfig.Instance.Get(SystemData.ConfigKey.SHOW_TOOL_STRIP, false); this.m_dicHdpUIConfig.Clear(); foreach (HdpUIConfig item in lstHdpUIConfig) { if (!this.m_dicHdpUIConfig.ContainsKey(item.UIConfigID)) { this.m_dicHdpUIConfig.Add(item.UIConfigID, item); } } foreach (HdpUIConfig item in lstHdpUIConfig) { //跳过没权限的菜单 //if (!RightHandler.Instance.HasRight(item.UIRightKey)) continue; //显示根菜单 if (string.IsNullOrEmpty(item.ParentID)) { MqsMenuItemBase toolbtn = null; //检查是否有子菜单 toolbtn = new MqsMenuItemBase(); if (this.CheckIsParent(item.UIConfigID)) { ToolStripRecursion(toolbtn, item.UIConfigID); } toolbtn.Text = item.ShowName; toolbtn.Name = item.UIConfigID; if (item.ShortCuts.Contains("ALt+")) { toolbtn.Text += string.Format("(&{0})", item.ShortCuts.Replace("ALt+", "")); } if (string.IsNullOrEmpty(item.UIIcon)) { toolbtn.DisplayStyle = SystemData.UIDisplayStyle.GetDisplayStyle(SystemData.UIDisplayStyle.TEXT); } else { toolbtn.DisplayStyle = SystemData.UIDisplayStyle.GetDisplayStyle(SystemData.UIDisplayStyle.TEXT_IMAGE); } toolbtn.TextImageRelation = TextImageRelation.ImageAboveText; toolbtn.Click += new EventHandler(toolbtn_Click); toolbtn.AutoSize = true; if (!RightHandler.Instance.HasRight(item.UIRightKey)) { toolbtn.Enabled = false; } this.Items.Add(toolbtn); } } #if DEBUG // 增加调试快捷入口 MqsMenuItemBase menu = new MqsMenuItemBase(); menu.Click += new EventHandler(toolbtn_Click); menu.Text = "快捷入口"; menu.Name = "快捷入口"; HdpUIConfig hdpUIConfig = new HdpUIConfig() { UICommand = "快捷入口", UIConfigID = "111" }; if (!this.m_dicHdpUIConfig.ContainsKey("快捷入口")) { this.m_dicHdpUIConfig.Add("快捷入口", hdpUIConfig); } this.Items.Add(menu); #endif menuCommon = new MqsMenuItemBase[this.Items.Count]; for (int i = 0; i < menuCommon.Length; i++) { menuCommon[i] = (MqsMenuItemBase)this.Items[i]; } this.Show(); }