public AuthService(IUnitOfWork unitOfWork,
                    IPasswordService passwordService, IAuthSetting authSetting, IAppSetting appSetting)
 {
     _unitOfWork      = unitOfWork;
     _passwordService = passwordService;
     _authSetting     = authSetting;
     _appSetting      = appSetting;
 }
 private void tabAuthorization_SelectedIndexChanged(object sender, EventArgs e)
 {
     WaitDialogHelper.Show();
     try
     {
         if (this.tabAuthorization.SelectedTab == this.pAuthSetting)
         {
             CAuthType tag = this.currentNode.Tag as CAuthType;
             this.BindingContext[tag].EndCurrentEdit();
             if (!this.CheckAuthType(tag))
             {
                 throw new CoreException("权限类型的基本属性不完整,无法开启权限设置!");
             }
             System.Type type = System.Type.GetType(tag.AuthSetClass);
             if (type == null)
             {
                 throw new CoreException("权限设置类型设置错误,无法获取相应类型,请重新设置!");
             }
             if (type.GetInterface("IAuthSetting", true) == null)
             {
                 throw new CoreException("权限设置类型没有实现’IAuthSetting‘接口,请重新设置!");
             }
             if ((this.authSetting != null) && !this.authSetting.GetType().Equals(type))
             {
                 this.pAuthSetting.Controls.Clear();
                 (this.authSetting as Control).Dispose();
                 this.authSetting = null;
             }
             if (this.authSetting == null)
             {
                 this.authSetting = Activator.CreateInstance(type) as IAuthSetting;
                 (this.authSetting as Control).Dock = DockStyle.Fill;
                 this.pAuthSetting.Controls.Add(this.authSetting as Control);
             }
             if (!((this.authSetting.AuthType != null) && this.authSetting.AuthType.Equals(tag)))
             {
                 this.authSetting.AuthType = tag;
                 this.authSetting.CurrentUnitOfWork = this.currentUnitOfWork;
             }
         }
     }
     catch (CoreException exception)
     {
         MessageHelper.ShowInfo(exception.Message);
         this.tabAuthorization.SelectedTab = this.pAuthType;
     }
     finally
     {
         WaitDialogHelper.Close();
     }
 }