Beispiel #1
0
        public List <SPPaymentInfoEntity> FindAllNotSendData(SPChannelEntity channelId, SPClientEntity clientId, DateTime startdate, DateTime endDate, int maxDataCount)
        {
            var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>();


            if (channelId != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CHANNELID.Eq(channelId));
            }

            if (clientId != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CLIENTID.Eq(clientId));
            }

            queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startdate.Date));

            queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.AddDays(1).Date));

            queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(false));
            queryBuilder.AddWhereClause(PROPERTY_SUCESSSTOSEND.Eq(false));

            queryBuilder.SetMaxResults(maxDataCount);

            return(this.FindListByQueryBuilder(queryBuilder));
        }
Beispiel #2
0
        public List <SPPaymentInfoEntity> FindAllByOrderByAndClientIDAndDate(SPClientEntity clientEntity, DateTime startDate, DateTime endDate, string sortFieldName, bool isDesc, int pageIndex, int limit, out int recordCount)
        {
            var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>();

            queryBuilder.AddWhereClause(PROPERTY_CLIENTID.Eq(clientEntity));


            if (startDate != DateTime.MinValue)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDate.Date));
            }


            if (endDate != DateTime.MinValue)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.AddDays(1).Date));
            }

            AddDefaultOrderByToQueryGenerator(sortFieldName, isDesc, queryBuilder);

            queryBuilder.SetFirstResult((pageIndex - 1) * limit);

            queryBuilder.SetMaxResults(limit);

            return(FindListByPageByQueryBuilder(queryBuilder, out recordCount));
        }
Beispiel #3
0
        public List <SPPaymentInfoEntity> FindAllDataTableByOrderByAndCleintIDAndChanneLIDAndDate(SPChannelEntity channelId, SPClientEntity clientId, DateTime startDateTime, DateTime enddateTime, string dataType, string sortFieldName, bool isDesc, int pageIndex, int pageSize, out int recordCount)
        {
            var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>();

            if (channelId != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CHANNELID.Eq(channelId));
            }

            if (clientId != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CLIENTID.Eq(clientId));
            }


            if (startDateTime == DateTime.MinValue)
            {
                startDateTime = DateTime.Now;
            }


            if (enddateTime == DateTime.MinValue)
            {
                enddateTime = DateTime.Now;
            }

            queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDateTime.Date));

            queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(enddateTime.AddDays(1).Date));

            switch (dataType)
            {
            case "All":
                break;

            case "Intercept":
                queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(true));
                break;

            case "Down":
                queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(false));
                break;

            case "DownSycn":
                queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(false));
                queryBuilder.AddWhereClause(PROPERTY_SUCESSSTOSEND.Eq(true));
                break;
            }

            AddDefaultOrderByToQueryGenerator(sortFieldName, isDesc, queryBuilder);

            queryBuilder.SetFirstResult((pageIndex - 1) * pageSize);

            queryBuilder.SetMaxResults(pageSize);

            return(FindListByPageByQueryBuilder(queryBuilder, out recordCount));
        }
        public SPInterceptRateEntity FindRateByChannelIdAndClinetId(int channelId, int clientId)
        {
            NHibernateDynamicQueryGenerator <SPInterceptRateEntity> queryGenerator = this.GetNewQueryBuilder();

            queryGenerator.AddWhereClause(PROPERTY_CHANNELID.Eq(channelId));

            queryGenerator.AddWhereClause(PROPERTY_CLIENTID.Eq(clientId));

            return(this.FindSingleEntityByQueryBuilder(queryGenerator));
        }
        public SPDayReportEntity FindReportByChannelIDChannelIDAndDate(int channelId, int clientId, DateTime date)
        {
            NHibernateDynamicQueryGenerator <SPDayReportEntity> queryGenerator = this.GetNewQueryBuilder();

            queryGenerator.AddWhereClause(PROPERTY_CHANNELID.Eq(channelId));
            queryGenerator.AddWhereClause(PROPERTY_CLIENTID.Eq(clientId));
            queryGenerator.AddWhereClause(PROPERTY_REPORTDATE.Eq(new DateTime(date.Year, date.Month, date.Day)));

            return(this.FindSingleEntityByQueryBuilder(queryGenerator));
        }
Beispiel #6
0
        public List <SPSendClientParamsEntity> FindAllByOrderByAndClientID(string sortFieldName, bool isDesc, int pageIndex, int limit, SPClientEntity client, out int recordCount)
        {
            NHibernateDynamicQueryGenerator <SPSendClientParamsEntity> queryGenerator = this.GetNewQueryBuilder();

            queryGenerator.AddWhereClause(PROPERTY_CLIENTID.Eq(client));

            AddDefaultOrderByToQueryGenerator(sortFieldName, isDesc, queryGenerator);

            return(this.FindListByPageByQueryBuilder(queryGenerator, pageIndex, limit, out recordCount));
        }
        public static ICriterion Query_ClientAssignedCode(SPSClientEntity client, Property codeProperty)
        {
            DetachedCriteria subQuery = DetachedCriteria.For(typeof(SPClientCodeRelationEntity));

            subQuery.CreateAlias(SPClientCodeRelationEntity.PROPERTY_NAME_CODEID, PROPERTY_CODEID_ALIAS_NAME);

            subQuery.SetProjection(PROPERTY_CODEID_ID.CriterionProperty);

            subQuery.Add(PROPERTY_CLIENTID.Eq(client));

            return(Subqueries.PropertyIn(codeProperty.PropertyName, subQuery));
        }
