Пример #1
0
        public DataTable QueryGroupBuyingTicket(GroupBuyingTicketQueryFilter filter, out int totalCount)
        {
            PagingInfoEntity pagingEntity = new PagingInfoEntity();

            pagingEntity.SortField     = filter.PagingInfo.SortBy;
            pagingEntity.MaximumRows   = filter.PagingInfo.PageSize;
            pagingEntity.StartRowIndex = filter.PagingInfo.PageIndex * filter.PagingInfo.PageSize;

            var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryGroupBuyingTicket");

            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, "m.SysNo DESC"))
            {
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "g.GroupBuyingTitle", DbType.String, "@GroupBuyingTitle",
                                                             QueryConditionOperatorType.Like, filter.GroupBuyingTitle);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "s.Name", DbType.String, "@UsedStoreName",
                                                             QueryConditionOperatorType.Like, filter.UsedStoreName);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.TicketID", DbType.String, "@TicketID",
                                                             QueryConditionOperatorType.Equal, filter.TicketID);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.CreateDate", DbType.DateTime, "@CreateDateFrom",
                                                             QueryConditionOperatorType.MoreThanOrEqual, filter.CreateDateFrom);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.CreateDate", DbType.DateTime, "@CreateDateTo",
                                                             QueryConditionOperatorType.LessThanOrEqual, filter.CreateDateTo);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.UsedDate", DbType.DateTime, "@UsedDateFrom",
                                                             QueryConditionOperatorType.MoreThanOrEqual, filter.UsedDateFrom);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.UsedDate", DbType.DateTime, "@UsedDateTo",
                                                             QueryConditionOperatorType.LessThanOrEqual, filter.UsedDateTo);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.Status", DbType.Int32, "@Status",
                                                             QueryConditionOperatorType.Equal, filter.Status);

                sqlBuilder.ConditionConstructor.AddCondition(
                    QueryConditionRelationType.AND,
                    "m.CompanyCode",
                    DbType.AnsiStringFixedLength,
                    "@CompanyCode",
                    QueryConditionOperatorType.Equal,
                    filter.CompanyCode);

                cmd.CommandText = sqlBuilder.BuildQuerySql();
                var dt = cmd.ExecuteDataTable(new EnumColumnList {
                    { "Status", typeof(GroupBuyingTicketStatus) }
                });

                totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
                return(dt);
            }
        }
Пример #2
0
        public virtual QueryResult QueryGroupBuyingTicket(GroupBuyingTicketQueryFilter filter)
        {
            int totalCount;
            var dt = ObjectFactory <IGroupBuyingQueryDA> .Instance.QueryGroupBuyingTicket(filter, out totalCount);

            return(new QueryResult()
            {
                Data = dt,
                TotalCount = totalCount
            });
        }