private void InitApplyHISDB() { DataTable dt; try { //查找对应的HIS数据库配置 if (_hisServerModel == null) { _hisServerModel = new HisServerModel(_dbQuery); } dt = _hisServerModel.GetAllHisServer(); //现在版本,先支持一个HIS库,下次迭代修改,再增加同时连接多个HIS库的方式 HisServerCfgData cfgData = new HisServerCfgData(); cfgData.BindRowData(dt.Rows[0]); ApplyEnum _ae = new ApplyEnum(); _applyHISDB = _ae.CreateInstance(cfgData.务配置.HIS接口名称) as IApply; _applyHISDB.ConfigString = cfgData.务配置.接口配置.ToString(); _applyHISDB.UserName = _userData.Name; _applyHISDB.Init(_dbQuery); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void butModify_Click(object sender, EventArgs e) { try { if (textAlias.Tag == null) { MessageBox.Show("请选择需要修改的配置项目。", "提示"); return; } HisServerCfgData cfgData = GetSelectServerCfgData(); if (cfgData == null) { MessageBox.Show("未获取到有效的配置数据。", "提示"); return; } if (Verify(true) == false) { return; } cfgData.务名称 = textAlias.Text; cfgData.务配置.HIS接口名称 = cbxInterfaceName.Text; cfgData.务配置.HIS接口文件 = txtAssemblyFile.Text; cfgData.务配置.是否停用 = chkStopUse.Checked; if (cbxInterfaceName.Tag != null) { cfgData.务配置.接口配置 = cbxInterfaceName.Tag.ToString(); } cfgData.务配置.CopyBasePro(cfgData); _hsm.UpdateHisServerCfg(cfgData); DataRow dr = cfgData.GetBindRow(); dr["服务名称"] = textAlias.Text; dr["服务配置"] = cfgData.务配置.ToString(); ButtonHint.Start(sender as Button, "OK"); } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void SyncSelRowData() { try { if (_isBinding) { return; } ClearData(); if (dataGridView1.DataSource == null) { return; } if (dataGridView1.SelectedRows.Count <= 0) { return; } DataGridViewRow dvr = dataGridView1.SelectedRows[0]; string serverID = dvr.Cells["HIS服务ID"].Value.ToString(); DataRow[] drs = (dataGridView1.DataSource as DataTable).Select("HIS服务ID='" + serverID + "'"); if (drs.Length > 0) { HisServerCfgData cfgData = new HisServerCfgData(); cfgData.BindRowData(drs[0]); textAlias.Text = cfgData.务名称; textAlias.Tag = cfgData.HIS服务ID; if (cfgData.务配置 != null) { cbxInterfaceName.Text = cfgData.务配置.HIS接口名称; cbxInterfaceName.Tag = cfgData.务配置.接口配置; txtAssemblyFile.Text = cfgData.务配置.HIS接口文件; chkStopUse.Checked = cfgData.务配置.是否停用; } } } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void butNew_Click(object sender, EventArgs e) { try { if (Verify() == false) { return; } HisServerCfgData cfgData = new HisServerCfgData(); cfgData.HIS服务ID = SqlHelper.GetCmpUID(); cfgData.务名称 = textAlias.Text; cfgData.务配置.HIS接口名称 = cbxInterfaceName.Text; cfgData.务配置.HIS接口文件 = txtAssemblyFile.Text; cfgData.务配置.是否停用 = chkStopUse.Checked; //如果接口信息未进行配置,cbxInterfaceName.Tag的返回值未null,.toString()时会提示错误,需要单独处理 if (cbxInterfaceName.Tag == null) { cfgData.务配置.接口配置 = ""; } else { cfgData.务配置.接口配置 = cbxInterfaceName.Tag.ToString(); } cfgData.务配置.CopyBasePro(cfgData); _hsm.NewHisServerCfg(cfgData); DataTable dtBind = dataGridView1.DataSource as DataTable; DataRow drNew = dtBind.NewRow(); drNew["HIS服务ID"] = cfgData.HIS服务ID; drNew["服务名称"] = cfgData.务名称; drNew["服务配置"] = cfgData.务配置.ToString(); dtBind.Rows.Add(drNew); ButtonHint.Start(sender as Button, "OK"); //添加数据后,焦点定位到最后一行(选中新增的行) dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true; } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
private void butVerfiyCfg_Click(object sender, EventArgs e) { try { //必须要选选择接口名称,才能对接口进行配置 if (string.IsNullOrEmpty(cbxInterfaceName.Text)) { MessageBox.Show("请先选择HIS接口名称,再进行接口配置。", "提示"); cbxInterfaceName.Focus(); return; } IApply applyInstance = _ae.CreateInstance(cbxInterfaceName.Text) as IApply; if (applyInstance == null) { MessageBox.Show("实例化失败,不能进行配置。", "提示"); return; } if (cbxInterfaceName.Tag != null) { applyInstance.ConfigString = cbxInterfaceName.Tag.ToString(); } if (applyInstance.ShowCfg(this)) { cbxInterfaceName.Tag = applyInstance.ConfigString; if (textAlias.Tag != null) { HisServerCfgData cfgData = GetSelectServerCfgData(); cfgData.务配置.接口配置 = cbxInterfaceName.Tag.ToString(); _hsm.UpdateHisServerCfg(cfgData); DataRow dr = cfgData.GetBindRow(); dr["服务配置"] = cfgData.务配置.ToString(); } } } catch (Exception ex) { MsgBox.ShowException(ex, this); } }
public HisServerCfgData GetSelectServerCfgData() { if (dataGridView1.SelectedRows.Count <= 0) { return(null); } DataGridViewRow dvr = dataGridView1.SelectedRows[0]; string serverID = dvr.Cells["HIS服务ID"].Value.ToString(); DataRow[] drs = (dataGridView1.DataSource as DataTable).Select("HIS服务ID='" + serverID + "'"); if (drs.Length > 0) { HisServerCfgData cfgData = new HisServerCfgData(); cfgData.BindRowData(drs[0]); return(cfgData); } return(null); }