public virtual Query Translate(QueryBase query)
        {
            var fieldQuery = query as FieldQuery;
            if (fieldQuery.IsNotNull())
            {
                return this.ConvertFieldQuery(fieldQuery);
            }

            var combinedQuery = query as CombinedQuery;
            if (combinedQuery.IsNotNull())
            {
                return this.ConvertCombinedQuery(combinedQuery);
            }

            var fullTextQuery = query as FullTextQuery;
            if (fullTextQuery.IsNull())
            {
                throw new Exception("Unknown query type");
            }

            Assert.IsNotNull(fullTextQuery.Query, "Full text query is empty");
            //Assert.IsNotNullOrEmpty(fullTextQuery.Query.Trim(), "Full text query is empty");

            return this.InternalParse(fullTextQuery.Query);
        }
Exemplo n.º 2
0
        private SearchResultCollection GetSearchHits(QueryBase q, int maxResults)
        {
            if (q == null)
                return null;

            var index = SearchManager.GetIndex(this.Index.Name);
            using (IndexSearchContext context = index.CreateSearchContext())
            {
                var preparedQuery = context.Prepare(q);
                var hits = context.Search(preparedQuery, maxResults);

                if (this.Explain > -1)
                    this.Explanation = context.Explain(preparedQuery, this.Explain);

                return hits.FetchResults(0, Math.Min(hits.Length, maxResults));
            }
        }
		public EnumerableQueryResult(IOrganizationService orgSrv, QueryBase _query)
        {
			position = -1;
			page = 1;
			proxy = orgSrv;

			if (_query is QueryExpression)
			{
				query = (QueryExpression)_query;
				rowsPerPage = ((QueryExpression)_query).PageInfo.Count == 0 ? 5000 : ((QueryExpression)_query).PageInfo.Count;
			}

			if (_query is FetchExpression)
			{
				query = (FetchExpression)_query;
				rowsPerPage = 5000;
				FetchExpression _fetchQuery = (FetchExpression)_query;
				string xmlResult=CreateXml(_fetchQuery.Query, null, page, rowsPerPage);
				_fetchQuery.Query = xmlResult;
			}
        }
Exemplo n.º 4
0
        /// <summary>
        /// Validates the query results.
        /// </summary>
        /// <param name="cache">Cache.</param>
        /// <param name="qry">Query.</param>
        /// <param name="exp">Expected keys.</param>
        /// <param name="keepBinary">Keep binary flag.</param>
        private static void ValidateQueryResults(ICache <int, QueryPerson> cache, QueryBase qry, HashSet <int> exp,
                                                 bool keepBinary)
        {
            if (keepBinary)
            {
                var cache0 = cache.WithKeepBinary <int, IBinaryObject>();

                using (var cursor = cache0.Query(qry))
                {
                    HashSet <int> exp0 = new HashSet <int>(exp);
                    var           all  = new List <ICacheEntry <int, object> >();

                    foreach (var entry in cursor.GetAll())
                    {
                        all.Add(entry);

                        Assert.AreEqual(entry.Key.ToString(), entry.Value.GetField <string>("name"));
                        Assert.AreEqual(entry.Key, entry.Value.GetField <int>("age"));

                        exp0.Remove(entry.Key);
                    }

                    AssertMissingExpectedKeys(exp0, cache, all);
                }

                using (var cursor = cache0.Query(qry))
                {
                    HashSet <int> exp0 = new HashSet <int>(exp);
                    var           all  = new List <ICacheEntry <int, object> >();

                    foreach (var entry in cursor)
                    {
                        all.Add(entry);

                        Assert.AreEqual(entry.Key.ToString(), entry.Value.GetField <string>("name"));
                        Assert.AreEqual(entry.Key, entry.Value.GetField <int>("age"));

                        exp0.Remove(entry.Key);
                    }

                    AssertMissingExpectedKeys(exp0, cache, all);
                }
            }
            else
            {
                using (var cursor = cache.Query(qry))
                {
                    HashSet <int> exp0 = new HashSet <int>(exp);
                    var           all  = new List <ICacheEntry <int, object> >();

                    foreach (var entry in cursor.GetAll())
                    {
                        all.Add(entry);

                        Assert.AreEqual(entry.Key.ToString(), entry.Value.Name);
                        Assert.AreEqual(entry.Key, entry.Value.Age);

                        exp0.Remove(entry.Key);
                    }

                    AssertMissingExpectedKeys(exp0, cache, all);
                }

                using (var cursor = cache.Query(qry))
                {
                    HashSet <int> exp0 = new HashSet <int>(exp);
                    var           all  = new List <ICacheEntry <int, object> >();

                    foreach (var entry in cursor)
                    {
                        all.Add(entry);

                        Assert.AreEqual(entry.Key.ToString(), entry.Value.Name);
                        Assert.AreEqual(entry.Key, entry.Value.Age);

                        exp0.Remove(entry.Key);
                    }

                    AssertMissingExpectedKeys(exp0, cache, all);
                }
            }
        }
 public override QueryExpression CloneQuery(QueryBase query)
 {
     using var service = GetService();
     return(((IEnhancedOrgService)service).CloneQuery(query));
 }
 public virtual List<SkinnyItem> RunQuery(QueryBase query, bool showAllVersions)
 {
     var translator = new QueryTranslator(Index);
     var luceneQuery = translator.Translate(query);
     return RunQuery(luceneQuery, showAllVersions);
 }
