public LiteQuery GetMMSubQuery(string innnerTableName, string leftFieldName, string rightFieldName, object rightValue)
        {
            string    tableAlias = string.Empty;
            LiteQuery query      = LiteQuery.New(innnerTableName, tableAlias);

            query.AddField(tableAlias, leftFieldName);
            query.Filter = FilterField.New(tableAlias, rightFieldName).Equal(rightValue);
            return(query);
        }
        protected LiteQuery GetRefSubQuery(string refTableName, string refKeyName, string refDisplayName, string foreignTableAlias, string foreignName)
        {
            string    tableAlias = string.Empty;
            LiteQuery query      = LiteQuery.New(refTableName, tableAlias);

            query.AddField(tableAlias, refDisplayName);
            query.Filter = FilterField.New(tableAlias, refKeyName).Equal(foreignTableAlias, foreignName);
            return(query);
        }
Beispiel #3
0
        public override DataTable Query()
        {
            var q = LiteQuery.New("T_User", "a");

            q.SelectFields.Add(LiteField.NewEntityField("a", "User_ID"));
            q.SelectFields.Add(LiteField.NewEntityField("a", "User_Name"));
            q.SelectFields.Add(LiteField.NewEntityField("a", "User_Code"));
            q.SelectFields.Add(LiteField.NewEntityField("a", "Department_ID"));
            q.SelectFields.Add(LiteField.NewEntityField("a", "User_Mobile"));

            var subQ = GetRefSubQuery("T_Department", "Department_ID", "Department_Name", "a", "Department_ID");

            q.SelectFields.Add(LiteField.NewSubQueryField(subQ, "Department_ID_V"));

            q.Filter = LiteFilter.True();

            if (!string.IsNullOrEmpty(this.UserName))
            {
                var fUserName = FilterField.New("a", "User_Name").Contains(this.UserName);
                q.Filter = q.Filter.And(fUserName);
            }
            if (!string.IsNullOrEmpty(this.UserCode))
            {
                var fUserCode = FilterField.New("a", "User_Code").Contains(this.UserCode);
                q.Filter = q.Filter.And(fUserCode);
            }
            if (this.DepartmentId != null)
            {
                var fDeptId = FilterField.New("a", "Department_ID").Equal(this.DepartmentId.Value);
                q.Filter = q.Filter.And(fDeptId);
            }

            AddFilterForPrevilege(q);
            AddFilterForShared(q);

            q.SkipNumber = this.PageIndex * this.PageSize;
            q.TakeNumber = this.PageSize;

            return(this.DataHelper.ExecuteLiteQuery(q));
        }