Beispiel #1
0
		public ZActor(ZContext context, ZAction action, params object[] args)
			: this(context, default(string), action, args)
		{
			var rnd0 = new byte[8];
			using (var rng = new System.Security.Cryptography.RNGCryptoServiceProvider()) rng.GetNonZeroBytes(rnd0);
			this.Endpoint = string.Format("inproc://{0}", ZContext.Encoding.GetString(rnd0));
		}
Beispiel #2
0
        public ZActor(ZContext context, ZAction action, params object[] args)
            : this(context, default(string), action, args)
        {
            var rnd0 = new byte[8];

            using (var rng = new RNGCryptoServiceProvider()) rng.GetBytes(rnd0);
            this.Endpoint = string.Format("inproc://{0}", ZContext.Encoding.GetString(rnd0));
        }
Beispiel #3
0
        public ZActor(ZContext context, ZAction action, params object[] args)
            : this(context, default(string), action, args)
        {
            var rnd0 = new byte[8];

            new System.Security.Cryptography.RNGCryptoServiceProvider().GetNonZeroBytes(rnd0);
            this.Endpoint = string.Format("inproc://{0}", ZContext.Encoding.GetString(rnd0));
        }
Beispiel #4
0
        public ZActor(ZContext context, ZAction action, params object[] args)
            : this(context, default(string), action, args)
        {
            var rnd0 = new byte[8];

            using (var rng = new System.Security.Cryptography.RNGCryptoServiceProvider()) rng.GetNonZeroBytes(rnd0);
            Endpoint = $"inproc://{ZContext.Encoding.GetString(rnd0)}";
        }
Beispiel #5
0
 public ZAction GetLastAction()
 {
     if (_lastAction != null && _lastAction.IsComplete())
     {
         _lastAction = null;
     }
     return(_lastAction);
 }
Beispiel #6
0
        public ZActor(ZContext context, string endpoint, ZAction action, params object[] args)
        {
            Context = context;

            Endpoint  = endpoint;
            Action    = action;
            Arguments = args;
        }
Beispiel #7
0
 public void ResetActions()
 {
     foreach (var action in _actionsList)
     {
         action.End();
     }
     _actionsList.Clear();
     _lastAction = null;
 }
Beispiel #8
0
		public ZActor(ZContext context, string endpoint, ZAction action, params object[] args)
			: base()
		{
			this.Context = context;

			this.Endpoint = endpoint;
			this.Action = action;
			this.Arguments = args;
		}
Beispiel #9
0
        public ZActor(ZContext context, string endpoint, ZAction action, params object[] args)
            : base()
        {
            this.Context = context;

            this.Endpoint  = endpoint;
            this.Action    = action;
            this.Arguments = args;
        }
Beispiel #10
0
    public ZAction AddAction(ZAction ta)
    {
        ZAction last = GetLastAction();

        if (last != null)
        {
            last.AddAction(ta);
        }
        else
        {
            AddParalelAction(ta);
        }
        _lastAction = ta;
        return(ta);
    }
Beispiel #11
0
    public void UpdateActions(float dt)
    {
        int index = 0;

        while (index < _actionsList.Count)
        {
            ZAction action = _actionsList[index];
            if (action.IsComplete())
            {
                action.End();
                foreach (var actionChild in action.GetAAction())
                {
                    AddParalelAction(actionChild);
                }
                _actionsList.Remove(action);
            }
            else
            {
                index++;
                action.Update(dt);
            }
        }
    }
Beispiel #12
0
 public override void Unload()
 {
     ZAction.UnloadAction();
 }
Beispiel #13
0
 public ZAction AddAction(ZAction ta)
 {
     _aAction.Add(ta);
     return(ta);
 }
Beispiel #14
0
 public ZActionWorker()
 {
     _actionsList = new List <ZAction>();
     _lastAction  = null;
 }
Beispiel #15
0
 public ZActor(string endpoint, ZAction action, params object[] args)
     : this(ZContext.Current, endpoint, action, args)
 {
 }
Beispiel #16
0
 public ZActor(ZAction action, params object[] args)
     : this(ZContext.Current, action, args)
 {
 }
Beispiel #17
0
 public ZAction AddParalelAction(ZAction ta)
 {
     ta.Start();
     _actionsList.Add(ta);
     return(ta);
 }
Beispiel #18
0
 public override void Load()
 {
     ZAction.LoadAction();
 }
Beispiel #19
0
 public ZEROWORLD()
 {
     Instance = this;
     ZAction.Initialize();
 }
Beispiel #20
0
        /// <summary>
        /// Lấy tất cả các quyền (chức năng) của người dùng
        /// </summary>
        /// <param name="userId">Id người dùng đăng nhập</param>
        /// <returns>Danh sách các quyền (chức năng)</returns>
        public List<ZAction> GetRights(Guid userId)
        {
            try
            {
                var a = from s in _db.Pol_UserRights

                        join u in _db.Pol_Users on s.Pol_UserId equals u.Id
                        join r in _db.Pol_Rights on s.Pol_RightId equals r.Id

                        where s.Pol_UserId == userId
                        select new
                        {
                            RightCode = r.Code,
                            RightName = r.Name,
                            RightDescript = r.Descript,

                            s.Add,
                            s.Edit,
                            s.Delete,
                            s.Default,
                            s.Print,
                            s.Access,
                            s.Full,
                            s.None
                        };

                var b = from s in _db.Pol_RoleRights

                        join r in _db.Pol_Rights on s.Pol_RightId equals r.Id
                        join ur in _db.Pol_UserRoles on s.Pol_RoleId equals ur.Pol_RoleId
                        join u in _db.Pol_Users on ur.Pol_UserId equals u.Id

                        where ur.Pol_User.Id == userId
                        select new
                        {
                            RightCode = r.Code,
                            RightName = r.Name,
                            RightDescript = r.Descript,

                            s.Add,
                            s.Edit,
                            s.Delete,
                            s.Default,
                            s.Print,
                            s.Access,
                            s.Full,
                            s.None
                        };

                var tmp = a.Union(b);

                var lst = new List<ZAction>();

                foreach (var res in tmp)
                {
                    var z = new ZAction()
                    {
                        Code = res.RightCode,
                        Add = res.Add,
                        Edit = res.Edit,
                        Delete = res.Delete,
                        Default = res.Default,
                        Print = res.Print,
                        Access = res.Access,
                        Full = res.Full,
                        None = res.None
                    };

                    lst.Add(z);
                }

                return lst;
            }
            catch { return null; }
        }