public DataGettedEventArgs(string name, ICondition condition, string scope, Paging paging, Sorting[] sortings, object result)
		{
			if(string.IsNullOrWhiteSpace(name))
				throw new ArgumentNullException("name");

			_name = name.Trim();
			_condition = condition;
			_scope = scope;
			_paging = paging;
			_sortings = sortings;
			_result = result;
		}
		public DataSelectedEventArgs(string name, Type entityType, ICondition condition, Grouping grouping, string scope, Paging paging, Sorting[] sortings, IEnumerable result)
		{
			if(string.IsNullOrWhiteSpace(name))
				throw new ArgumentNullException("name");

			if(entityType == null)
				throw new ArgumentNullException("entityType");

			_name = name.Trim();
			_entityType = entityType;
			_condition = condition;
			_grouping = grouping;
			_scope = scope;
			_paging = paging;
			_sortings = sortings;
			_result = result;
		}
Exemplo n.º 3
0
		public IEnumerable<Role> GetAllRoles(string @namespace, Paging paging = null)
		{
			var dataAccess = this.EnsureService<IDataAccess>();
			return dataAccess.Select<Role>(MembershipHelper.DATA_ENTITY_ROLE, new Condition("Namespace", MembershipHelper.TrimNamespace(@namespace)), null, paging ?? new Paging(1, 20));
		}
Exemplo n.º 4
0
		public IEnumerable<Role> GetAllRoles(string @namespace, Paging paging = null)
		{
			return this.DataAccess.Select<Role>(MembershipHelper.DATA_ENTITY_ROLE, MembershipHelper.GetNamespaceCondition(@namespace), paging);
		}
		public DataSelectingEventArgs(string name, Type entityType, ICondition condition, Grouping grouping, string scope, Paging paging, Sorting[] sortings) : base(name, entityType, condition, grouping, scope, paging, sortings, null)
		{
			_cancel = false;
		}
		public DataGettingEventArgs(string name, ICondition condition, string scope, Paging paging, Sorting[] sortings) : base(name, condition, scope, paging, sortings, null)
		{
			_cancel = false;
		}
Exemplo n.º 7
0
            public bool Complete(out Collections.INamedCollection <TMember> members)
            {
                members = null;

                if (_stack != null && _stack.Count > 0)
                {
                    _onError?.Invoke("SyntaxError: The data schema is empty.");
                    return(false);
                }

                switch (State)
                {
                case State.None:
                    if (_members != null && _members.Count > 0)
                    {
                        members = _members;
                    }

                    return(true);

                case State.Asterisk:
                    this.Include("*");
                    break;

                case State.Exclude:
                    this.Exclude();
                    break;

                case State.Include:
                    this.Include();
                    break;

                case State.PagingCount:
                    if (_bufferIndex == 0)
                    {
                        _onError?.Invoke("SyntaxError: Expected pagination number in the data schema, but missing.");
                        return(false);
                    }

                    _current.Paging = Paging.Page(1, int.Parse(new string(_buffer, 0, _bufferIndex)));
                    break;

                case State.PagingSize:
                    if (_bufferIndex == 0)
                    {
                        _onError?.Invoke("SyntaxError: Expected pagination size in the data schema, but missing.");
                        return(false);
                    }

                    var buffer = new string(_buffer, 0, _bufferIndex);

                    if (buffer != "?")
                    {
                        _current.Paging.PageSize = int.Parse(buffer);
                    }

                    break;

                default:
                    _onError?.Invoke($"SyntaxError: The data schema expression is incorrect({State}).");
                    return(false);
                }

                members = _members;
                return(true);
            }
Exemplo n.º 8
0
        private static bool DoPagingCount(ref StateContext context)
        {
            string buffer;

            switch (context.Character)
            {
            case '?':
                if (context.HasBuffer())
                {
                    context.OnError("SyntaxError: The pagination number format of the data schema is incorrect.");
                    return(false);
                }

                context.Current.Paging = null;
                context.State          = State.Include;
                return(true);

            case '*':
                if (context.HasBuffer())
                {
                    context.OnError("SyntaxError: The pagination number format of the data schema is incorrect.");
                    return(false);
                }

                context.Current.Paging = Paging.Disabled;
                context.State          = State.Include;
                return(true);

            case '/':
                if (!context.TryGetBuffer(out buffer))
                {
                    context.OnError("SyntaxError: Expected pagination number in the data schema, but missing.");
                    return(false);
                }

                context.Current.Paging = Paging.Page(int.Parse(buffer));
                context.State          = State.PagingSize;

                return(true);

            case '(':
                if (!context.TryGetBuffer(out buffer))
                {
                    context.OnError("SyntaxError: Expected pagination number in the data schema, but missing.");
                    return(false);
                }

                context.Current.Paging = Paging.Page(1, int.Parse(buffer));
                context.State          = State.SortingField;
                return(true);

            case '{':
                if (!context.TryGetBuffer(out buffer))
                {
                    context.OnError("SyntaxError: Expected pagination number in the data schema, but missing.");
                    return(false);
                }

                context.Current.Paging = Paging.Page(1, int.Parse(buffer));
                context.Push();
                context.State = State.None;
                return(true);

            default:
                if (char.IsDigit(context.Character))
                {
                    context.Accept();
                    return(true);
                }

                context.OnError($"SyntaxError: The pagination number of the data schema contains '{context.Character}' illegal character.");
                return(false);
            }
        }
Exemplo n.º 9
0
		public IEnumerable<User> GetAllUsers(string @namespace, Paging paging = null)
		{
			return this.DataAccess.Select<User>(MembershipHelper.DATA_ENTITY_USER, MembershipHelper.GetNamespaceCondition(@namespace), paging);
		}