/// <summary> /// 保存数据 /// </summary> private int SaveData() { //验证数据 if (!this.ValidData()) { return(-1); } if (myQueue == null) { this.myQueue = new Neusoft.HISFC.BizLogic.Nurse.Queue(); } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction trans = new Neusoft.FrameWork.Management.Transaction(myQueue.Connection); //trans.BeginTransaction(); myQueue.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); this.GetQueue(); if (this.myResult.strTab.ToUpper() == "ADD") { if (this.IsExistsQueue()) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("相同的队列已经存在"); return(-1); } //判断是否使用 if (this.ValidUsed(this.Queue) == false) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); return(-1); } if (this.myQueue.InsertQueue(this.Queue) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("插入队列出错" + this.myQueue.Err); return(-1); } } if (this.myResult.strTab.ToUpper() == "EDIT") { //if (this.myQueue.ExistPatient(this.queue.SRoom.ID, this.queue.Console.ID, this.queue.ID, this.queue.Noon.ID)) //{ // Neusoft.FrameWork.Management.PublicTrans.RollBack(); // MessageBox.Show("队列中有患者,不能修改!"); // return -1; //} //if (this.myQueue.UpdateQueue(this.Queue) == -1) //{ // Neusoft.FrameWork.Management.PublicTrans.RollBack(); // MessageBox.Show("修改队列出错" + this.myQueue.Err); // return -1; //} //if (this.IsExistsQueue()) //{ // Neusoft.FrameWork.Management.PublicTrans.RollBack(); // MessageBox.Show("相同的队列已经存在"); // return -1; //} if (this.ValidModify(this.myOldQueue, this.queue) == 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("记录没有改变,无需保存!"); return(-1); } if (this.ValidUsed(this.queue) == false) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); return(-1); } if (this.myQueue.ExistPatient(this.myOldQueue.SRoom.ID, this.myOldQueue.Console.ID, this.myOldQueue.ID, this.myOldQueue.Noon.ID)) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("队列中有患者,不能修改!"); return(-1); } if (this.queue.IsValid == false) { if (this.ValidInUsing(this.Queue.ID) < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); return(-1); } } if (this.myQueue.UpdateQueue(this.Queue) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); MessageBox.Show("修改队列出错" + this.myQueue.Err); return(-1); } } Neusoft.FrameWork.Management.PublicTrans.Commit(); return(0); }