Beispiel #8
0
        public List <SPSendClientParamsEntity> GetAllEnableParams(SPClientEntity spClientEntity)
        {
            NHibernateDynamicQueryGenerator <SPSendClientParamsEntity> queryGenerator = this.GetNewQueryBuilder();

            queryGenerator.AddWhereClause(PROPERTY_CLIENTID.Eq(spClientEntity));

            queryGenerator.AddWhereClause(PROPERTY_ISENABLE.Eq(true));

            queryGenerator.AddOrderBy(PROPERTY_ID.Desc());

            return(this.FindListByQueryBuilder(queryGenerator));
        }
Beispiel #9
0
        public List <SPPaymentInfoEntity> FindAllByOrderByAndCleintIDAndChanneLIDAndDateAndProviceNoIntercept1(SPClientEntity clientEntity, int spClientGroupId, DateTime startDate, DateTime endDate, string province, string city, string phone, string sortFieldName, bool isdesc, int pageIndex, int limit, out int recordCount)
        {
            var queryBuilder = new NHibernateDynamicQueryGenerator <SPPaymentInfoEntity>();

            queryBuilder.AddWhereClause(PROPERTY_CLIENTID.Eq(clientEntity));


            if (startDate != DateTime.MinValue)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDate.Date));
            }


            if (endDate != DateTime.MinValue)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.AddDays(1).Date));
            }

            if (!string.IsNullOrEmpty(province))
            {
                if (province.Equals("NULL"))
                {
                    queryBuilder.AddWhereClause(PROPERTY_PROVINCE.Eq(""));
                }
                else
                {
                    queryBuilder.AddWhereClause(PROPERTY_PROVINCE.Eq(province));
                }
            }

            if (!string.IsNullOrEmpty(city))
            {
                queryBuilder.AddWhereClause(PROPERTY_CITY.Eq(city));
            }

            if (!string.IsNullOrEmpty(phone))
            {
                queryBuilder.AddWhereClause(PROPERTY_MOBILENUMBER.Like(phone, MatchMode.Start));
            }

            queryBuilder.AddWhereClause(PROPERTY_ISINTERCEPT.Eq(false));

            queryBuilder.AddWhereClause(PROPERTY_CLIENTGROUPID.Eq(spClientGroupId));

            AddDefaultOrderByToQueryGenerator(sortFieldName, isdesc, queryBuilder);

            queryBuilder.SetFirstResult((pageIndex - 1) * limit);

            queryBuilder.SetMaxResults(limit);

            return(FindListByPageByQueryBuilder(queryBuilder, out recordCount));
        }
        public List <SPDayReportEntity> QueryReport(DateTime startDate, DateTime endDate, SPSClientEntity clientEntity)
        {
            NHibernateDynamicQueryGenerator <SPDayReportEntity> dynamicQueryGenerator = this.GetNewQueryBuilder();

            //指定查询条件
            dynamicQueryGenerator.AddWhereClause(PROPERTY_REPORTDATE.Ge(startDate.Date));

            dynamicQueryGenerator.AddWhereClause(PROPERTY_REPORTDATE.Lt(endDate.AddDays(1).Date));

            dynamicQueryGenerator.AddWhereClause(PROPERTY_CLIENTID.Eq(clientEntity));

            return(this.FindListByQueryBuilder(dynamicQueryGenerator));
        }
        private NHibernateDynamicQueryGenerator <SPRecordEntity> BuilderQueryGenerator(SPChannelEntity channel, SPCodeEntity code,
                                                                                       SPSClientEntity client, string dataType,
                                                                                       DateTime?startDate, DateTime?endDate, List <QueryFilter> filters,
                                                                                       string orderByColumnName, bool isDesc)
        {
            var queryBuilder = new NHibernateDynamicQueryGenerator <SPRecordEntity>();

            if (channel != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CHANNELID.Eq(channel));
            }

            if (code != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CODEID.Eq(code));
            }

            if (client != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CLIENTID.Eq(client));
            }

            DayReportType reportType = (DayReportType)Enum.Parse(typeof(DayReportType), dataType);

            SetReportTypeFilter(queryBuilder, reportType);

            if (startDate != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Ge(startDate.Value.Date));
            }

            if (endDate != null)
            {
                queryBuilder.AddWhereClause(PROPERTY_CREATEDATE.Lt(endDate.Value.Date.AddDays(1)));
            }


            AddQueryFiltersToQueryGenerator(filters, queryBuilder);

            AddDefaultOrderByToQueryGenerator(orderByColumnName, isDesc, queryBuilder);
            return(queryBuilder);
        }