Exemple #1
0
        public void Save()
        {
            ISecurity security = new SecurityLevel1();

            if (security.IsLogin(this.Name) && security.IsManager(this.Name))
            {
                Console.WriteLine("{0} save message sucess", this.Name);
            }
            else
            {
                Console.WriteLine("{0} save message error, has not login or power ", this.Name);
            }
        }
Exemple #2
0
        public object Invoke(IMethodInvocation invocation)
        {
            ISecurity sercurity = new SecurityLevel1();

            if (invocation.Method.Name == "Save")
            {
                IUserManager user = invocation.Target as IUserManager;

                if (sercurity.IsLogin(user.Name) && sercurity.IsManager(user.Name))
                {
                    user.Save();
                }
                return(null);
            }
            else
            {
                return(invocation.Proceed());
            }
        }