//public int Del()
        //{
        //    try
        //    {
        //        if (this.neuSpread1.Sheets[0].ActiveRow == null) return -1;
        //        Neusoft.HISFC.Models.Order.Consultation permission = this.neuSpread1.Sheets[0].ActiveRow.Tag as Neusoft.HISFC.Models.Order.Consultation;
        //        if (permission == null) return -1;
        //        if (MessageBox.Show("确实要删除该授权吗?\n该操作不能撤销!", "警告", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return 0;
        //        Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(manager.Connection);
        //        t.BeginTransaction();
        //        manager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans);
        //        if (this.manager.DeletePermission(permission.ID) == -1)
        //        {
        //            Neusoft.FrameWork.Management.PublicTrans.RollBack();;
        //            MessageBox.Show(manager.Err);
        //            return -1;
        //        }
        //        Neusoft.FrameWork.Management.PublicTrans.Commit();
        //        this.Retrieve();
        //    }
        //    catch { }
        //    return 0;
        //}

        //public int MyAdd()
        //{
        //    try
        //    {
        //        if (this.inpatientno == "") return -1;
        //        ucPermissionInput u = new ucPermissionInput();
        //        Neusoft.HISFC.Models.Order.Consultation permission = new Neusoft.HISFC.Models.Order.Consultation();

        //        permission.InpatientNo = this.inpatientno;
        //        if (this.inpatientno == null || this.inpatientno == "")
        //        {
        //            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请输入住院号"));
        //            return -1;
        //        }
        //        if (this.ucPatient1.PatientInfo.PVisit.PatientLocation.Dept.ID != ((Neusoft.HISFC.Models.Base.Employee)this.manager.Operator).Dept.ID)
        //        {
        //            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("非本科患者不能授权"));
        //            return -1;
        //        }
        //        permission.BeginTime = manager.GetDateTimeFromSysDateTime();
        //        permission.EndTime = permission.BeginTime;
        //        u.Permission = permission;
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text = "授权";
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopForm.MaximizeBox = false;
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(u);
        //        this.Retrieve();
        //    }
        //    catch { }
        //    return 0;
        //}

        //public int Copy()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Cut()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Delete()
        //{
        //    return this.Del();
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Export()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Import()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Init()
        //{
        //    this.init();
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //private bool isDirty = false;
        //public bool IsDirty
        //{
        //    get
        //    {
        //        return this.isDirty;
        //        //throw new Exception("The method or operation is not implemented.");
        //    }
        //    set
        //    {
        //        this.isDirty = value;
        //        //throw new Exception("The method or operation is not implemented.");
        //    }
        //}

        //public int Modify()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int NextRow()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Paste()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int PreRow()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Print()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int PrintConfig()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int PrintPreview()
        //{
        //    return 0;
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Query()
        //{
        //    return this.Retrieve();
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //Neusoft.FrameWork.WinForms.Forms.IMaintenanceForm queryForm;
        //public Neusoft.FrameWork.WinForms.Forms.IMaintenanceForm QueryForm
        //{
        //    get
        //    {
        //        return this.queryForm;
        //        //throw new Exception("The method or operation is not implemented.");
        //    }
        //    set
        //    {
        //        this.queryForm = value;
        //        //throw new Exception("The method or operation is not implemented.");
        //    }
        //}

        //public int Save()
        //{
        //    return 0;
        //    //return this.Add();
        //    //throw new Exception("The method or operation is not implemented.");
        //}

        //public int Add()
        //{
        //    //return this.MyAdd();
        //    //throw new Exception("The method or operation is not implemented.");
        //    try
        //    {
        //        if (this.inpatientno == "") return -1;
        //        ucPermissionInput u = new ucPermissionInput();
        //        Neusoft.HISFC.Models.Order.Consultation permission = new Neusoft.HISFC.Models.Order.Consultation();
        //        permission.InpatientNo = this.inpatientno;
        //        if (this.inpatientno == null || this.inpatientno == "")
        //        {
        //            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请输入住院号"));
        //            return -1;
        //        }
        //        if (this.ucPatient1.PatientInfo.PVisit.PatientLocation.Dept.ID != ((Neusoft.HISFC.Models.Base.Employee)this.manager.Operator).Dept.ID)
        //        {
        //            MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("非本科患者不能授权"));
        //            return -1;
        //        }
        //        permission.BeginTime = manager.GetDateTimeFromSysDateTime();
        //        permission.EndTime = permission.BeginTime;
        //        u.Permission = permission;
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text = "授权";
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopForm.MaximizeBox = false;
        //        Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(u);
        //        this.Retrieve();
        //    }
        //    catch { }
        //    return 0;
        //}

        #endregion

        #region IMaintenanceControlable 成员

        int Neusoft.FrameWork.WinForms.Forms.IMaintenanceControlable.Add()
        {
            try
            {
                if (/*this.inpatientno == null ||*/ this.ucQueryInpatientNo1.Text == "")
                {
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请输入住院号"));
                    return(-1);
                }
                //if (this.inpatientno == "") return -1;
                this.inpatientno = this.ucPatient1.PatientInfo.ID;
                ucPermissionInput u = new ucPermissionInput();
                Neusoft.HISFC.Models.Order.Consultation permission = new Neusoft.HISFC.Models.Order.Consultation();
                permission.PatientNo   = ucPatient1.PatientInfo.PID.PatientNO;
                permission.InpatientNo = this.inpatientno;
                if (this.ucPatient1.PatientInfo.PVisit.PatientLocation.Dept.ID != ((Neusoft.HISFC.Models.Base.Employee) this.manager.Operator).Dept.ID)
                {
                    MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("非本科患者不能授权"));
                    return(-1);
                }
                permission.BeginTime = manager.GetDateTimeFromSysDateTime();
                permission.EndTime   = permission.BeginTime;
                u.Permission         = permission;
                Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text        = "授权";
                Neusoft.FrameWork.WinForms.Classes.Function.PopForm.MaximizeBox = false;
                Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(u);
                this.Retrieve();
            }
            catch { }
            return(0);
        }
 private void neuSpread1_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
 {
     try
     {
         ucPermissionInput u = new ucPermissionInput();
         u.Permission             = this.neuSpread1.Sheets[0].ActiveRow.Tag as Neusoft.HISFC.Models.Order.Consultation;
         u.Permission.PatientNo   = this.ucPatient1.PatientInfo.PID.PatientNO;
         u.Permission.InpatientNo = this.ucPatient1.PatientInfo.ID;
         Neusoft.FrameWork.WinForms.Classes.Function.PopForm.Text        = "授权";
         Neusoft.FrameWork.WinForms.Classes.Function.PopForm.MaximizeBox = false;
         Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(u);
         this.Retrieve();
     }
     catch { }
 }