Exemple #1
0
 public async void Get()
 {
     var req = new UserDTO {
         Username = "******", ID = "8"
     };
     var query = new WhereQueryable <UserDTO>((x) => x.Nickname == "后端业务");
     var a     = await GetListAsync(query, 20, 0, "Roles");
 }
Exemple #2
0
 public async void GetAsync()
 {
     var date   = DateTime.Now.AddMonths(-1);
     var query  = new WhereQueryable <CustomerDTO>((x) => x.CreatedTime >= date);
     var query1 = new WhereJoinQueryable <User, User, Contact, CustomerDynamicField>((y, yy, z, zzz) => true);
     //var a = await GetListAsync(x => true, (y, yy, z, zzz) => true, 20, 0, "PreUser,PostUser,Contacts,CustomerDynamicFields", new List<OrderByEntity> { new OrderByEntity { IsAsc = false, KeyWord = "LastPaidTime", IsMainTable = true } });
     var b = await CountAsync(query, query1, "PreUser,PostUser,Contacts,CustomerDynamicFields");
 }
Exemple #3
0
        public async void Get()
        {
            var mainQuery = new WhereQueryable <CustomerDTO, User, User>((x, y, yy) => true);
            var joinQuery = new WhereJoinQueryable <CustomerDynamicField, Contact>((w, d) => true);

            mainQuery = mainQuery.WhereAnd((x, y, yy) => x.ID == "1");

            var data = await GetAsync(mainQuery, joinQuery, "PreUser,PostUser", "Contacts");
        }
Exemple #4
0
        public async void GetUnreadCountAsync(int type)
        {
            var query = new WhereQueryable <NotificationDTO, NotificationMark>((x, y) => y.UserID == "9" && x.IsRead == false & y.IsDeleted == false);

            if (type != 0)
            {
                query = query.WhereAnd((x, y) => x.Type == type);
            }
            var a = await GetAsync(x => true, "NotificationMarks");
        }
Exemple #5
0
 public async void GetUserAttachmentsAsync()
 {
     var query = new WhereQueryable <UserAttachmentDTO>((x) => true);
     //query = query.WhereAnd(x => x.UserID.Contains(token.SubordinateUserIDs));
     var a = await GetListAsync(query, 20, 0, "", new List <OrderByEntity> {
         new OrderByEntity {
             IsAsc = false, KeyWord = "CreatedTime"
         }
     });
 }
        public override TResult Execute <TResult>(IQuerySession session)
        {
            if (typeof(TResult) != typeof(TModel))
            {
                throw new NotSupportedException();
            }

            var targetQueryable = Target;

            if (Expression != null)
            {
                targetQueryable = new WhereQueryable <TModel>(session, Target, Expression, JsonSettings);
            }

            var query = targetQueryable.BuildQuery();

            var results = session.Query <TResult>(query)
                          .GetAwaiter()
                          .GetResult();

            switch (Type)
            {
            case SingularExecutorType.First:
            {
                return(IsOrDefault
                        ? results.FirstOrDefault()
                        : results.First());
            }

            case SingularExecutorType.Single:
            {
                return(IsOrDefault
                        ? results.SingleOrDefault()
                        : results.Single());
            }

            case SingularExecutorType.Last:
            {
                return(IsOrDefault
                        ? results.LastOrDefault()
                        : results.Last());
            }

            default:     // not sure how this is possible, but it makes the compiler happy
            {
                throw new NotSupportedException();
            }
            }
        }
Exemple #7
0
        public void GetAsync()
        {
            var date   = DateTime.Now.AddMonths(-1);
            var query  = new WhereQueryable <CustomerDTO, User, User, Customer>((x, y, yy, z) => x.IsSubmit == true);
            var query0 = new WhereQueryable <CustomerDTO, User, User, CustomerDynamicField>((x, y, yy, d) => true);
            var query1 = new WhereJoinQueryable <Contact, CustomerDynamicField>((z, zzz) => z.Content.Contains("'13321952950'"));

            //var a = await GetListAsync(x => true, (y, yy, z, zzz) => true, 20, 0, "PreUser,PostUser,Contacts,CustomerDynamicFields", new List<OrderByEntity> { new OrderByEntity { IsAsc = false, KeyWord = "LastPaidTime", IsMainTable = true } });
            //var b = await GetListAsync(query, query1, 20, 0, "PreUser,PostUser", "Contacts,CustomerDynamicFields");
            //query.WhereAnd((x, y, yy) => true);
            //query1.WhereAnd((z, zz) => true);
            //query0.WhereAnd((x, y, yy, z, zzz) => true);
            query0 = query0.WhereAnd((x, y, yy, d) => d.DynamicFieldID == "7" && d.FieldKey == "310300");
            var bb = GetListAsync(query, 20, 0, "PreUser,PostUser,IntroducerCustomer").Result;
            //var cc = CountAsync(query0, "PreUser,PostUser,CustomerDynamicFields").Result;
        }
Exemple #8
0
        public async void GetAsync()
        {
            var date   = DateTime.Now.AddMonths(-1);
            var query  = new WhereQueryable <CustomerDTO, User, User, CustomerDynamicField, Order>((x, y, yy, d, o) => true);
            var query0 = new WhereQueryable <CustomerDTO, User, User, CustomerDynamicField, Contact>((x, y, yy, d, w) => true);
            var query1 = new WhereJoinQueryable <CustomerDynamicField>((z) => true);
            var query2 = new WhereQueryable <CustomerDTO, User, User, Contact>((x, y, yy, d) => true);
            //var a = await GetListAsync(x => true, (y, yy, z, zzz) => true, 20, 0, "PreUser,PostUser,Contacts,CustomerDynamicFields", new List<OrderByEntity> { new OrderByEntity { IsAsc = false, KeyWord = "LastPaidTime", IsMainTable = true } });
            //var b = await GetListAsync(query, query1, 20, 0, "PreUser,PostUser", "Contacts,CustomerDynamicFields");
            //query.WhereAnd((x, y, yy) => true);
            //query1.WhereAnd((z, zz) => true);
            //query0.WhereAnd((x, y, yy, z, zzz) => true);
            var include = "PreUser,PostUser";

            //include += ",Contacts,'',Contacts";
            //var nickname = "wang(aaa)";
            //query0 = query0.WhereAnd((x, y, yy, d, w) => d.DynamicFieldID == "3");
            //var bb = GetListAsync(query, query1, 20, 0, "PreUser,PostUser,CustomerDynamicFields,Orders", "CustomerDynamicFields").Result;
            //query2 = query2.WhereAnd((x, y, yy, d) => d.Content.Contains("'13321952950'"));
            var bb = GetAsync(query2, query1, include + ",Contacts", "CustomerDynamicFields").Result;

            //var a = await DAL.ExecuteQuerySQLAsync<Customer>("select a.ID,a.CustomerNum,a.LastPaidTime from `customer`  where a.IsSubmit = True");
        }