Exemplo n.º 7
0
 public SearchHits Search(QueryBase query, ISearchContext context, Sort sort)
 {
     return Search(Prepare(Translate(query), context), sort);
 }
 private MembershipUser FindSingleUserByQuery(QueryBase<User> query)
 {
     var user = _repository.GetOne<User>(query);
     if (user == null) return null;
     return _userTranslator.TranslateToMemberShipUser(user);
 }
Exemplo n.º 9
0
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     var request = new RetrieveMultipleRequest
     {
         Query = query
     };
     return ((RetrieveMultipleResponse) Execute(request)).EntityCollection;
 }
Exemplo n.º 10
0
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     return _connection.RetrieveMultiple(query);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Runs the query.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <returns>The key value pair of the running query.</returns>
 internal virtual KeyValuePair<int, List<SitecoreItem>> RunQuery(QueryBase query)
 {
     var translator = new QueryTranslator(Index);
       Query luceneQuery = translator.Translate(query);
       return this.RunQuery(luceneQuery, 20, 0);
 }
Exemplo n.º 12
0
 /// <summary>Initializes a new instance of the <see cref="T:Microsoft.Crm.Sdk.Messages.RetrieveByResourcesServiceRequest"></see> class.</summary>
 public RetrieveByResourcesServiceRequest()
 {
     this.RequestName = "RetrieveByResourcesService";
     this.ResourceIds = (Guid[])null;
     this.Query       = (QueryBase)null;
 }
