Beispiel #1
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <returns>成功返回 true 失败返回 false</returns>
        private bool Save()
        {
            //定义事务

            Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

            //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(myICD.Connection);
            ////开始事务
            //t.BeginTransaction();

            myICD.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);

            //执行插入操作
            int iReturn = 0; //返回值

            //如果是增加的 则插入
            if (editType == EditTypes.Add)
            {
                //插入ICD信息
                iReturn = myICD.Insert(newICD, myICDType);

                if (iReturn > 0)
                {
                    //提交数据
                    Neusoft.FrameWork.Management.PublicTrans.Commit();
                    MessageBox.Show("保存成功");
                    return(true);
                }
                else
                {
                    //回退数据
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("保存失败" + myICD.Err);
                    return(false);
                }
            }
            else if (editType == EditTypes.Modify) //其他的执行更新操作。
            {
                iReturn = myICD.Update(orgICD, newICD, myICDType);
                if (iReturn == -1)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("更新ICD信息失败!" + myICD.Err);
                    return(false);
                }
                if (iReturn == 0)
                {
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show("没有找到可更新的ICD信息,您所修改的ICD信息已经被其他人修改!");
                    return(false);
                }
                Neusoft.FrameWork.Management.PublicTrans.Commit();
                MessageBox.Show("保存成功");
                return(true);
            }

            return(true);
        }
Beispiel #2
0
 public override void SetTrans(System.Data.IDbTransaction trans)
 {
     this.trans = trans;
     icdMgr.SetTrans(trans);
     diagMgr.SetTrans(trans);
 }
        /// <summary>
        /// ICD对照
        /// </summary>
        private void CompareICD()
        {
            try
            {
                //数据验证失败
                if (!ISValid())
                {
                    return;
                }
                icdCompare = GetInfo();
                if (icdCompare == null)
                {
                    return;
                }
                //定义事务
                Neusoft.FrameWork.Management.PublicTrans.BeginTransaction();

                //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(myICD.Connection);
                ////开始事务
                //t.BeginTransaction();
                myICD.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
                //执行插入操作
                int iReturn = 0; //返回值
                iReturn = myICD.InsertCompare(icdCompare);
                if (iReturn > 0)
                {
                    //提交
                    Neusoft.FrameWork.Management.PublicTrans.Commit();
                    //显示刚刚增加的信息
                    this.tabControl1.SelectedIndex = 2;
                    //获取操作时间
                    icdCompare.OperInfo.OperTime = myICD.GetDateTimeFromSysDateTime();
                    //操作员信息
                    icdCompare.OperInfo.ID   = myICD.Operator.ID;
                    icdCompare.OperInfo.Name = myICD.Operator.Name;
                    //从ICD9 列表 中删除 对照完的行
                    DeleteICD9(icdCompare.ICD9);
                    //从在界面上 增加对照信息。
                    AddICDCompare();
                    icdCompare = null;
                    //准备下次输入
                    //清空数据
                    ClearICD();
                    MessageBox.Show("保存对照成功");
                    //					//指定显示界面
                    //					this.tabControl1.SelectedIndex = 1;
                    //					//指定光标位置
                    //					textSearchICD9.Focus();
                }
                else
                {
                    //回退
                    Neusoft.FrameWork.Management.PublicTrans.RollBack();
                    MessageBox.Show(myICD.Err + " 保存对照失败");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }