/// <summary> /// 显示查询条件设置对话框 /// </summary> /// <param name="row">指定行</param> private void ShowConditionSettingForm(DataTableViewRow row) { if (row == null || row.Index < 0 || this.dataGridView1.IsDeletedRow(row)) { return; } SqlConditionForm frmSqlCondition = new SqlConditionForm(); frmSqlCondition.Properties.Add("事件查询信息", typeof(TimeCheckQuery)); DataGridViewCell cell = row.Cells[this.colCondition.Index]; if (cell.Value != null) { frmSqlCondition.SqlCondition = cell.Value.ToString(); } if (frmSqlCondition.ShowDialog() != DialogResult.OK) { return; } if (frmSqlCondition.SqlCondition.Equals(cell.Value)) { return; } cell.Value = frmSqlCondition.SqlCondition; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="configInfo">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref TimeQCEvent timeQCEvent) { if (row == null || row.Index < 0) { return(false); } timeQCEvent = new TimeQCEvent(); object cellValue = row.Cells[this.colEventID.Index].Value; if (cellValue != null) { timeQCEvent.EventID = cellValue.ToString(); } if (this.dataGridView1.IsDeletedRow(row)) { return(true); } cellValue = row.Cells[this.colEventName.Index].Value; if (cellValue == null || cellValue.ToString().Trim() == string.Empty) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("您必须输入事件名称!"); return(false); } timeQCEvent.EventName = cellValue.ToString(); cellValue = row.Cells[this.colSqlText.Index].Value; if (cellValue == null || cellValue.ToString().Trim() == string.Empty) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("您必须输入事件数据来源SQL!"); return(false); } timeQCEvent.SqlText = cellValue.ToString(); cellValue = row.Cells[this.colCondition.Index].Value; if (cellValue == null || cellValue.ToString().Trim() == string.Empty) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("您必须输入事件数据来源SQL条件!"); return(false); } timeQCEvent.SqlCondition = cellValue.ToString(); cellValue = row.Cells[this.colDependEvent.Index].Tag; if (cellValue != null) { timeQCEvent.DependEvent = cellValue.ToString(); } cellValue = row.Cells[this.colDependEvent.Index].Value; if (cellValue != null) { timeQCEvent.DependEventName = cellValue.ToString(); } return(true); }
private void btnAdd_Click(object sender, EventArgs e) { TimeQCEvent timeQCEvent = null; DataTableViewRow currRow = this.dataGridView1.CurrentRow; if (currRow != null && currRow.Index >= 0) { timeQCEvent = currRow.Tag as TimeQCEvent; } if (timeQCEvent == null) { timeQCEvent = new TimeQCEvent(); } else { timeQCEvent = timeQCEvent.Clone() as TimeQCEvent; } timeQCEvent.EventID = timeQCEvent.MakeEventID(); int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, timeQCEvent); this.dataGridView1.Focus(); this.dataGridView1.SelectRow(row); this.dataGridView1.SetRowState(row, RowState.New); }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="hdpRole">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref HdpRole hdpRole) { if (row == null || row.Index < 0) { return(false); } hdpRole = new HdpRole(); HdpRole oldHdpRole = row.Tag as HdpRole; if (!this.dgvRoleList.IsNewRow(row)) { if (oldHdpRole == null) { MessageBoxEx.Show("质量问题分类字典行数据信息为空!"); return(false); } } if (this.dgvRoleList.IsDeletedRow(row)) { hdpRole = oldHdpRole; return(true); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colSerialNO.Index].Value)) { this.dgvRoleList.CurrentCell = row.Cells[this.colSerialNO.Index]; this.dgvRoleList.BeginEdit(true); MessageBoxEx.Show("您必须设置序号!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colRoleName.Index].Value)) { this.dgvRoleList.CurrentCell = row.Cells[this.colRoleName.Index]; this.dgvRoleList.BeginEdit(true); MessageBoxEx.Show("您必须设置角色名称!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colRoleCode.Index].Value)) { this.dgvRoleList.CurrentCell = row.Cells[this.colRoleCode.Index]; this.dgvRoleList.BeginEdit(true); MessageBoxEx.Show("您必须设置角色代码!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colStatus.Index].Value)) { MessageBoxEx.Show("您必须设置状态!"); return(false); } if (hdpRole == null) { hdpRole = new HdpRole(); } hdpRole.SerialNo = (string)row.Cells[this.colSerialNO.Index].Value; hdpRole.RoleName = (string)row.Cells[this.colRoleName.Index].Value; hdpRole.RoleCode = (string)row.Cells[this.colRoleCode.Index].Value; hdpRole.Status = (string)row.Cells[this.colStatus.Index].Value == "开启"?"1":"0"; hdpRole.RoleBak = row.Cells[this.colRoleBak.Index].Value == null ? "" : (string)row.Cells[this.colRoleBak.Index].Value; return(true); }
private void ShowQuestionTypeForm(DataTableViewRow row) { if (row == null || row.Index < 0 || this.dataGridView1.IsDeletedRow(row)) { return; } QuestionTypeForm frmQuestionType = new QuestionTypeForm(); frmQuestionType.Text = "选择缺陷点和分类"; DataGridViewCell cell = row.Cells[this.colCheckPointContent.Index]; QcCheckPoint qcCheckPoint = row.Tag as QcCheckPoint; if (frmQuestionType.ShowDialog() != DialogResult.OK) { return; } qcCheckPoint.MsgDictCode = frmQuestionType.QcMsgCode; qcCheckPoint.MsgDictMessage = frmQuestionType.Message; qcCheckPoint.QaEventType = frmQuestionType.QaEventType; qcCheckPoint.Score = frmQuestionType.Score != null?float.Parse(frmQuestionType.Score) : 0; row.Cells[this.colMsgDictMessage.Index].Value = qcCheckPoint.MsgDictMessage; row.Cells[this.colQaEventType.Index].Value = qcCheckPoint.QaEventType; row.Cells[this.colQCScore.Index].Value = qcCheckPoint.Score; row.Tag = qcCheckPoint; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }
/// <summary> /// 装载病案质量问题分类信息 /// </summary> private void LoadHdpProductList() { this.dgvProductList.Rows.Clear(); List <HdpProduct> lstHdpProducts = null; short shRet = HdpProductAccess.Instance.GetHdpProductList(ref lstHdpProducts); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstHdpProducts == null || lstHdpProducts.Count <= 0) { return; } for (int index = 0; index < lstHdpProducts.Count; index++) { HdpProduct hdpProduct = lstHdpProducts[index]; int nRowIndex = this.dgvProductList.Rows.Add(); DataTableViewRow row = this.dgvProductList.Rows[nRowIndex]; row.Tag = hdpProduct; //将记录信息保存到该行 this.SetRowData(row, hdpProduct); this.dgvProductList.SetRowState(row, RowState.Normal); } }
private void mnuCancelModify_Click(object sender, EventArgs e) { int nCount = this.dataGridView1.SelectedCells.Count; if (nCount <= 0) { return; } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); for (int index = 0; index < nCount; index++) { DataGridViewCell cell = this.dataGridView1.SelectedCells[index]; DataTableViewRow row = this.dataGridView1.Rows[cell.RowIndex]; if (this.dataGridView1.IsNormalRow(row)) { continue; } if (this.dataGridView1.IsNewRow(row)) { continue; } this.SetRowData(row, row.Tag as UserRightBase); this.dataGridView1.SetRowState(row, RowState.Normal); } GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <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); } } UserRightBase userRight = null; if (!this.MakeRowData(row, ref userRight)) { return(SystemData.ReturnValue.FAILED); } short shRet = SystemData.ReturnValue.OK; return(SystemData.ReturnValue.OK); }
private void CellTextBox_TextChanged(object sender, EventArgs e) { TextBox cellTextBox = sender as TextBox; if (cellTextBox == null || cellTextBox.IsDisposed) { return; } if (!cellTextBox.Visible) { return; } DataGridViewCell cell = this.dataGridView1.CurrentCell; if (cell == null || cell.ColumnIndex != this.colScriptValue.Index) { return; } DataTableViewRow row = this.dataGridView1.Rows[cell.RowIndex]; if (row.Cells[this.colElementName.Index].Value == null) { return; } this.TestScript(row.Cells[this.colElementName.Index].Value.ToString()); }
private bool SetElementValue(string szElementName, string szElementValue) { if (this.dataGridView1.Rows.Count <= 0) { return(false); } for (int index = 0; index < this.dataGridView1.Rows.Count; index++) { DataTableViewRow row = this.dataGridView1.Rows[index]; if (row == null) { continue; } if (row.Cells[this.colElementName.Index].Value == null) { continue; } string szName = row.Cells[this.colElementName.Index].Value.ToString(); if (szName != szElementName) { continue; } row.Cells[this.colScriptValue.Index].Value = szElementValue; break; } return(true); }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } DataTableViewRow row = this.dataGridView1.Rows[e.RowIndex]; if (this.dataGridView1.IsDeletedRow(row)) { return; } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); if (e.ColumnIndex == this.colEvent.Index) { this.ShowTimeEventSelectForm(); } else if (e.ColumnIndex == this.colDocType.Index) { this.ShowDocTypeSelectForm(row); } else if (e.ColumnIndex == this.colRuleDesc.Index) { this.ShowRuleDescEditForm(row); } else if (e.ColumnIndex == this.colWrittenPeriod.Index) { this.ShowTimeLineEditForm(row.Cells[this.colWrittenPeriod.Index]); } GlobalMethods.UI.SetCursor(this, Cursors.Default); }
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> private void LoadHdpRoleGrantList() { this.dataGridView1.Rows.Clear(); if (this.toolcboProduct.SelectedItem == null) { return; } string szProduct = (this.toolcboProduct.SelectedItem as HdpProduct).NAME_SHORT; List <HdpRoleGrant> lstHdpRoleGrant = null; short shRet = HdpRoleGrantAccess.Instance.GetHdpRoleGrantList(this.m_roleInfo.RoleCode, szProduct, ref lstHdpRoleGrant); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstHdpRoleGrant == null || lstHdpRoleGrant.Count <= 0) { return; } for (int index = 0; index < lstHdpRoleGrant.Count; index++) { HdpRoleGrant hdpRoleGrant = lstHdpRoleGrant[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; row.Tag = hdpRoleGrant; //将记录信息保存到该行 this.SetRowData(row, hdpRoleGrant); this.dataGridView1.SetRowState(row, RowState.Normal); } }
/// <summary> /// 增加一行记录 /// </summary> private void AddNewItem() { //创建数据 HdpProduct qcEventInfo = new HdpProduct(); //创建行 int maxNo = 0; foreach (DataTableViewRow oneRow in dgvProductList.Rows) { string szSerialNO = oneRow.Cells[this.colSerialNO.Index].Value.ToString(); if (!string.IsNullOrEmpty(szSerialNO) && maxNo < int.Parse(szSerialNO)) { maxNo = int.Parse(szSerialNO); } } int index = this.dgvProductList.Rows.Add(); DataTableViewRow row = this.dgvProductList.Rows[index]; row.Cells[this.colSerialNO.Index].Value = maxNo + 1; row.Tag = qcEventInfo; this.dgvProductList.SetRowState(row, RowState.New); this.UpdateUIState(); this.dgvProductList.CurrentCell = row.Cells[this.colNameShort.Index]; this.dgvProductList.BeginEdit(true); }
private void LoadParameterList() { this.dataGridView1.Rows.Clear(); List <HdpParameter> lstHdpParameter = null; short shRet = HdpParameterAccess.Instance.GetHdpParameters(null, null, null, ref lstHdpParameter); if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { return; } if (shRet != SystemData.ReturnValue.OK) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("配置字典表加载失败!"); } if (lstHdpParameter == null) { GlobalMethods.UI.SetCursor(this, Cursors.Default); return; } for (int index = 0; index < lstHdpParameter.Count; index++) { HdpParameter hdpParameter = lstHdpParameter[index]; if (hdpParameter == null) { continue; } int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, hdpParameter); this.dataGridView1.SetRowState(row, RowState.Normal); if (nRowIndex <= 0) { continue; } DataTableViewRow prevRow = this.dataGridView1.Rows[nRowIndex - 1]; if (!string.Equals(row.Cells[this.colConfigGroup.Index].Value , prevRow.Cells[this.colConfigGroup.Index].Value)) { if (prevRow.DefaultCellStyle.BackColor == Color.Gainsboro) { row.DefaultCellStyle.BackColor = Color.White; } else { row.DefaultCellStyle.BackColor = Color.Gainsboro; } } else { row.DefaultCellStyle.BackColor = prevRow.DefaultCellStyle.BackColor; } } }
/// <summary> /// 设置指定行显示的数据,以及绑定的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="qcCheckPoint">绑定的数据</param> private void SetRowData(DataTableViewRow row, QcCheckPoint qcCheckPoint) { if (row == null || row.Index < 0 || qcCheckPoint == null) { return; } row.Tag = qcCheckPoint; row.Cells[this.colQaEventType.Index].Value = qcCheckPoint.QaEventType; row.Cells[this.colCheckType.Index].Value = qcCheckPoint.CheckType; row.Cells[this.colCheckPointContent.Index].Value = qcCheckPoint.CheckPointContent; row.Cells[this.colCheckPointID.Index].Tag = qcCheckPoint.CheckPointID; row.Cells[this.colCheckPointID.Index].Value = qcCheckPoint.CheckPointID; row.Cells[this.colDocType.Index].Tag = qcCheckPoint.DocTypeID; row.Cells[this.colDocType.Index].Value = qcCheckPoint.DocTypeName; row.Cells[this.colWrittenPeriod.Index].Value = qcCheckPoint.WrittenPeriod; if (qcCheckPoint.Score > 0) { row.Cells[this.colQCScore.Index].Value = qcCheckPoint.Score; } row.Cells[this.colIsValid.Index].Value = qcCheckPoint.IsValid; row.Cells[this.colMsgDictMessage.Index].Value = qcCheckPoint.MsgDictMessage; row.Cells[this.colExpression.Index].Value = qcCheckPoint.Expression; row.Cells[this.colHandlerCommand.Index].Value = qcCheckPoint.HandlerCommand; row.Cells[this.colEvent.Index].Value = qcCheckPoint.EventName; row.Cells[this.colEvent.Index].Tag = qcCheckPoint.EventID; row.Cells[this.colIsRepeat.Index].Value = qcCheckPoint.IsRepeat; row.Cells[this.colQaEventType.Index].Value = qcCheckPoint.QaEventType; }
/// <summary> /// 显示配置描述文本编辑对话框 /// </summary> /// <param name="row">指定行</param> private void ShowConfigDescEditForm(DataTableViewRow row) { if (row == null || row.Index < 0 || this.dataGridView1.IsDeletedRow(row)) { return; } if (this.dataGridView1.EditingControl != null) { this.dataGridView1.EndEdit(); } LargeTextEditForm frmConfigDescEdit = new LargeTextEditForm(); frmConfigDescEdit.Text = "编辑配置描述"; DataGridViewCell cell = row.Cells[this.colConfigDesc.Index]; if (cell.Value != null) { frmConfigDescEdit.LargeText = cell.Value.ToString(); } if (frmConfigDescEdit.ShowDialog() != DialogResult.OK) { return; } string szConfigDesc = frmConfigDescEdit.LargeText.Trim(); if (szConfigDesc.Equals(cell.Value)) { return; } cell.Value = szConfigDesc; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }
/// <summary> /// 显示时限设置窗体对话框 /// </summary> /// <param name="cell">指定单元格</param> private void ShowTimeLineEditForm(DataGridViewCell cell) { if (cell == null || cell.RowIndex < 0) { return; } TimeLineEditForm frmTimeLineEdit = new TimeLineEditForm(); if (cell.Value != null) { frmTimeLineEdit.TimeLine = cell.Value.ToString(); } if (frmTimeLineEdit.ShowDialog() != DialogResult.OK) { return; } cell.Value = frmTimeLineEdit.TimeLine; DataTableViewRow row = this.dataGridView1.Rows[cell.RowIndex]; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } DataTableViewRow row = this.dataGridView1.Rows[e.RowIndex]; if (this.dataGridView1.IsDeletedRow(row)) { return; } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); if (e.ColumnIndex == this.colSqlText.Index) { this.ShowQuerySettingForm(row); } else if (e.ColumnIndex == this.colCondition.Index) { this.ShowConditionSettingForm(row); } else if (e.ColumnIndex == this.colDependEvent.Index) { this.ShowDependEventEditForm(); } GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 检查是否有未保存的数据 /// </summary> /// <returns>bool</returns> public override bool HasUncommit() { int nCount = this.dataGridView1.Rows.Count; if (nCount <= 0) { return(false); } for (int index = 0; index < nCount; index++) { DataTableViewRow row = this.dataGridView1.Rows[index]; if (this.dataGridView1.IsDeletedRow(row)) { return(true); } if (this.dataGridView1.IsNewRow(row)) { return(true); } if (this.dataGridView1.IsModifiedRow(row)) { return(true); } } return(false); }
private void LoadHdpRoleList() { this.dataGridView1.Rows.Clear(); List <HdpRole> lstHdpRoles = null; short shRet = HdpRoleAccess.Instance.GetHdpRoleList(string.Empty, ref lstHdpRoles); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstHdpRoles == null || lstHdpRoles.Count <= 0) { return; } for (int index = 0; index < lstHdpRoles.Count; index++) { HdpRole hdpRole = lstHdpRoles[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; row.Tag = hdpRole; //将记录信息保存到该行 this.SetRowData(row, hdpRole); this.dataGridView1.SetRowState(row, RowState.Normal); } }
/// <summary> ///修改选中行数据 /// </summary> private void ModifySelectedItem() { if (this.dataGridView1.SelectedRows.Count <= 0) { return; } if (SystemParam.Instance.UserRight == null) { return; } DataTableViewRow row = this.dataGridView1.SelectedRows[0]; if (this.dataGridView1.IsNormalRow(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } else if (this.dataGridView1.IsModifiedRow(row)) { this.dataGridView1.SetRowState(row, RowState.Normal); this.SetRowData(row, row.Tag as EMRDBLib.QcMsgDict); } this.UpdateUIState(); this.dataGridView1.CurrentCell = row.Cells[this.colSerialNO.Index]; this.dataGridView1.BeginEdit(true); }
/// <summary> /// 删除选中行记录 /// </summary> private void DeleteSelectedItem() { if (this.dgvProductList.SelectedRows.Count <= 0) { return; } DataTableViewRow row = this.dgvProductList.SelectedRows[0]; if (this.dgvProductList.IsDeletedRow(row)) { if (this.dgvProductList.IsNewRow(row)) { this.dgvProductList.SetRowState(row, RowState.New); } else if (this.dgvProductList.IsModifiedRow(row)) { this.dgvProductList.SetRowState(row, RowState.Update); } else if (this.dgvProductList.IsNormalRow(row)) { this.dgvProductList.SetRowState(row, RowState.Normal); } else { this.dgvProductList.SetRowState(row, RowState.Unknown); } } else { this.dgvProductList.SetRowState(row, RowState.Delete); } this.UpdateUIState(); }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="hdpProduct">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref HdpProduct hdpProduct) { if (row == null || row.Index < 0) { return(false); } hdpProduct = new HdpProduct(); HdpProduct oldHdpProduct = row.Tag as HdpProduct; if (!this.dgvProductList.IsNewRow(row)) { if (oldHdpProduct == null) { MessageBoxEx.Show("质量问题分类字典行数据信息为空!"); return(false); } } if (this.dgvProductList.IsDeletedRow(row)) { hdpProduct = oldHdpProduct; return(true); } if (GlobalMethods.Misc.IsEmptyString(row.Cells[this.colSerialNO.Index].Value.ToString())) { this.dgvProductList.CurrentCell = row.Cells[this.colSerialNO.Index]; this.dgvProductList.BeginEdit(true); MessageBoxEx.Show("您必须设置序号!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colNameShort.Index].Value)) { this.dgvProductList.CurrentCell = row.Cells[this.colNameShort.Index]; this.dgvProductList.BeginEdit(true); MessageBoxEx.Show("您必须设置产品缩写!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colEnName.Index].Value)) { this.dgvProductList.CurrentCell = row.Cells[this.colEnName.Index]; this.dgvProductList.BeginEdit(true); MessageBoxEx.Show("您必须设置英文名称!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colCnName.Index].Value)) { MessageBoxEx.Show("您必须设置中文名称!"); return(false); } if (hdpProduct == null) { hdpProduct = new HdpProduct(); } hdpProduct.SERIAL_NO = row.Cells[this.colSerialNO.Index].Value.ToString(); hdpProduct.NAME_SHORT = (string)row.Cells[this.colNameShort.Index].Value; hdpProduct.CN_NAME = (string)row.Cells[this.colCnName.Index].Value; hdpProduct.EN_NAME = (string)row.Cells[this.colEnName.Index].Value; hdpProduct.PRODUCT_BAK = row.Cells[this.colProductBak.Index].Value == null ? "" : (string)row.Cells[this.colProductBak.Index].Value; return(true); }
private void mnuCancelDelete_Click(object sender, EventArgs e) { int nCount = this.dataGridView1.SelectedRows.Count; if (nCount <= 0) { return; } for (int index = 0; index < nCount; index++) { DataTableViewRow row = this.dataGridView1.SelectedRows[index]; if (!this.dataGridView1.IsDeletedRow(row)) { continue; } if (this.dataGridView1.IsNewRow(row)) { this.dataGridView1.SetRowState(row, RowState.New); } else if (this.dataGridView1.IsModifiedRow(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } else { this.dataGridView1.SetRowState(row, RowState.Normal); } } }
/// <summary> /// 读取数据库,装载当前DataGridView各行数据 /// </summary> private void LoadGridViewData() { this.dataGridView1.Rows.Clear(); List <TimeQCEvent> lstTimeQCEvents = null; short shRet = TimeQCEventAccess.Instance.GetTimeQCEvents(ref lstTimeQCEvents); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("病历时效事件列表下载失败!"); return; } if (lstTimeQCEvents == null || lstTimeQCEvents.Count <= 0) { return; } //先将事件对象加载到哈希表 //以便用来生成依赖事件对应的名字 Hashtable htTimeEvent = new Hashtable(); for (int index = 0; index < lstTimeQCEvents.Count; index++) { TimeQCEvent timeQCEvent = lstTimeQCEvents[index]; if (timeQCEvent == null) { continue; } if (!htTimeEvent.Contains(timeQCEvent.EventID)) { htTimeEvent.Add(timeQCEvent.EventID, timeQCEvent.EventName); } } for (int index = 0; index < lstTimeQCEvents.Count; index++) { TimeQCEvent timeQCEvent = lstTimeQCEvents[index]; if (timeQCEvent == null) { continue; } string szDependEvent = timeQCEvent.DependEvent; if (!string.IsNullOrEmpty(szDependEvent)) { if (htTimeEvent.Contains(szDependEvent)) { szDependEvent = (string)htTimeEvent[szDependEvent]; } } timeQCEvent.DependEventName = szDependEvent; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, timeQCEvent); this.dataGridView1.SetRowState(row, RowState.Normal); } }
/// <summary> /// 装载病案质量问题分类信息 /// </summary> private void LoadQCEventTypeList() { this.dataGridView1.Rows.Clear(); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { this.MainForm.ShowStatusMessage("未找到记录"); return; } if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { return; } System.Collections.Hashtable ht = new System.Collections.Hashtable(); for (int index = 0; index < lstQCEventTypes.Count; index++) { //跳过子类问题 if (!string.IsNullOrEmpty(lstQCEventTypes[index].PARENT_CODE)) { continue; } EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; row.Tag = qcEventType; //将记录信息保存到该行 this.SetRowData(row, qcEventType); this.dataGridView1.SetRowState(row, RowState.Normal); //加载子类问题类型 if (!ht.Contains(qcEventType.INPUT_CODE)) { for (int index2 = 0; index2 < lstQCEventTypes.Count; index2++) { EMRDBLib.QaEventTypeDict secQcEventType = lstQCEventTypes[index2]; if (secQcEventType.PARENT_CODE != qcEventType.INPUT_CODE) { continue; } int nRowIndex2 = this.dataGridView1.Rows.Add(); DataTableViewRow secRow = this.dataGridView1.Rows[nRowIndex2]; secRow.Tag = qcEventType; //将记录信息保存到该行 this.SetRowData(secRow, secQcEventType); this.dataGridView1.SetRowState(secRow, RowState.Normal); } ht.Add(qcEventType.INPUT_CODE, qcEventType.QA_EVENT_TYPE); } } }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="hdpResource">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref HdpRoleGrant hdpRoleGrant) { if (row == null || row.Index < 0) { return(false); } hdpRoleGrant = new HdpRoleGrant(); HdpRoleGrant oldHdpRoleGrant = row.Tag as HdpRoleGrant; if (!this.dataGridView1.IsNewRow(row)) { if (oldHdpRoleGrant == null) { MessageBoxEx.Show("角色授权信息为空!"); return(false); } } if (this.dataGridView1.IsDeletedRow(row)) { hdpRoleGrant = oldHdpRoleGrant; return(true); } if (this.toolcboProduct.SelectedItem == null || this.toolcboProduct.Text == string.Empty) { MessageBoxEx.Show("您必须选择产品!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colRoleRightKey.Index].Value)) { this.dataGridView1.CurrentCell = row.Cells[this.colRoleRightKey.Index]; this.dataGridView1.BeginEdit(true); MessageBoxEx.Show("您必须选择权限点!"); return(false); } if (hdpRoleGrant == null) { hdpRoleGrant = new HdpRoleGrant(); } hdpRoleGrant.GrantID = oldHdpRoleGrant.GrantID; hdpRoleGrant.RoleCode = this.m_roleInfo.RoleCode; hdpRoleGrant.Product = (this.toolcboProduct.SelectedItem as HdpProduct).NAME_SHORT; hdpRoleGrant.RoleRightKey = (string)row.Cells[this.colRoleRightKey.Index].Value; hdpRoleGrant.RoleRightDesc = (string)row.Cells[this.colRoleRightDesc.Index].Value; if (row.Cells[this.colRoleRightCommand.Index].Value != null) { hdpRoleGrant.RoleRightCommand = (string)row.Cells[this.colRoleRightCommand.Index].Value; } ; return(true); }
private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { //不允许修改已删除行 DataTableViewRow row = this.dgvProductList.Rows[e.RowIndex]; if (this.dgvProductList.IsDeletedRow(row)) { e.Cancel = true; return; } }
private void Search() { try { this.XDataGrid1.Rows.Clear(); this.chkAll.Checked = false; DateTime dtRequestTimeBegin = dtpTimeBegin.Value; DateTime dtRequestTimeEnd = dtpTimeEnd.Value; string szPatientID = txt_PATIENT_ID.Text.Trim(); string szStatus = cboStatus.Text; List <RecBrowseRequest> lstRecBrowseRequest = null; short shRet = RecBrowseRequestAccess.Instance.GetList(szStatus, dtRequestTimeBegin, dtRequestTimeEnd, szPatientID, ref lstRecBrowseRequest); if (lstRecBrowseRequest == null) { this.lbl_msg.Text = "未找到记录"; return; } this.XDataGrid1.Rows.Clear(); int nRowIndex = 0; foreach (var item in lstRecBrowseRequest) { nRowIndex = this.XDataGrid1.Rows.Add(); DataTableViewRow row = this.XDataGrid1.Rows[nRowIndex]; row.Tag = item; row.Cells[this.col_APPROVAL_NAME.Index].Value = item.APPROVAL_NAME; if (item.APPROVAL_TIME != item.DefaultTime) { row.Cells[this.col_APPROVAL_TIME.Index].Value = DateTimeExtensions.ToDefaultString(item.APPROVAL_TIME); } if (item.DISCHARGE_TIME != item.DefaultTime) { row.Cells[this.col_DISCHARGE_TIME.Index].Value = DateTimeExtensions.ToDefaultString(item.DISCHARGE_TIME); } row.Cells[this.col_PATIENT_ID.Index].Value = item.PATIENT_ID; row.Cells[this.col_PATIENT_NAME.Index].Value = item.PATIENT_NAME; row.Cells[this.col_REMARK.Index].Value = item.REMARK; row.Cells[this.col_REQUEST_NAME.Index].Value = item.REQUEST_NAME; if (item.REQUEST_TIME != item.DefaultTime) { row.Cells[this.col_REQUEST_TIME.Index].Value = DateTimeExtensions.ToDefaultString(item.REQUEST_TIME); } row.Cells[this.col_STATUS.Index].Value = SystemData.BrowseRequestStatus.GetStatusName(item.STATUS); row.Cells[this.col_VISIT_ID.Index].Value = item.VISIT_ID; row.Cells[this.col_VISIT_NO.Index].Value = item.VISIT_NO; } this.lbl_msg.Text = string.Format("共{0}条申请记录", lstRecBrowseRequest.Count); } catch (Exception ex) { LogManager.Instance.WriteLog(ex.ToString()); } }