Exemplo n.º 13
0
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<JournalInfoEntity></returns>
 public Pager <JournalInfoEntity> GetJournalInfoPageList(QueryBase query)
 {
     return(JournalInfoDataAccess.Instance.GetJournalInfoPageList(query));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 构造查询条件
 /// </summary>
 /// <param name="sb"></param>
 /// <param name="search"></param>
 internal virtual void InitQueryParam(StringBuilder sb, QueryBase search)
 {
     return;
 }
Exemplo n.º 16
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<AuthorInfoEntity></returns>
 public Pager <AuthorInfoEntity> GetAuthorInfoPageList(QueryBase query)
 {
     return(AuthorInfoDataAccess.Instance.GetAuthorInfoPageList(query));
 }
Exemplo n.º 17
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<FlowNodeConditionEntity></returns>
 public Pager <FlowNodeConditionEntity> GetFlowNodeConditionPageList(QueryBase query)
 {
     return(FlowNodeConditionDataAccess.Instance.GetFlowNodeConditionPageList(query));
 }
Exemplo n.º 18
0
 public void QueryBaseIndexTooHigh()
 {
     QueryBase qb = new QueryBase();
     qb.Add(new Query("get spending",
                           new AtomGroup(AtomGroup.LogicalOperator.And, new Atom("spending",
                                               new Variable("customer"),
                                               new Individual("min(5000,EUR)"),
                                               new Individual("previous year")))));
     qb.Get(2);
     Assert.Fail("Should never reach me!");
 }
Exemplo n.º 19
0
        /// <summary>
        /// Retrieves all pages for a given query
        /// </summary>
        public static EntityCollection RetrieveMultipleAllPages(this IOrganizationService service, QueryBase query)
        {
            if (null == service)
            {
                throw new ArgumentNullException("service");
            }
            else if (null == query)
            {
                throw new ArgumentNullException("query");
            }

            var fullResults = service.RetrieveMultiple(query);

            if (!fullResults.MoreRecords)
            {
                return(fullResults);
            }

            var property = query.GetType().GetProperty("PageInfo");

            if (null == property)
            {
                throw new NotSupportedException("The specified query object does not have a PageInfo property defined.");
            }

            var paging = new PagingInfo()
            {
                PageNumber = 1, ReturnTotalRecordCount = false
            };

            property.SetValue(query, paging, null);

            var results = fullResults;

            while (results.MoreRecords)
            {
                //Update the paging information
                paging.PagingCookie = results.PagingCookie;
                paging.PageNumber++;

                //Retrieve the next page
                results = service.RetrieveMultiple(query);

                //Add the results to the full list
                fullResults.Entities.AddRange(results.Entities);
            }

            return(fullResults);
        }
    private OpRes query(GMUser user, ParamMemberInfo p)
    {
        string cmd = "";
        OpRes  res = m_generator.genSearchSql(p, user, ref cmd);

        if (res != OpRes.opres_success)
        {
            return(res);
        }

        if (p.m_countEachPage > 0 && p.m_curPage > 0)
        {
            cmd += string.Format(" LIMIT {0}, {1}", (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage);
            user.totalRecord = user.sqlDb.getRecordCount(TableName.PLAYER_ACCOUNT_XIANXIA,
                                                         p.m_resultCond, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);
        }

        List <Dictionary <string, object> > dataList =
            user.sqlDb.queryList(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA);

        if (dataList == null)
        {
            return(OpRes.op_res_failed);
        }

        // 账号所在数据库ID
        int accServerId = -1;

        if (user.isAdmin() || user.isGeneralAgency())
        {
            // 账号所在数据库ID
            accServerId = DBMgr.getInstance().getSpecialServerId(DbName.DB_ACCOUNT);
        }

        for (int i = 0; i < dataList.Count; i++)
        {
            MemberInfo info = new MemberInfo();
            m_result.Add(info);
            Dictionary <string, object> data = dataList[i];
            info.m_createTime = Convert.ToString(data["createTime"]);
            info.m_acc        = Convert.ToString(data["acc"]);
            info.m_accType    = AccType.ACC_PLAYER;
            info.m_owner      = Convert.ToString(data["creator"]);
            info.m_moneyType  = Convert.ToInt32(data["moneyType"]);
            info.m_state      = Convert.ToInt32(data["state"]);
            if (info.m_state == PlayerState.STATE_IDLE) // 离线
            {
                info.m_money = Convert.ToInt64(data["money"]);
            }
            else // 在线
            {
                if (!(data["moneyOnline"] is DBNull))
                {
                    info.m_money = Convert.ToInt64(data["moneyOnline"]);
                }
            }

            if (!(data["aliasName"] is DBNull))
            {
                info.m_aliasName = Convert.ToString(data["aliasName"]);
            }

            if (!(data["lastLoginDate"] is DBNull))
            {
                info.m_lastLoginDate = Convert.ToDateTime(data["lastLoginDate"]).ToString();
            }

            if (!(data["enable"] is DBNull))
            {
                bool enable = Convert.ToBoolean(data["enable"]);
                if (!enable)
                {
                    info.m_state = PlayerState.STATE_BLOCK;
                }
            }

            if (accServerId >= 0)
            {
                // 查询最后登录IP

                /* Dictionary<string, object> retData = DBMgr.getInstance().getTableData(TableName.PLAYER_ACCOUNT,
                 *                                "acc", info.m_acc, s_fields, accServerId, DbName.DB_ACCOUNT);
                 * if (retData != null)
                 * {
                 *   if (retData.ContainsKey("lastip"))
                 *   {
                 *       info.m_lastLoginIP = Convert.ToString(retData["lastip"]);
                 *   }
                 * }*/
            }

            if (!(data["playerWashRatio"] is DBNull))
            {
                info.m_washRatio = Convert.ToInt32(data["playerWashRatio"]);
            }

            Dictionary <string, object> retData = QueryBase.getPlayerPropertyByAcc(info.m_acc, user, s_fields);
            if (retData != null)
            {
                if (retData.ContainsKey("NotSaveRate"))
                {
                    info.m_isAffectRate = !Convert.ToBoolean(retData["NotSaveRate"]);
                }
                else
                {
                    info.m_isAffectRate = true;
                }
            }
            else
            {
                info.m_isAffectRate = true;
            }
        }

        return(OpRes.opres_success);
    }
Exemplo n.º 21
0
        public static Entity FirstOrDefault(this IOrganizationService service, QueryBase query)
        {
            var coll = service.RetrieveMultiple(query);

            return coll.Entities.FirstOrDefault();
        }
        public override EntityCollection RetrieveMultiple(QueryBase query)
        {
            EntityCollection entities;
            if (RetrieveMultipleFunc != null)
            {
                entities = RetrieveMultipleFunc(Service, query);
            }
            else if (RetrieveMultipleFuncs != null)
            {
                if (RetrieveMultipleCache == null)
                {
                    RetrieveMultipleCache = Service;
                    foreach (var retrievemultiple in RetrieveMultipleFuncs)
                    {
                        RetrieveMultipleCache = new FakeIOrganizationService(RetrieveMultipleCache) {RetrieveMultipleFunc = retrievemultiple};
                    }
                }
                entities = RetrieveMultipleCache.RetrieveMultiple(query);
            }
            else
            {
                if (ExecutionTracingEnabled)
                {
                    var qe = query as QueryExpression;

                    entities = qe == null ? Timer.Time(RetrieveMultipleInternal, query, "RetrieveMultiple {0}: {1}", query) : Timer.Time(RetrieveMultipleInternal, query, "RetrieveMultiple: {2}{0}{1}", Environment.NewLine, qe.GetSqlStatement());
                }
                else
                {
                    entities = Service.RetrieveMultiple(query);
                }
            }
            return entities;
        }
Exemplo n.º 23
0
    public override OpRes makeQuery(object param, GMUser user, QueryCondition queryCond)
    {
        ParamQueryRecharge p = (ParamQueryRecharge)param;

        int          condCount = 0;
        PlatformInfo pinfo     = null;

        if (!string.IsNullOrEmpty(p.m_param))
        {
            switch (p.m_way)
            {
            case QueryWay.by_way0:     //  通过玩家id查询
            {
                int val = -1;
                if (!int.TryParse(p.m_param, out val))
                {
                    return(OpRes.op_res_param_not_valid);
                }
                Dictionary <string, object> ret = QueryBase.getPlayerProperty(val, user, s_field);
                if (ret == null)
                {
                    return(OpRes.op_res_not_found_data);
                }
                if (!ret.ContainsKey("platform"))
                {
                    return(OpRes.op_res_failed);
                }

                // 取玩家ID所在平台
                string platName = Convert.ToString(ret["platform"]);

                if (p.m_platKey == "wechat")
                {
                    platName = p.m_platKey;
                }

                queryCond.addQueryCond("PlayerId", val);

                pinfo = ResMgr.getInstance().getPlatformInfoByName(platName);

                // 获取服务器ID

                /*DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP);
                 * if (dbInfo != null)
                 * {
                 *  queryCond.addQueryCond("ServerId", dbInfo.m_serverId);
                 * }*/
            }
            break;

            case QueryWay.by_way1:     //  通过账号查询
            {
                Dictionary <string, object> ret = QueryBase.getPlayerPropertyByAcc(p.m_param, user, s_field);
                if (ret == null)
                {
                    return(OpRes.op_res_not_found_data);
                }
                if (!ret.ContainsKey("platform"))
                {
                    return(OpRes.op_res_failed);
                }

                // 取玩家账号所在平台,然后从相应的平台去查
                string platName = Convert.ToString(ret["platform"]);
                queryCond.addQueryCond("Account", p.m_param);

                if (p.m_platKey == "wechat")
                {
                    platName = p.m_platKey;
                }

                pinfo = ResMgr.getInstance().getPlatformInfoByName(platName);

                // 获取服务器ID

                /* DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP);
                 * if (dbInfo != null)
                 * {
                 *   queryCond.addQueryCond("ServerId", dbInfo.m_serverId);
                 * }*/
            }
            break;

            case QueryWay.by_way2:     //  通过订单号查询
            {
                pinfo = ResMgr.getInstance().getPlatformInfoByName(p.m_platKey);
                queryCond.addQueryCond("OrderID", p.m_param);
            }
            break;

            default:
            {
                return(OpRes.op_res_failed);
            }
            }
            condCount++;
        }
        else
        {
            pinfo = ResMgr.getInstance().getPlatformInfoByName(p.m_platKey);

            // 获取服务器ID

            /*DbServerInfo dbInfo = ResMgr.getInstance().getDbInfo(user.m_dbIP);
             * if (dbInfo != null)
             * {
             *  queryCond.addQueryCond("ServerId", dbInfo.m_serverId);
             * }*/
        }

        if (pinfo == null)
        {
            return(OpRes.op_res_need_sel_platform);
        }

        if (!m_items.ContainsKey(pinfo.m_engName))
        {
            return(OpRes.op_res_not_found_data);
        }

        m_rbase = m_items[pinfo.m_engName];

        m_platInfo.m_tableName = pinfo.m_tableName;
        m_platInfo.m_platName  = pinfo.m_engName;

        if (queryCond.isExport())
        {
            queryCond.addCond("table", m_platInfo.m_tableName);
            queryCond.addCond("plat", m_platInfo.m_platName);
        }

        if (p.m_time != "")
        {
            DateTime mint = DateTime.Now, maxt = DateTime.Now;
            bool     res = Tool.splitTimeStr(p.m_time, ref mint, ref maxt);
            if (!res)
            {
                return(OpRes.op_res_time_format_error);
            }

            condCount++;
            if (queryCond.isExport())
            {
                queryCond.addCond("time", p.m_time);
            }
            else
            {
                IMongoQuery imq1 = Query.LT("PayTime", BsonValue.Create(maxt));
                IMongoQuery imq2 = Query.GTE("PayTime", BsonValue.Create(mint));
                queryCond.addImq(Query.And(imq1, imq2));
            }
        }

        if (p.m_result > 0)
        {
            queryCond.addQueryCond("Process", p.m_result == 1 ? true : false);
        }
        if (!string.IsNullOrEmpty(p.m_range))
        {
            if (!Tool.isTwoNumValid(p.m_range))
            {
                return(OpRes.op_res_param_not_valid);
            }

            if (queryCond.isExport())
            {
                queryCond.addCond("range", p.m_range);
            }
            else
            {
                List <int> range = new List <int>();
                Tool.parseNumList(p.m_range, range);
                IMongoQuery timq1  = Query.LTE("RMB", BsonValue.Create(range[1]));
                IMongoQuery timq2  = Query.GTE("RMB", BsonValue.Create(range[0]));
                IMongoQuery tmpImq = Query.And(timq1, timq2);
                queryCond.addImq(tmpImq);
            }
        }

        if (pinfo.m_engName == "anysdk" && p.m_channelNo != "")
        {
            if (queryCond.isExport())
            {
                queryCond.addCond("channel", p.m_channelNo);
            }
            else
            {
                queryCond.addImq(Query.EQ("channel_number", p.m_channelNo));
            }
        }

        if (condCount == 0)
        {
            return(OpRes.op_res_need_at_least_one_cond);
        }

        return(OpRes.opres_success);
    }
 private MembershipUserCollection FindUsersByQueryPaged(QueryBase<User> query, int pageIndex, int pageSize, out int totalRecords)
 {
     var users = _repository.GetQueryableList<User>(query)
                 .Skip((pageIndex - 1) * pageSize)
                 .Take(pageSize);
     var userCollection = BuildUserCollectionFromQueryResults(users);
     totalRecords = userCollection.Count;
     return userCollection;
 }
Exemplo n.º 25
0
 public IQueryCursor <ICacheEntry <int, int> > Query(QueryBase qry)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 26
0
 public virtual List<SitecoreItem> RunQuery(QueryBase query)
 {
     return RunQuery(query, false);
 }
Exemplo n.º 27
0
 public IContinuousQueryHandle <ICacheEntry <int, int> > QueryContinuous(ContinuousQuery <int, int> qry, QueryBase initialQry)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 28
0
	private void item_query_done(QueryBase query, bool success)
	{
		query.set_done(true);
		query.set_success(success);
		
		Debug.Log("cmdItemQuery done.");
	}
Exemplo n.º 29
0
 public IFromState From(QueryBase subquery)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 30
0
 /** <inheritDoc /> */
 public IContinuousQueryHandle <ICacheEntry <TK, TV> > QueryContinuous(ContinuousQuery <TK, TV> qry, QueryBase initialQry)
 {
     return(_cache.QueryContinuous(qry, initialQry));
 }
Exemplo n.º 31
0
 /// <summary>Initializes a new instance of the <see cref="T:Microsoft.Xrm.Sdk.Messages.RetrieveMultipleRequest"></see> class.</summary>
 public RetrieveMultipleRequest()
 {
     this.RequestName = "RetrieveMultiple";
     this.Query       = (QueryBase)null;
 }
Exemplo n.º 32
0
 public virtual EntityCollection RetrieveMultiple(QueryBase query)
 {
     CapturedInput.Query = query;
     return RespondWith.EntityCollection;
 }
Exemplo n.º 33
0
 public static void SetQuery(this IQueryNode node, QueryBase container)
 {
     node.Data[QueryKey] = container;
 }
Exemplo n.º 34
0
        public void QueryBase()
        {
            QueryBase qb = new QueryBase();
            Query query1 = new Query("get spending",
                                          new AtomGroup(AtomGroup.LogicalOperator.And, new Atom("spending",
                                                              new Variable("customer"),
                                                              new Individual("min(5000,EUR)"),
                                                              new Individual("previous year"))));
            qb.Add(query1);
            Assert.AreEqual(1, qb.Count, "(1) QueriesCount");

            Query getQ1 = qb.Get("get spending");
            Assert.AreEqual(query1, getQ1, "Get Query Is Equal");
            Assert.IsTrue(((Atom)query1.AtomGroup.Members[0]).IsIntersecting((Atom)getQ1.AtomGroup.Members[0]), "Get Query Is Similar");

            Assert.IsNull(qb.Get("find me if you can"), "Missing query");

            Query query2 = new Query("get earning",
                                          new AtomGroup(AtomGroup.LogicalOperator.And, new Atom("earning",
                                                              new Variable("customer"),
                                                              new Individual("min(99999,EUR)"),
                                                              new Individual("previous year"))));
            qb.Add(query2);
            Assert.AreEqual(2, qb.Count, "(2) QueriesCount");

            qb.Remove(qb.Get(0));
            Assert.AreEqual(1, qb.Count, "(3) QueriesCount");
            Query getQ2 = qb.Get(0);
            Assert.AreEqual(query2, getQ2, "(3) Get Query Is Equal");
            Assert.IsTrue(((Atom)query2.AtomGroup.Members[0]).IsIntersecting((Atom)getQ2.AtomGroup.Members[0]), "(3) Get Query Is Similar");

            qb.Add(new Query("to be killed",
                                  new AtomGroup(AtomGroup.LogicalOperator.And, new Atom("victim",
                                                      new Variable("test"),
                                                      new Individual("whatsoever")))));
            Assert.AreEqual(2, qb.Count, "(4) QueriesCount");

            qb.Remove(qb.Get("to be killed"));
            Assert.AreEqual(1, qb.Count, "(5) QueriesCount");

            qb.Remove(query2);
            Assert.AreEqual(0, qb.Count, "(6) QueriesCount");
        }
Exemplo n.º 35
0
 public IList <Entity> ExecuteRequest(QueryBase query)
 {
     return(_service.RetrieveMultiple(query).Entities.Cast <Entity>().ToList());
 }
 public virtual EntityCollection RetrieveMultiple(QueryBase query)
 {
     return Service.RetrieveMultiple(query);
 }
Exemplo n.º 37
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<PayNoticeEntity></returns>
 public Pager <PayNoticeEntity> GetPayNoticePageList(QueryBase query)
 {
     return(PayNoticeDataAccess.Instance.GetPayNoticePageList(query));
 }
Exemplo n.º 38
0
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     throw new NotImplementedException();
 }
 public MappingContext <T> CreateContext(QueryBase query, MappingDirection dir)
 {
     return(new MappingContext <T>(query, this, dir));
 }
Exemplo n.º 40
0
 internal virtual KeyValuePair<int, List<SitecoreItem>> RunQuery(QueryBase query, int numberOfResults, int pageNumber, string sortField, string sortDirection)
 {
     var translator = new QueryTranslator(Index);
     var luceneQuery = translator.Translate(query);
     return this.RunQuery(luceneQuery, numberOfResults, pageNumber, sortField, sortDirection);
 }
 IMappingContext IMapping.CreateContext(QueryBase query, MappingDirection dir)
 {
     return(this.CreateContext(query, dir));
 }
Exemplo n.º 42
0
        /// <summary>
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public EntityCollection RetrieveMultiple(QueryBase query)
        {
            var call = new CuteCall(MessageName.RetrieveMultiple, new[] { query });

            if (Original != null)
            {
                call.Output = Original.RetrieveMultiple(query);

                Provider.Calls.Add(call);

                return (EntityCollection)call.Output;
            }
            else
            {
                return this.Provider.Calls.Where(x => x.Equals(call)).Select(x => (EntityCollection)x.Output).FirstOrDefault();
            }
        }
Exemplo n.º 43
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<MessageTemplateEntity></returns>
 public Pager <MessageTemplateEntity> GetMessageTemplatePageList(QueryBase query)
 {
     return(MessageTemplateBusProvider.GetMessageTemplatePageList(query));
 }
 private EntityCollection RetrieveMultipleInternal(QueryBase query)
 {
     return Service.RetrieveMultiple(query);
 }
Exemplo n.º 45
0
 /// <summary>
 /// 获取所有数据
 /// </summary>
 /// <returns>Pager<SiteNoticeEntity></returns>
 public Pager <SiteNoticeEntity> GetSiteNoticePageList(QueryBase query)
 {
     return(SiteNoticeBusProvider.GetSiteNoticePageList(query));
 }
 private MembershipUserCollection FindUsersByQuery(QueryBase<User> query)
 {
     var users = _repository.GetQueryableList<User>(query);
     return BuildUserCollectionFromQueryResults(users);
 }
Exemplo n.º 47
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string returl = "";
            string errstr = "";
            bool   isok   = false;
            EGO_Pay_ReceiveLogDAL ReceiveLogDAL = new EGO_Pay_ReceiveLogDAL();
            EGO_Pay_ReceiveLog    ReceiveLog    = new EGO_Pay_ReceiveLog();

            PaygateBLL   paydll     = new PaygateBLL();
            ResultPacket resultpage = paydll.DoVerify(Request.Params);

            string ReceiveData = "c_mid=" + Request.Params["c_mid"] + "&c_order=" + Request.Params["c_order"] + "&c_orderamount=" + Request.Params["c_orderamount"] + "&c_ymd=" + Request.Params["c_ymd"] + "&c_transnum=" + Request.Params["c_transnum"] + "&c_succmark=" + Request.Params["c_succmark"] + "&c_cause=" + Request.Params["c_cause"] + "&c_moneytype=" + Request.Params["c_moneytype"] + "&dealtime=" + Request.Params["dealtime"] + "&c_memo1=" + Request.Params["c_memo1"] + "&c_memo2=" + Request.Params["c_memo2"] + "&c_signstr=" + Request.Params["c_signstr"] + "&c_paygate=" + Request.Params["c_paygate"] + "&c_version=" + Request.Params["c_version"];

            ReceiveLog.TradeType   = "pay";
            ReceiveLog.TradeDesp   = "支付网关通知";
            ReceiveLog.ReceiveData = ReceiveData; //;Request.Params.ToString();
            ReceiveLog.Receivetime = DateTime.Now;
            ReceiveLog.OrderNo     = Request.Params["c_order"];
            ReceiveLogDAL.Insert(ReceiveLog);

            if (resultpage.IsError)
            {
                #region 记录用户操作日志
                //try
                //{
                //    memlog.Status = FC_Members_Log.EnumLogStatus.Fail;
                //    memlog.MemID = 0;// Order_List.MemID;
                //    memlog.MerchantID ="00";
                //    memlog.Memo = "支付网关返回失败失败,描述:" + resultpage.Description;
                //    memlog.SessionID = "";
                //    memlog.IP = GetIP.GetRequestIP();
                //    memlog.RequestSerialNo = "";
                //    memlog.ResultMessage = "支付网关返回失败,描述:" + resultpage.Description;
                //    memlog.TradeMerchantID = "00"; // System.Utils.Common.INI.IniReadvalue("System", "MerchantID", _inifile);
                //    new FC_Members_LogDAL().Insert(memlog);
                //}
                //catch
                //{
                //}

                #endregion

                returl = ReturnUrl(0, resultpage.Description);
            }
            else
            {
                EGO_Order_ListDAL Order_ListDAL = new EGO_Order_ListDAL();
                EGO_Order_List    Order_List    = Order_ListDAL.GetModel(Request["c_order"]);
                if (Order_List == null)
                {
                    returl = ReturnUrl(0, "充值订单信息未找到");
                }
                else
                {
                    decimal realPayMoney = Order_List.TotalMoney - Order_List.CouponMoney - Order_List.AccountMoney - Order_List.RebatMoney;
                    if (!(Order_List.Status == EGO_Order_List.EnumOrderStatus.Paying || Order_List.Status == EGO_Order_List.EnumOrderStatus.UserCancel))
                    {
                        returl = ReturnUrl(0, "支付订单状态错误");
                    }
                    if (Order_List.ChipinCodeList != "")
                    {
                        returl = ReturnUrl(0, "支付订单已分配过号码了");
                    }
                    else if (Order_List.BuyerPhone != Request["c_memo1"])
                    {
                        returl = ReturnUrl(0, "订单信息与网关信息不符");
                    }
                    else if (realPayMoney != decimal.Parse(Request["c_orderamount"]))
                    {
                        returl = ReturnUrl(0, "订单金额不一致,数据库:" + realPayMoney.ToString() + ",通知:" + Request["c_orderamount"]);
                    }
                    else
                    {
                        //页面输出,表示网关已通知成功
                        returl = ReturnUrl(1, INITools.GetIniKeyValue("paygate", "handleurl_ego"));

                        DataAccess da = new DataAccess();
                        da.BeginTransaction();
                        try
                        {
                            //网关支付成功
                            Order_List.Status              = EGO_Order_List.EnumOrderStatus.Payed;
                            Order_List.Pay_ResponseTime    = QueryBase.GetDataBaseDate();
                            Order_List.PayGate_Pay_OrderNo = Request["c_transnum"].ToString();
                            int yy = Order_ListDAL.UpdateForPayResult(Order_List, da);

                            if (yy != 1)
                            {
                                returl = ReturnUrl(0, resultpage.Description);
                            }
                            else
                            {
                                /*充值成功,增加充值成功trade_log,等待服务分配chipinCode*/
                                try
                                {
                                    EGO_Trade_LogDAL Trade_LogDAL = new EGO_Trade_LogDAL();
                                    EGO_Trade_Log    model        = new EGO_Trade_Log();
                                    model.OrderID        = Order_List.ID;
                                    model.ProductID      = Order_List.ProductID;
                                    model.PeriodNum      = Order_List.PeriodNum;
                                    model.TradeType      = EnumTradetype.Pay;
                                    model.BuyerPhone     = Order_List.BuyerPhone;
                                    model.MoneyDirect    = EnumMoneydirect.In;
                                    model.BalanceChanged = realPayMoney;
                                    model.TradeOrderNo   = Request["c_transnum"].ToString();
                                    model.CreateTime     = DateTime.Now;
                                    model.PaygateType    = Order_List.PayGateType;
                                    model.Paygate        = Order_List.PayGate;
                                    Trade_LogDAL.Insert(model, da);

                                    isok = true;
                                    da.Commit();

                                    BaseUDPClient udp = new BaseUDPClient();
                                    udp.Command    = 5;
                                    udp.EncryptKey = ConfigurationManager.AppSettings["UDPSecretKey_5"];
                                    udp.RemoteIP   = ConfigurationManager.AppSettings["UDPServerIP_5"];
                                    udp.RemotePort = int.Parse(ConfigurationManager.AppSettings["UDPServerPort_5"]);
                                    udp.Execute();
                                }
                                catch (Exception exx)
                                {
                                    isok   = false;
                                    errstr = exx.ToString();
                                }
                            }
                        }
                        catch (Exception edd)
                        {
                            da.Rollback();
                            //向综合后台增加日志
                            errstr = "网关通知成功,执行后续操作异常,描述:" + edd.ToString();
                        }
                    }
                }
            }

            ReceiveLog.ResponseData = returl;
            ReceiveLog.ResponseTime = DateTime.Now;
            if (resultpage.IsError)
            {
                ReceiveLog.ResultCode = "0";
            }
            else
            {
                ReceiveLog.ResultCode = "1";
            }
            if (isok)
            {
                ReceiveLog.ResultMessage = "通知成功,发起充值成功";
            }
            else
            {
                ReceiveLog.ResultMessage = "通知成功,增加充值日志异常,描述:" + errstr;
                //向综合后台增加日志
                ProjectLogBLL.NotifyProjectLog("通知成功,增加充值日志异常,描述:" + errstr, "pay_result_err");
            }
            ReceiveLogDAL.Update(ReceiveLog);

            Response.Write(returl);
        }
Exemplo n.º 48
0
 public SearchHits Search(QueryBase query, Sort sort)
 {
     return Search(query, SearchContext.Empty, sort);
 }
 public static EntityCollection RetrieveMultiple(this IOrganizationService service, QueryBase query)
 {
     return(Execute <RetrieveMultipleResponse, EntityCollection>(service,
                                                                 new RetrieveMultipleRequest
     {
         Query = query
     },
                                                                 response => response.EntityCollection));
 }
Exemplo n.º 50
0
        /// <summary>
        /// Loads a rule base. The working memory is reset (all facts are lost).
        /// </summary>
        /// <param name="adapter">The Adapter used to read the rule base.</param>
        /// <param name="businessObjectsBinder">The business object binder that the engine must use.</param>
        /// <param name="processPerformatives">Immediatly process the performative actions (assert, retract) found in the rule base.</param>
        /// <remarks>
        /// The adapter will be disposed at the end of the method's execution.
        /// </remarks>
        /// <see cref="NxBRE.InferenceEngine.IO.IRuleBaseAdapter"/>
        public void LoadRuleBase(IRuleBaseAdapter adapter, IBinder businessObjectsBinder, bool processPerformatives)
        {
            if (Logger.IsInferenceEngineInformation) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Information, 0, "NxBRE Inference Engine Rule Base Loading Started, using adapter " + adapter.GetType().FullName);

            using(adapter) {
                // reset the WM
                WM.PrepareInitialization();

                // sets the Binder
                Binder = businessObjectsBinder;

                // and pass it to the adapter if needed
                if (Binder != null) adapter.Binder = Binder;

                // currently only forward chaining is supported
                direction = adapter.Direction;
                if (direction == "backward") {
                    throw new BREException("NxBRE does not support backward chaining");
                }
                else if (direction == String.Empty) {
                    if (Logger.IsInferenceEngineWarning) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Warning, 0, "NxBRE interprets no-direction directive as forward chaining.");
                }
                else if (direction == "bidirectional") {
                    if (Logger.IsInferenceEngineWarning) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Warning, 0, "NxBRE interprets bidirectional as forward chaining.");
                }
                else if (direction != "forward") {
                    throw new BREException("NxBRE does not support direction: " + direction);
                }

                // sets the label
                label = adapter.Label;

                // load the Equivalents and IntegrityQueries if the adapter supports it
                IExtendedRuleBaseAdapter extendedAdapter = null;
                if (adapter is IExtendedRuleBaseAdapter) {
                    extendedAdapter = (IExtendedRuleBaseAdapter)adapter;

                    equivalents = extendedAdapter.Equivalents;
                    if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded " + equivalents.Count + " Equivalents");

                    integrityQueries = extendedAdapter.IntegrityQueries;
                    if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded " + integrityQueries.Count + " IntegrityQueries");
                }
                else {
                    equivalents = new List<Equivalent>(0);
                    integrityQueries = new List<Query>(0);
                }

                // instantiate the different storage
                ib = new ImplicationBase();
                qb = new QueryBase();

                // instantiate the related managers
                mm = new MutexManager(IB);
                pm = new PreconditionManager(IB);

                // load queries
                foreach(Query query in adapter.Queries) QB.Add(query);
                if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded " + QB.Count + " Queries");

                // load implications
                foreach(Implication implication in adapter.Implications) IB.Add(implication);
                if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded " + IB.Count + " Implications\n");

                // load mutexes
                mm.AnalyzeImplications();
                if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded Mutexes\n" + mm.ToString());

                // load preconditions
                pm.AnalyzeImplications();
                if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded Preconditions\n" + pm.ToString());

                initialized = true;

                // load facts assertions
                performativeAssertions = new List<Fact>((extendedAdapter!=null)?extendedAdapter.Assertions:adapter.Facts);
                //TODO FR-1546485: load facts retractions
                if (processPerformatives) ProcessPerfomatives();
                if (Logger.IsInferenceEngineVerbose) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Loaded " + WM.FB.Count + " Facts");

                // finish the WM init
                WM.FinishInitialization();

            } //end: using adapter

            if (Logger.IsInferenceEngineInformation) Logger.InferenceEngineSource.TraceEvent(TraceEventType.Information, 0, "NxBRE Inference Engine Rule Base Loading Finished");
        }
Exemplo n.º 51
0
        /** <inheritdoc /> */
        public IContinuousQueryHandle <ICacheEntry <TK, TV> > QueryContinuous(ContinuousQuery <TK, TV> qry, QueryBase initialQry)
        {
            IgniteArgumentCheck.NotNull(qry, "qry");
            IgniteArgumentCheck.NotNull(initialQry, "initialQry");

            return(QueryContinuousImpl(qry, initialQry));
        }
Exemplo n.º 52
0
 public BusinessEntityCollection RetrieveMultiple( QueryBase query )
 {
     return m_service.RetrieveMultiple( query );
 }
Exemplo n.º 53
0
 internal virtual KeyValuePair<int, List<SitecoreItem>> RunQuery(QueryBase query, int numberOfResults)
 {
     var translator = new QueryTranslator(Index);
     var luceneQuery = translator.Translate(query);
     return this.RunQuery(luceneQuery, numberOfResults, 0);
 }
 public virtual List<SkinnyItem> RunQuery(QueryBase query)
 {
     return RunQuery(query, false);
 }
 public override int GetRecordsCount(QueryBase query)
 {
     using var service = GetService();
     return(((IEnhancedOrgService)service).GetRecordsCount(query));
 }
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     return(orgService.RetrieveMultiple(query));
 }
 public override int GetPagesCount(QueryBase query, int pageSize = 5000)
 {
     using var service = GetService();
     return(((IEnhancedOrgService)service).GetPagesCount(query, pageSize));
 }
Exemplo n.º 58
0
 /** <inheritDoc /> */
 public IQueryCursor <ICacheEntry <TK, TV> > Query(QueryBase qry)
 {
     return(_cache.Query(qry));
 }
Exemplo n.º 59
0
 public EntityCollection RetrieveMultiple(QueryBase query)
 {
     return this.service.RetrieveMultiple(query);
 }