Exemplo n.º 1
0
        /// <summary>
        /// 显示时效事件选择对话框
        /// </summary>
        private void ShowTimeEventSelectForm()
        {
            TimeEventSelectForm frmTimeEventSelect = new TimeEventSelectForm();

            //设置默认选中的时效事件
            DataGridViewCell currCell = this.dataGridView1.CurrentCell;

            if (currCell != null)
            {
                TimeQCEvent timeQCEvent = new TimeQCEvent();
                if (currCell.Tag != null)
                {
                    timeQCEvent.EventID = currCell.Tag.ToString();
                }
                if (currCell.Value != null)
                {
                    timeQCEvent.EventName = currCell.Value.ToString();
                }
                frmTimeEventSelect.SelectedEvent = timeQCEvent;
            }

            //更新选中所有行的时效事件
            if (frmTimeEventSelect.ShowDialog() == DialogResult.OK)
            {
                TimeQCEvent timeQCEvent = frmTimeEventSelect.SelectedEvent;
                if (timeQCEvent == null)
                {
                    timeQCEvent = new TimeQCEvent();
                }
                for (int index = 0; index < this.dataGridView1.SelectedRows.Count; index++)
                {
                    DataTableViewRow row = this.dataGridView1.SelectedRows[index];
                    if (row == null || row.Index < 0)
                    {
                        continue;
                    }
                    row.Cells[this.colEvent.Index].Tag   = timeQCEvent.EventID;
                    row.Cells[this.colEvent.Index].Value = timeQCEvent.EventName;
                    if (!this.dataGridView1.IsNormalRowUndeleted(row))
                    {
                        continue;
                    }
                    this.dataGridView1.SetRowState(row, RowState.Update);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 显示依赖事件设置对话框
        /// </summary>
        /// <param name="row">指定行</param>
        private void ShowDependEventEditForm()
        {
            TimeEventSelectForm frmDependEvent = new TimeEventSelectForm();

            //初始化病历时效事件选择列表
            int count = this.dataGridView1.Rows.Count;

            for (int index = 0; index < count; index++)
            {
                DataTableViewRow row = this.dataGridView1.Rows[index];

                TimeQCEvent timeQCEvent = new TimeQCEvent();

                object cellValue = row.Cells[this.colEventID.Index].Value;
                if (cellValue == null || cellValue.ToString().Trim() == string.Empty)
                {
                    continue;
                }
                timeQCEvent.EventID = cellValue.ToString();

                string szDocTypeName = string.Empty;
                cellValue = row.Cells[this.colEventName.Index].Value;
                if (cellValue == null || cellValue.ToString().Trim() == string.Empty)
                {
                    continue;
                }
                timeQCEvent.EventName = cellValue.ToString();

                frmDependEvent.TimeQCEvents.Add(timeQCEvent);
            }

            //设置默认选中的病历时效事件
            DataGridViewCell currCell = this.dataGridView1.CurrentCell;

            if (currCell != null)
            {
                TimeQCEvent timeQCEvent = new TimeQCEvent();
                if (currCell.Tag != null)
                {
                    timeQCEvent.EventID = currCell.Tag.ToString();
                }
                if (currCell.Value != null)
                {
                    timeQCEvent.EventName = currCell.Value.ToString();
                }
                frmDependEvent.SelectedEvent = timeQCEvent;
            }

            //更新选中所有行的病历时效事件
            if (frmDependEvent.ShowDialog() == DialogResult.OK)
            {
                TimeQCEvent timeQCEvent = frmDependEvent.SelectedEvent;
                if (timeQCEvent == null)
                {
                    timeQCEvent = new TimeQCEvent();
                }
                for (int index = 0; index < this.dataGridView1.SelectedRows.Count; index++)
                {
                    DataTableViewRow row = this.dataGridView1.SelectedRows[index];
                    if (row == null || row.Index < 0)
                    {
                        continue;
                    }
                    row.Cells[this.colDependEvent.Index].Tag   = timeQCEvent.EventID;
                    row.Cells[this.colDependEvent.Index].Value = timeQCEvent.EventName;
                    if (!this.dataGridView1.IsNormalRowUndeleted(row))
                    {
                        continue;
                    }
                    this.dataGridView1.SetRowState(row, RowState.Update);
                }
            }
        }