/// <summary> /// 删除事件 /// by xlb 2013-01-05 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonDelRule_Click(object sender, EventArgs e) { try { if (_currentRule == null || _currentRule.RuleCode == null) { MessageBox.Show("请选择要删除的数据"); return; } DataTable dtQcRecord = QCRecord.GetAllQcRecord(_currentRule.RuleCode); int count = int.Parse(dtQcRecord.Rows[0][0].ToString()); if (count > 0) { MessageBox.Show("该规则已被质控记录使用,无法删除"); return; } if (MyMessageBox.Show("您确定删除吗?", "提示", MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } QCRule.DeleteQcRule(_currentRule); MessageBox.Show("删除成功"); InitDataRule(); DS_Common.ClearControl(groupControlRule); DS_Common.ClearControl(groupControlCondtion); lookUpEditDoctorLevel.EditValue = null; } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 保存时限规则条件 /// xlb 2013-01-07 /// </summary> private void SaveCondition() { try { if (_qcCondition == null) { return; } string message = ""; bool result = ValidateInfo(ref message); if (!result) { MessageBox.Show(message); return; } _qcCondition.Code = this.textEditConditionCode.Text.Trim(); _qcCondition.Description = this.textEditConditonDes.Text.Trim(); _qcCondition.TableName = this.textEditConditionTable.Text.Trim(); _qcCondition.ColumnName = this.textEditConditionColumn.Text.Trim(); _qcCondition.ColumnValue = this.textEditColumnValue.Text.Trim(); _qcCondition.TimeColumnName = this.textEditTimeColumn.Text.Trim(); _qcCondition.TimeRange = TimesToSeconds(textEditTimeRange.Text.Trim()); _qcCondition.PatNoColumnName = this.textEditPatColumn.Text.Trim(); _qcCondition.Memo = textEditMemo.Text.Trim(); _qcCondition.DBLink = comboBoxEditDBLink.SelectedItem.ToString(); //质控条件集合 List <QCCondition> qcConditionList = gridControlCondition.DataSource as List <QCCondition>; if (qcConditionList == null) { qcConditionList = new List <QCCondition>(); } if (_editState == EditState.Add) { QCCondition.InsertCondition(_qcCondition); MessageBox.Show("添加成功"); //集合中插入新增数据行 便于 定位焦点在新增行上 qcConditionList.Add(_qcCondition); } else { QCCondition.UpdateCondition(_qcCondition); MessageBox.Show("修改成功"); } //绑定数据源 gridControlCondition.DataSource = new List <QCCondition>(qcConditionList); //定位焦点在最后一行 gridViewCondition.MoveBy(qcConditionList.Count - 1); DS_Common.ClearControl(groupControl1); SetEditState(false, false); _qcCondition = new QCCondition(); gridViewCondition.FocusedRowHandle = (gridControlCondition.DataSource as List <QCCondition>).Count; } catch (Exception ex) { throw ex; } }
/// <summary> /// 重置事件 /// by xlb 2013-01-06 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnReset_Click(object sender, EventArgs e) { try { DS_Common.ClearControl(panelControlTop); InitDataConditon(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 取消事件 /// xlb 2013-01-07 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { try { DS_Common.ClearControl(groupControl1); SetEditState(false, false); _qcCondition = new QCCondition(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 取消事件 /// xlb 203-01-15 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { try { SetRuleEditState(false, false); _currentRule = new QCRule(); DS_Common.ClearControl(groupControlRule); DS_Common.ClearControl(groupControlCondtion); lookUpEditDoctorLevel.EditValue = null; } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 删除事件 /// by xlb 2013-01-06 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDeleteCondition_Click(object sender, EventArgs e) { try { if (gridViewCondition.FocusedRowHandle < 0) { MessageBox.Show("没有数据"); return; } int rowHandel = gridViewCondition.FocusedRowHandle; _qcCondition = gridViewCondition.GetRow(rowHandel) as QCCondition; int count = QCRule.QcRuleCountByConditionCode(_qcCondition.Code); if (count > 0) { MessageBox.Show("该条件已匹配了规则,无法删除"); return; } if (MyMessageBox.Show("您确定删除数据吗?", "提示", MyMessageBoxButtons.OkCancel) == DialogResult.Cancel) { return; } #region ======注销 by xlb 2013-02-29======= //DataTable dtRuleTable = QCRule.GetAllQCRules(); //if (dtRuleTable == null || dtRuleTable.Rows.Count <= 0) //{ // return; //} //foreach (DataRow dr in dtRuleTable.Rows) //{ // if (dr["CONDITIONCODE"].ToString() == _qcCondition.Code) // { // MessageBox.Show("该条件已匹配了规则,无法删除"); // return; // } //} #endregion QCCondition.DeleteCondition(_qcCondition); MessageBox.Show("删除成功"); InitDataConditon(); DS_Common.ClearControl(groupControl1); gridViewCondition.MoveBy(rowHandel);//焦点定位到下一行 } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 新增规则事件 /// xlb 2013-01-05 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonNewRule_Click(object sender, EventArgs e) { try { DS_Common.ClearControl(groupControlRule); DS_Common.ClearControl(groupControlCondtion); SetRuleEditState(true, true); editstate = EditSate.Add; _currentRule = new QCRule(); lookUpEditDoctorLevel.EditValue = null; } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 新增时限条件事件 /// by xlb 2013-01-06 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddConditon_Click(object sender, EventArgs e) { try { SetEditState(true, true); DS_Common.ClearControl(groupControl1); _qcCondition = new QCCondition(); _editState = EditState.Add; this.textEditConditionCode.Text = (CalMaxQcConditionID() + 1).ToString(); textEditConditonDes.Focus(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 刷新事件 /// xlb 2013-04-05 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonLoadRule_Click(object sender, EventArgs e) { try { InitDataRule(); InitRuleCategoryName(); DS_Common.ClearControl(groupControlRule); DS_Common.ClearControl(groupControlCondtion); SetRuleEditState(false, false); lookUpEditDoctorLevel.EditValue = null; _currentRule = new QCRule(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
///// <summary> ///// 屏蔽第三方控件右键菜单 ///// Add xlb 2013-02-29 ///// </summary> ///// <param name="control"></param> //private void CancelMenu(Control control,ContextMenuStrip contextMenuStrip) //{ // try // { // foreach (Control ctrl in control.Controls) // { // Type type = ctrl.GetType(); // if (type == typeof(LabelControl)) // { // continue; // } // else if (type == typeof(TextEdit)) // { // TextEdit textEdit = ctrl as TextEdit; // if (textEdit != null) // { // textEdit.Properties.ContextMenuStrip = contextMenuStrip; // } // } // else if (type == typeof(MemoEdit)) // { // MemoEdit memoEdit = ctrl as MemoEdit; // if (memoEdit != null) // { // memoEdit.Properties.ContextMenuStrip = contextMenuStrip; // } // } // else if (type == typeof(SpinEdit)) // { // SpinEdit spinEdit = ctrl as SpinEdit; // if (spinEdit != null) // { // spinEdit.Properties.ContextMenuStrip = contextMenuStrip; // } // } // } // } // catch (Exception ex) // { // throw ex; // } //} #endregion /// <summary> /// 选择行变化时出发的事件 /// by xlb 2013-01-06 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewRule_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { if (e.FocusedRowHandle < 0) { return; } _currentRule = gridViewRule.GetRow(e.FocusedRowHandle) as QCRule; DS_Common.ClearControl(groupControlRule); ShowRule(_currentRule); SetRuleEditState(false, false); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> ///选择行变化触发的事件 ///xlb 2013-01-06 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewCondition_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { if (e.FocusedRowHandle < 0) { return; } _qcCondition = gridViewCondition.GetRow(e.FocusedRowHandle) as QCCondition; DS_Common.ClearControl(groupControl1); ShowCondition(_qcCondition); SetEditState(false, false); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 单击GridControl事件 /// xlb 2013-01-09 /// 应对focusedrowchanged失效时使用 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewCondition_Click(object sender, EventArgs e) { try { if (gridViewCondition.FocusedRowHandle < 0) { return; } _qcCondition = gridViewCondition.GetRow(gridViewCondition.FocusedRowHandle) as QCCondition; DS_Common.ClearControl(groupControl1); ShowCondition(_qcCondition); SetEditState(false, false); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 单击列表事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewRule_Click(object sender, EventArgs e) { try { if (gridViewRule.FocusedRowHandle < 0) { return; } _currentRule = gridViewRule.GetRow(gridViewRule.FocusedRowHandle) as QCRule; if (_currentRule == null) { return; } DS_Common.ClearControl(groupControlRule); DS_Common.ClearControl(groupControlCondtion); ShowRule(_currentRule); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }