示例#1
0
        private void butModify_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtDepartName.Tag == null)
                {
                    MessageBox.Show("请选择需要修改的科室对照。", "提示");
                    return;
                }


                DepartmentInfoData matchData = GetSelectDepartmentMatch();
                if (matchData == null)
                {
                    MessageBox.Show("未获取到有效的科室对照数据。", "提示");
                    return;
                }

                if (Verify(true) == false)
                {
                    return;
                }

                //添加事务处理
                _dmm.TransactionBegin();
                matchData.科室名称    = txtDepartName.Text;
                matchData.附加数据.备注 = rtbAttachInfo.Text;

                matchData.附加数据.CopyBasePro(matchData);

                _dmm.UpdateDepartmentInfo(matchData);

                DataRow dr = matchData.GetBindRow();

                dr["科室名称"] = txtDepartName.Text;
                dr["附加数据"] = matchData.附加数据.ToString();

                _dmm.DelDepartmentMatch(matchData.科室ID);

                UpdatDepartmentMatch(matchData);

                ButtonHint.Start(sender as Button, "OK");
                _dmm.TransactionCommit();
            }
            catch (Exception ex)
            {
                _dmm.TransactionRollback();
                MsgBox.ShowException(ex, "添加科室对照信息失败,参照如下描述信息,进行检查", this);
            }
        }
示例#2
0
        private void SyncSelRowData()
        {
            try
            {
                ClearData();

                if (dataGridView1.DataSource == null)
                {
                    return;
                }
                if (dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }

                DataGridViewRow dvr = dataGridView1.SelectedRows[0];


                string departmentID = dvr.Cells["科室ID"].Value.ToString();

                DataRow[] drs = (dataGridView1.DataSource as DataTable).Select("科室ID='" + departmentID + "'");

                if (drs.Length > 0)
                {
                    DepartmentInfoData matchData = new DepartmentInfoData();
                    matchData.BindRowData(drs[0]);

                    txtDepartName.Text = matchData.科室名称;
                    txtDepartName.Tag  = matchData.科室ID;


                    if (matchData.附加数据 != null)
                    {
                        rtbAttachInfo.Text = matchData.附加数据.备注;
                    }

                    DataTable dtMatchs = _dmm.GetDepartmentMatch(departmentID);

                    foreach (DataRow dr in dtMatchs.Rows)
                    {
                        lsbMatchs.Items.Add(dr["对照来源"].ToString() + "-" + dr["对照编码"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#3
0
        /// <summary>
        /// 更新科室对照
        /// </summary>
        /// <param name="matchInfo"></param>
        private void UpdatDepartmentMatch(DepartmentInfoData matchInfo)
        {
            if (lsbMatchs.Items.Count > 0)
            {
                foreach (string context in lsbMatchs.Items)
                {
                    string[] match = context.Split('-');

                    DepartmentMatchData matchData = new DepartmentMatchData();
                    matchData.科室对照ID = SqlHelper.GetCmpUID();
                    matchData.对照来源   = match[0];
                    matchData.对照编码   = match[1];
                    matchData.科室ID   = matchInfo.科室ID;

                    _dmm.NewDepartmentMatch(matchData);
                }
            }
        }
示例#4
0
        private void butNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (Verify() == false)
                {
                    return;
                }
                //添加事务处理
                _dmm.TransactionBegin();
                DepartmentInfoData matchInfo = new DepartmentInfoData();

                matchInfo.科室ID    = SqlHelper.GetCmpUID();
                matchInfo.科室名称    = txtDepartName.Text;
                matchInfo.附加数据.备注 = rtbAttachInfo.Text;

                matchInfo.附加数据.CopyBasePro(matchInfo);

                _dmm.NewDepartmentInfo(matchInfo);

                DataTable dtBind = dataGridView1.DataSource as DataTable;

                DataRow drNew = dtBind.NewRow();

                drNew["科室ID"] = matchInfo.科室ID;
                drNew["科室名称"] = matchInfo.科室名称;
                drNew["附加数据"] = matchInfo.附加数据.ToString();

                dtBind.Rows.Add(drNew);

                UpdatDepartmentMatch(matchInfo);

                ButtonHint.Start(sender as Button, "OK");
                _dmm.TransactionCommit();
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Selected = true;
            }
            catch (Exception ex)
            {
                _dmm.TransactionRollback();
                MsgBox.ShowException(ex, "添加科室对照信息失败,参照如下描述信息,进行检查", this);
            }
        }
示例#5
0
        public DepartmentInfoData GetSelectDepartmentMatch()
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                return(null);
            }

            DataGridViewRow dvr = dataGridView1.SelectedRows[0];

            string serverID = dvr.Cells["科室ID"].Value.ToString();

            DataRow[] drs = (dataGridView1.DataSource as DataTable).Select("科室ID='" + serverID + "'");

            if (drs.Length > 0)
            {
                DepartmentInfoData matchData = new DepartmentInfoData();
                matchData.BindRowData(drs[0]);

                return(matchData);
            }

            return(null);
        }