Пример #1
1
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.VDM_VCMSLevelDBO dbo = new VDM_VCMSLevelDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = dbo.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = dbo.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = dbo.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = dbo.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Build data query from the specified <paramref name="queryType"/>
        /// </summary>
        /// <param name="queryType">
        /// The query type.
        /// </param>
        /// <param name="structureRetrievalManager">
        /// The structure retrieval manager.
        /// </param>
        /// <returns>
        /// The data query from the specified <paramref name="queryType"/>
        /// </returns>
        public IList<IDataQuery> BuildDataQuery(
            QueryType queryType, ISdmxObjectRetrievalManager structureRetrievalManager)
        {
            IList<IDataQuery> returnList = new List<IDataQuery>();

            foreach (DataWhereType dataWhere in queryType.DataWhere)
            {
                // TODO java 0.9.9 no support for default limit. Opened : http://www.metadatatechnology.com/mantis/view.php?id=1427
                DataQueryProcessor dataQueryProcessor = null;

                if (queryType.defaultLimit.HasValue && queryType.defaultLimit.Value < int.MaxValue)
                {
                    int limit = decimal.ToInt32(queryType.defaultLimit.Value);
                    dataQueryProcessor = new DataQueryProcessor(limit);
                }
                else
                {
                    dataQueryProcessor = new DataQueryProcessor();
                }

                returnList.Add(dataQueryProcessor.BuildDataQuery(dataWhere, structureRetrievalManager));
            }

            return returnList;
        }
Пример #3
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            #region
            VDS_ALO_DISRECORD_TMP_DBO ALOM = new VDS_ALO_DISRECORD_TMP_DBO(ref USEDB);

            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.GetDISRECORD_TmpSchema:
                        Dt = ALOM.GetDISRECORD_TmpSchema(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            #endregion
        }
Пример #4
0
 public Table(string com, NpgsqlConnection con,
     QueryType t = QueryType.Select)
 {
     command = com;
     connection = con;
     type = t;
 }
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.RemoveDataDetail dbo = new RemoveDataDetail(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = dbo.doQueryAll();
                        break;
                    
                    case QueryType.ID:
                        Dt = dbo.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = dbo.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.SYS_OrganizationDBO Organization = new SYS_OrganizationDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = Organization.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = Organization.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = Organization.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = Organization.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.MKT_PurchaseCardNondissStDBO dbo = new MKT_PurchaseCardNondissStDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = dbo.doQueryAll();
                        break;
                    case QueryType.ID:
                        Dt = dbo.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = dbo.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
 public void QueryLog(IQueryable linqQuery)
 {
     _querytype = QueryType.LINQ;
     _linqQuery = linqQuery.Expression.ToString();
     _StoreSQL = ToTraceString(linqQuery);
     CreateLogEntry();
 }
Пример #9
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            #region
            VDS_ALO_POSOURCE_NO_TMP_DBO ALOM = new VDS_ALO_POSOURCE_NO_TMP_DBO(ref USEDB);

            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.CheckCurrentItemStatus:
                        Dt = ALOM.doCheckCurrentItemStatus(ParameterList);
                        break;
                    case QueryType.GetPOSOURCE_NO_TmpSchema:
                        Dt = ALOM.GetPOSOURCE_NO_TmpSchema(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            #endregion
        }
Пример #10
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            #region
            VDS_CRM_ORDER_TMP_DBO CRM_DBO = new VDS_CRM_ORDER_TMP_DBO(ref USEDB);

            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.GetCRMOrder_TmpSchema:
                        Dt = CRM_DBO.GetORDER_TmpSchema(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
            #endregion
        }
Пример #11
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            DBO.VDS_CRM_RECORD_MAINDBO VCRM = new VDS_CRM_RECORD_MAINDBO(ref USEDB);
            DBO.VDS_CRM_RECORD_DETLDBO VCRD = new VDS_CRM_RECORD_DETLDBO(ref USEDB);

            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.QueryLastThreeCRMRecord:
                        Dt = VCRM.DO_CRM011_QUERY_RECORD_THREE(ParameterList);
                        break;
                    case QueryType.CRM011_DETL_SCHEMA:
                        Dt = VCRD.DO_CRM011_DETAIL_SCHEMA(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
        }
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.SYS_ROLEPROGAUTHRELDBO RoleProgauthrel = new SYS_ROLEPROGAUTHRELDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = RoleProgauthrel.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = RoleProgauthrel.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = RoleProgauthrel.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = RoleProgauthrel.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #13
0
	    public Query(QueryType type, long token, ReqlAst term, OptArgs globalOptions)
		{
			this.Type = type;
			this.Token = token;
			this.Term = term;
			this.GlobalOptions = globalOptions;
		}
Пример #14
0
 /// <summary>
 /// 查询类型转化成字符串
 /// </summary>
 /// <param name="type">查询类型</param>
 /// <returns>查询类型字符串</returns>
 public static string QueryTypeToString(QueryType type)
 {
     string s = "INSURANCE";
     switch (type)
     {
         case QueryType.INSURANCE:
             s = "INSURANCE";
             break;
         case QueryType.QEONYCARD:
             s = "QEONYCARD";
             break;
         case QueryType.ASSET:
             s = "ASSET";
             break;
         case QueryType.NETSITE:
             s = "NETSITE";
             break;
         case QueryType.EXCHANGE_CH:
             s = "EXCHANGE_CH";
             break;
         case QueryType.EXCHANGE_EN:
             s = "EXCHANGE_EN";
             break;
         default:
             s = "INSURANCE";
             break;
     }
     return s;
 }
Пример #15
0
        /// <summary>
        /// Creates a LinqLambdaType given the body type and parameter types.
        /// </summary>
        /// <param name="bodyType">Type of the lambda body.</param>
        /// <param name="parameterTypes">Collection of lambda parameter types.</param>
        /// <returns>LinqLambdaType with given body and parameter types.</returns>
        public static LinqLambdaType Lambda(QueryType bodyType, IEnumerable<QueryType> parameterTypes)
        {
            ExceptionUtilities.CheckArgumentNotNull(bodyType, "bodyType");
            ExceptionUtilities.CheckArgumentNotNull(parameterTypes, "parameterTypes");

            return new LinqLambdaType(bodyType, parameterTypes, bodyType.EvaluationStrategy);
        }
Пример #16
0
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.PUR_PurchaseOrderDBO dbo = new PUR_PurchaseOrderDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    //case QueryType.ALL:
                    //    Dt = dbo.doQueryAll();
                    //    break;
                    //case QueryType.CODE:
                    //    Dt = dbo.doQueryByCode(ParameterList);
                    //    break;
                    case QueryType.PK:
                        Dt = dbo.GetMasterByPK(ParameterList);
                        break;
                    case QueryType.Where1:
                        Dt = dbo.GetMainByWhere1(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #17
0
 /// <summary>
 /// Инициализирует новый запрос
 /// </summary>
 /// <param name="type">Тип запроса</param>
 /// <param name="sql">Текст запроса</param>
 /// <param name="storedProcedure">Является ли хранимой процедурой</param>
 /// <param name="parameters">Параметры запроса</param>
 public Query(QueryType type, string sql, bool storedProcedure, params DbParam[] parameters)
 {
     Sql = sql;
     Parameters = parameters;
     Type = type;
     StoredProcedure = storedProcedure;
 }
Пример #18
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            DBO.VDS_CGD36M_DBO CodeFileM = new VDS_CGD36M_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {                   
                    case QueryType.CODE:
                        Dt = CodeFileM.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = CodeFileM.doQueryByID(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static Uri BuildQuery(QueryType type,string url,string query)
        {
            UriBuilder bldr = new UriBuilder(url);
            switch (type)
            {
                case QueryType.Search:
                    string restQuery = "";

                    if (url.EndsWith("/") != true)
                    {
                        restQuery = "/";
                    }

                    restQuery += "_api/search/query";

                    bldr.Path += restQuery;

                    bldr.Query = "querytext='" + query + "'";
                    break;
                case QueryType.Lists:
                    break;
                default:
                    break;
            }
            return bldr.Uri;
        }
Пример #20
0
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            VDS_ALO_DIS_PATTERN_DBO ALOM = new VDS_ALO_DIS_PATTERN_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = ALOM.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = ALOM.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = ALOM.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = ALOM.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
        }
Пример #21
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            CGD.VDS_CGD_PICK_LIST_PRINT_DBO CGDM = new VDS_CGD_PICK_LIST_PRINT_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.REPORT:
                        Dt = CGDM.QueryPickList(ParameterList);
                        break;
                   
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #22
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            CGD.VDS_CGD41_DBO CGDM = new VDS_CGD41_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.GetPickBatch:
                        Dt = CGDM.GetPickBatch(ParameterList);
                        break;

                    case QueryType.Label:
                        Dt = CGDM.ExpLabelData(ParameterList);
                        break;

                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
           // CGD.VDS_ALO_ST_ACCEPT_MAIN_DBO CGDM = new VDS_ALO_ST_ACCEPT_MAIN_DBO(ref USEDB);

            CGD.VDS_CGD07_DBO CGDM = new VDS_CGD07_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.GetAloItemSumQty:
                        Dt = CGDM.GetAloItemSumQty(ParameterList);
                        break;                   

                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #24
0
        /// <summary>
        /// Get IPHostEntry for given domainName.
        /// </summary>
        /// <param name="domainName">domainName</param>
        /// <param name="queryType">QueryType.Address or QueryType.MailExchange</param>
        /// <param name="dnsServers">dnsServers</param>
        /// <returns></returns>
        public static IPHostEntry GetIPHostEntry(string domainName, QueryType queryType, string[] dnsServers)
        {
            if (String.IsNullOrEmpty(domainName))
            {
                throw new ArgumentException("Domain name is empty.", "domainName");
            }
            DnsServers.Clear();
            if (dnsServers != null)
            {
                foreach (string dnsServer in dnsServers)
                {
                    DnsServers.Add(IPAddress.Parse(dnsServer));
                }
            }
            DnsServers.AddRange(RootDnsServers);

            int retry = 0;
            while (retry < 10)
            {
                foreach (IPAddress dnsServer in DnsServers)
                {
                    IPHostEntry ip = GetIPHostEntry(domainName, queryType, dnsServer);
                    if (ip != null)
                    {
                        return ip;
                    }
                }
                retry++;
            }
            return null;
        }
Пример #25
0
        public DataTable QuerySwitchLine(QueryType QT, ArrayList ParameterList)
        {
            DBO.VDS_ITM_PERIOD_MAIN_DBO STDM = new VDS_ITM_PERIOD_MAIN_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ITEM_PERIOD:
                        Dt = STDM.doQueryByFind(ParameterList);
                        break;

                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #26
0
 public SQLWriter(Servers server, QueryType queryType, String tableName, int buffSize = 100)
 {
     m_queryType = queryType;
     m_buffSize = buffSize;
     m_server = server;
     m_tableName = tableName;
 }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueryBuilder"/> class.
        /// </summary>
        /// <param name="type">The requested <see cref="QueryType"/>.</param>
        internal QueryBuilder(QueryType type)
        {
            this.type = type;
            builder = new StringBuilder();

            Init();
        }
Пример #28
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            DBO.STD_IMPORT_DBO STDM = new STD_IMPORT_DBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.CHAN_NO:
                        Dt = STDM.doQueryByChanNo(ParameterList);
                        break;
                   
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public string StQuerySwitch(QueryType QT, ArrayList ParameterList, out string errMsg)
        {
            CGD.VDS_CGD23_DBO CGDM = new VDS_CGD23_DBO(ref USEDB);
            string str;
            string ErrMsg = "";

            try
            {
                switch (QT)
                {
                    case QueryType.GetMaxPickBatch:
                        str = CGDM.GetMaxPickBatch(ParameterList, out ErrMsg);
                        errMsg = ErrMsg;
                        break;

                    case QueryType.GetCheckBatch:
                        str = CGDM.GetCheckBatch(ParameterList, out ErrMsg);
                        errMsg = ErrMsg;
                        break;

                    default:
                        str = "";
                        errMsg = "";
                        break;
                }
                return str;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #30
0
        public DataTable QuerySwitch(QueryType QT, ArrayList ParameterList)
        {
            DBO.VDS_CRM_MESSAGEDBO VCM = new VDS_CRM_MESSAGEDBO(ref USEDB);
            
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.QueryCRMMessageByFind:
                        Dt = VCM.DO_CRM011_QUERY_MESSAGE(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw GetNewException(ex);
            }
        }
Пример #31
0
 internal LinqContainsExpression(QueryExpression source, QueryExpression value, QueryType type)
     : base(source, type)
 {
     this.Value = value;
 }
Пример #32
0
        public async Task <GeoLookupResponse> GetGeoLookupAsync(QueryType queryType, QueryOptions options = null)
        {
            Service <GeoLookupResponse> forecast = new Service <GeoLookupResponse>(_apiKey, _baseUrl);

            return(await forecast.GetDataAsync(Feature.GeoLookup, queryType, options).ConfigureAwait(false));
        }
Пример #33
0
        public GeoLookupResponse GetGeoLookup(QueryType queryType, QueryOptions options = null)
        {
            Service <GeoLookupResponse> forecast = new Service <GeoLookupResponse>(_apiKey, _baseUrl);

            return(forecast.GetData(Feature.GeoLookup, queryType, options));
        }
Пример #34
0
        public void ReqQuery(string type)
        {
            QueryType obj = Enum <QueryType> .Parse(type);

            api.ReqQuery(obj, ref _Query);
        }
        /// <summary>
        /// 根据日期间隔取得记录
        /// </summary>
        /// <param name="startDate">起始日期(包含起始日期)</param>
        /// <param name="endDate">终止日期(包含终止日期)</param>
        /// <param name="recordTypeId">要查询的记录类型,不限制请传入0</param>
        /// <param name="queryType">查询类型</param>
        /// <returns>取得的记录集</returns>
        public IList <Record> GetByDate(DateTime startDate, DateTime endDate, int recordTypeId, QueryType queryType)
        {
            if (startDate.Date > endDate.Date && startDate.Year > DateTime.Now.Year && queryType == null)
            {
                return(null);
            }

            IList <string> dataFileList = new List <string>();
            IList <Record> recordList   = new List <Record>();

            if (queryType == QueryType.年单位)
            {
                int      iCount     = (endDate.Year - startDate.Year + 1) * 12;
                DateTime QuerySDate = new DateTime(startDate.Year, 1, 1);
                for (int i = 0; i <= iCount; i++)
                {
                    dataFileList.Add(System.Environment.CurrentDirectory + "\\Data\\" + QuerySDate.AddMonths(i).ToString(@"yyyy/MM") + ".xml");
                }
            }
            else if (queryType == QueryType.月单位 || queryType == QueryType.日单位)
            {
                int iCount = startDate.Year == endDate.Year ? endDate.Month - startDate.Month : (12 - startDate.Month + 1) + (endDate.Year - startDate.Year - 1) * 12 + endDate.Month;
                for (int i = 0; i <= iCount; i++)
                {
                    dataFileList.Add(System.Environment.CurrentDirectory + "\\Data\\" + startDate.AddMonths(i).ToString(@"yyyy/MM") + ".xml");
                }
            }

            XmlOperate          op      = new XmlOperate(dataFileList, XmlFileOpType.创建, startDate);
            IList <XmlDocument> doclist = op.GetList();

            if (queryType == QueryType.年单位 || queryType == QueryType.月单位)
            {
                XmlNodeList tempList = null;
                if (recordTypeId == 0)
                {
                    foreach (XmlDocument item in doclist)
                    {
                        tempList = item.DocumentElement.ChildNodes;
                        foreach (XmlElement node in tempList)
                        {
                            recordList.Add(Get(node));
                        }
                    }
                }
                else
                {
                    foreach (XmlDocument item in doclist)
                    {
                        tempList = item.DocumentElement.ChildNodes;
                        Record record = null;
                        foreach (XmlElement node in tempList)
                        {
                            record = Get(node);
                            if (CheckTpye(recordTypeId, record.Type))
                            {
                                recordList.Add(record);
                            }
                        }
                    }
                }
            }
            else //queryType == QueryType.日单位
            {
                XmlNodeList tempList = null;
                if (recordTypeId == 0)
                {
                    foreach (XmlDocument item in doclist)
                    {
                        tempList = item.DocumentElement.ChildNodes;
                        Record record = null;
                        foreach (XmlElement node in tempList)
                        {
                            record = Get(node);
                            if (record.Date.Date >= startDate.Date && record.Date.Date <= endDate.Date)
                            {
                                recordList.Add(Get(node));
                            }
                        }
                    }
                }
                else
                {
                    foreach (XmlDocument item in doclist)
                    {
                        tempList = item.DocumentElement.ChildNodes;
                        Record record = null;
                        foreach (XmlElement node in tempList)
                        {
                            record = Get(node);
                            if (record.Date.Date >= startDate.Date && record.Date.Date <= endDate.Date && CheckTpye(recordTypeId, record.Type))
                            {
                                recordList.Add(Get(node));
                            }
                        }
                    }
                }
            }

            return(recordList);
        }
        protected void PrintResults(IEnumerable <int> bits, Func <int, int> questionLookup, string info, QueryType queryType)
        {
            Logger.Log("RESULTS for \"{0}\":", info);
            var fieldFetcher = GetFieldSelector(queryType);

            foreach (var bit in bits.Take(10))
            {
                var questionId = questionLookup == null ? bit : questionLookup(bit);
                var question   = questions[questionId];
                Logger.Log("  Bit=[{0,9:N0}] -> Qu=[{1,9:N0}], {2}={3,10}, Tags= {4}",
                           bit, questionId, queryType, fieldFetcher(question), String.Join(", ", question.Tags));
            }
        }
Пример #37
0
 public void Query(QueryType type, ReqQueryField query)
 {
     _api.Query(type, query);
 }
Пример #38
0
 public void Query(QueryType type, ReqQueryField query)
 {
     _client?.Query(type, query);
 }
Пример #39
0
        /// <summary>
        /// Attempts a lookup from DNS.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="startQuery"></param>
        /// <param name="preferIPv6"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        private static async Task <SIPEndPoint> SIPLookupAsync(
            SIPURI uri,
            QueryType startQuery,
            bool preferIPv6,
            CancellationToken ct)
        {
            SIPEndPoint result    = null;
            QueryType   queryType = startQuery;

            string host = uri.MAddrOrHostAddress;
            int    port = SIPConstants.GetDefaultPort(uri.Protocol);

            if (ushort.TryParse(uri.HostPort, out var uriPort))
            {
                port = uriPort;
            }

            bool isDone = false;

            while (!isDone && !ct.IsCancellationRequested)
            {
                switch (queryType)
                {
                case QueryType.SRV:

                    try
                    {
                        var srvProtocol = SIPServices.GetSRVProtocolForSIPURI(uri);
                        //string serviceHost = DnsQueryExtensions.ConcatResolveServiceName(uri.MAddrOrHostAddress, uri.Scheme.ToString(), srvProtocol.ToString());
                        //var srvResult = await _lookupClient.QueryAsync(serviceHost, QueryType.SRV, QueryClass.IN, ct).ConfigureAwait(false);
                        var srvResult = await _lookupClient.ResolveServiceAsync(uri.MAddrOrHostAddress, uri.Scheme.ToString(), srvProtocol.ToString());

                        (var srvHost, var srvPort) = GetHostAndPortFromSrvResult(srvResult);
                        if (srvHost != null)
                        {
                            host = srvHost;
                            port = srvPort != 0 ? srvPort : port;
                        }
                    }
                    catch (Exception srvExcp)
                    {
                        logger.LogWarning($"SIPDNS exception on SRV lookup. {srvExcp.Message}.");
                    }
                    queryType = preferIPv6 ? QueryType.AAAA : QueryType.A;

                    break;

                case QueryType.AAAA:

                    try
                    {
                        var aaaaResult = await _lookupClient.QueryAsync(host, UseANYLookups?QueryType.ANY : QueryType.AAAA, QueryClass.IN, ct).ConfigureAwait(false);

                        if (aaaaResult?.Answers?.Count > 0)
                        {
                            result = GetFromLookupResult(uri.Protocol, aaaaResult.Answers.AddressRecords().OrderByDescending(x => x.RecordType).First(), port);
                            isDone = true;
                        }
                        else
                        {
                            queryType = QueryType.A;
                        }
                    }
                    catch (Exception srvExcp)
                    {
                        logger.LogWarning($"SIPDNS exception on AAAA lookup. {srvExcp.Message}.");
                        queryType = QueryType.A;
                    }

                    break;

                default:
                    // A record lookup.
                    try
                    {
                        var aResult = await _lookupClient.QueryAsync(host, QueryType.A, QueryClass.IN, ct).ConfigureAwait(false);

                        if (aResult != null)
                        {
                            if (aResult.Answers?.Count > 0)
                            {
                                result = GetFromLookupResult(uri.Protocol, aResult.Answers.AddressRecords().First(), port);
                            }
                            else
                            {
                                // We got a result back but it was empty indicating an unresolvable host or
                                // some other DNS error condition.
                                result = SIPEndPoint.Empty;
                            }
                        }
                    }
                    catch (Exception srvExcp)
                    {
                        logger.LogWarning($"SIPDNS exception on A lookup. {srvExcp.Message}.");
                        result = SIPEndPoint.Empty;
                    }

                    isDone = true;
                    break;
                }
            }

            return(result);
        }
Пример #40
0
        /// <summary>
        /// Attempts a lookup from cache.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="startQuery"></param>
        /// <param name="preferIPv6"></param>
        /// <returns></returns>
        private static SIPEndPoint SIPLookupFromCache(
            SIPURI uri,
            QueryType startQuery,
            bool preferIPv6)
        {
            CancellationTokenSource cts = new CancellationTokenSource();

            return(SIPLookupAsync(uri, startQuery, preferIPv6, cts.Token).Result);

            // TODO: Re-enable when DnsClient adds cache querying.
            //SIPEndPoint result = null;
            //QueryType queryType = startQuery;

            //string host = uri.MAddrOrHostAddress;
            //int port = SIPConstants.GetDefaultPort(uri.Protocol);
            //if (ushort.TryParse(uri.HostPort, out var uriPort))
            //{
            //    port = uriPort;
            //}

            //bool isDone = false;

            //while (!isDone)
            //{
            //    switch (queryType)
            //    {
            //        case QueryType.SRV:

            //            var srvProtocol = SIPServices.GetSRVProtocolForSIPURI(uri);
            //            string serviceHost = DnsQueryExtensions.ConcatResolveServiceName(uri.MAddrOrHostAddress, uri.Scheme.ToString(), srvProtocol.ToString());
            //            var srvResult = _lookupClient.QueryCache(serviceHost, QueryType.SRV);
            //            (var srvHost, var srvPort) = GetHostAndPortFromSrvResult(srvResult);
            //            if (srvHost != null)
            //            {
            //                host = srvHost;
            //                port = srvPort != 0 ? srvPort : port;
            //            }
            //            queryType = preferIPv6 ? QueryType.AAAA : QueryType.A;

            //            break;

            //        case QueryType.AAAA:

            //            var aaaaResult = _lookupClient.QueryCache(host, UseANYLookups ? QueryType.ANY : QueryType.AAAA, QueryClass.IN);
            //            if (aaaaResult?.Answers?.Count > 0)
            //            {
            //                result = GetFromLookupResult(uri.Protocol, aaaaResult.Answers.OrderByDescending(x => x.RecordType).First(), port);
            //                isDone = true;
            //            }
            //            else
            //            {
            //                queryType = QueryType.A;
            //            }

            //            break;

            //        default:
            //            // A record lookup.

            //            var aResult = _lookupClient.QueryCache(host, QueryType.A, QueryClass.IN);
            //            if (aResult != null)
            //            {
            //                if (aResult.Answers?.Count > 0)
            //                {
            //                    result = GetFromLookupResult(uri.Protocol, aResult.Answers.First(), port);
            //                }
            //                else
            //                {
            //                    // We got a result back but it was empty indicating an unresolvable host or
            //                    // some other DNS error condition.
            //                    result = SIPEndPoint.Empty;
            //                }
            //            }

            //            isDone = true;
            //            break;
            //    }
            //}

            //return result;
        }
Пример #41
0
 /// <summary>To be documented.</summary>
 public static unsafe void CmdWriteAccelerationStructuresProperties(this NVRayTracing thisApi, [Count(Count = 0)] CommandBuffer commandBuffer, [Count(Count = 0)] uint accelerationStructureCount, [Count(Parameter = "accelerationStructureCount"), Flow(FlowDirection.In)] ReadOnlySpan <AccelerationStructureNV> pAccelerationStructures, [Count(Count = 0)] QueryType queryType, [Count(Count = 0)] QueryPool queryPool, [Count(Count = 0)] uint firstQuery)
 {
     // SpanOverloader
     thisApi.CmdWriteAccelerationStructuresProperties(commandBuffer, accelerationStructureCount, in pAccelerationStructures.GetPinnableReference(), queryType, queryPool, firstQuery);
 }
Пример #42
0
 public void FailToParseInvalidJavascript(string q, QueryType type)
 {
     Assert.Throws <InvalidQueryException>(() => new QueryMetadata(q, null, 1, queryType: type));
 }
Пример #43
0
        private object GetParameters(object item, QueryType queryType = QueryType.Update)
        {
            if (item is Platform)
            {
                var objItem = item as Platform;
                switch (queryType)
                {
                case QueryType.Add:
                    return(new {
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Update:
                    return(new {
                        Id = objItem.Id,
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Delete:
                    return(new {
                        Id = objItem.Id
                    });
                }
            }
            else if (item is KnowledgeArea)
            {
                var objItem = item as KnowledgeArea;
                switch (queryType)
                {
                case QueryType.Add:
                    return(new {
                        PlatformId = objItem.PlatformId,
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Update:
                    return(new {
                        Id = objItem.Id,
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Delete:
                    return(new {
                        Id = objItem.Id
                    });
                }
            }
            if (item is Area)
            {
                var objItem = item as Area;
                switch (queryType)
                {
                case QueryType.Add:
                    return(new {
                        KnowledgeAreaId = objItem.KnowledgeAreaId,
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Update:
                    return(new {
                        Id = objItem.Id,
                        Name = objItem.Name,
                        Description = objItem.Description
                    });

                case QueryType.Delete:
                    return(new {
                        Id = objItem.Id
                    });
                }
            }
            if (item is Question)
            {
                var objItem = item as Question;
                switch (queryType)
                {
                case QueryType.Add:
                    return(new {
                        AreaId = objItem.AreaId,
                        Value = objItem.Value,
                        Weight = objItem.Weight,
                        Level = objItem.Level
                    });

                case QueryType.Update:
                    return(new {
                        Id = objItem.Id,
                        Value = objItem.Value,
                        Weight = objItem.Weight,
                        Level = objItem.Level
                    });

                case QueryType.Delete:
                    return(new {
                        Id = objItem.Id
                    });
                }
            }

            return(null);
        }
Пример #44
0
    // 返回查询结果
    public object getQueryResult(QueryType queryType)
    {
        QueryMgr mgr = getSys <QueryMgr>(SysType.sysTypeQuery);

        return(mgr.getQueryResult(queryType));
    }
Пример #45
0
 internal LinqBitwiseOrExpression(QueryExpression left, QueryExpression right, QueryType type)
     : base(left, right, type)
 {
 }
Пример #46
0
        private static void ProcessCommandlineArguments(IEnumerable <string> args)
        {
            foreach (var arg in args)
            {
                switch (arg.ToLowerInvariant())
                {
                case @"u":
                case @"uninstall":
                    if (_queryType != QueryType.None)
                    {
                        throw new FormatException(@"Multiple commands specified");
                    }
                    _queryType = QueryType.Uninstall;
                    break;

                case @"i":
                case @"info":
                    if (_queryType != QueryType.None)
                    {
                        throw new FormatException(@"Multiple commands specified");
                    }
                    _queryType = QueryType.GetInfo;
                    break;

                case @"/s":
                case @"/silent":
                    if (_queryType != QueryType.Uninstall)
                    {
                        throw new FormatException(@"/silent must follow the uninstall command");
                    }
                    _silent = true;
                    break;

                case @"l":
                case @"list":
                    if (_queryType != QueryType.None)
                    {
                        throw new FormatException(@"Multiple commands specified");
                    }
                    _queryType = QueryType.List;
                    break;

                case @"steam":
                    if (_queryType != QueryType.None)
                    {
                        throw new FormatException(@"Multiple commands specified");
                    }
                    _queryType = QueryType.SteamDir;
                    break;

                default:
                    if (_appId != default(int))
                    {
                        throw new FormatException(@"Multiple AppIDs specified");
                    }
                    if (!int.TryParse(arg, out _appId))
                    {
                        throw new FormatException($@"Unknown argument: {arg}");
                    }
                    break;
                }
            }

            if (_queryType == QueryType.None)
            {
                throw new FormatException(@"No commands specified");
            }

            if (_queryType != QueryType.List &&
                _queryType != QueryType.SteamDir &&
                _appId == default(int))
            {
                throw new FormatException(@"No AppID specified");
            }
        }
 /// <summary>
 /// Initializes a new instance of the QueryTypeOperationExpression class.
 /// </summary>
 /// <param name="source">The root argument of the expression.</param>
 /// <param name="typeToOperateAgainst">The type to covert to.</param>
 /// <param name="type">The type of expression.</param>
 protected QueryTypeOperationExpression(QueryExpression source, QueryType typeToOperateAgainst, QueryType type)
     : base(type)
 {
     this.Source = source;
     this.TypeToOperateAgainst = typeToOperateAgainst;
 }
Пример #48
0
 /// <summary>
 /// <para>WARNING: THIS FUNCTION IS NOT YET HOOKED UP.</para>
 /// <para>Gets all tasks which match a specified query.</para>
 /// </summary>
 /// <param name="query">The query string.</param>
 /// <param name="type">The type of query to perform.</param>
 /// <returns></returns>
 public static UserTask[] Query(string query, QueryType type)
 {
     throw (new NotImplementedException());
 }
Пример #49
0
 public Query(string situation, string question, string explaination, Answer[] answers, QueryType type)
 {
     this.situation    = situation;
     this.question     = question;
     this.explaination = explaination;
     this.answers      = answers;
     this.type         = type;
 }
Пример #50
0
        public IQuery CreateQuery(
            string id, StorageProviderDefinition storageProviderDefinition, string statement, CommandParameter[] commandParameters, QueryType queryType)
        {
            IQuery query = Next.CreateQuery(id, storageProviderDefinition, statement, commandParameters, queryType);

            QueryConstructed(query);
            return(query);
        }
Пример #51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryDescription"/> struct.
 /// </summary>
 /// <param name="queryType">Type of query (see <see cref="QueryType"/>).</param>
 /// <param name="miscFlags">Miscellaneous flags (see <see cref="QueryFlags"/>).</param>
 public QueryDescription(QueryType queryType, QueryFlags miscFlags = QueryFlags.None)
 {
     QueryType = queryType;
     MiscFlags = miscFlags;
 }
Пример #52
0
 QueryItemEvent(QueryType subType)
 {
     QueryType = subType;
 }
Пример #53
0
        /// <summary>
        /// Attempts to resolve a hostname.
        /// </summary>
        /// <param name="host">The hostname to resolve.</param>
        /// <param name="port">The service port to use in the end pint result (not used for the lookup).</param>
        /// <param name="queryType">The lookup query type, either A or AAAA.</param>
        /// <returns>If successful an IPEndPoint or null if not.</returns>
        private static SIPEndPoint HostQuery(SIPProtocolsEnum protocol, string host, int port, QueryType queryType)
        {
            try
            {
                var addrRecord = _lookupClient.Query(host, queryType).Answers.FirstOrDefault();
                if (addrRecord != null)
                {
                    return(GetFromLookupResult(protocol, addrRecord, port));
                }
            }
            catch (Exception excp)
            {
                logger.LogWarning($"SIP DNS lookup failure for {host} and query {queryType}. {excp.Message}");
            }

            if (queryType == QueryType.AAAA)
            {
                return(HostQuery(protocol, host, port, QueryType.A));
            }

            return(null);
        }
Пример #54
0
 internal QueryEqualToExpression(QueryExpression left, QueryExpression right, QueryType type)
     : base(left, right, type)
 {
 }
Пример #55
0
        /// <summary>
        /// Resolve method that performs either an A or AAAA record lookup. If required
        /// a SRV record lookup will be performed prior to the A or AAAA lookup.
        /// </summary>
        /// <param name="uri">The SIP URI to lookup.</param>
        /// <param name="queryType">Whether the address lookup should be A or AAAA.</param>
        /// <returns>A SIPEndPoint or null.</returns>
        private static async Task <SIPEndPoint> Resolve(SIPURI uri, QueryType queryType)
        {
            if (uri == null || String.IsNullOrWhiteSpace(uri.MAddrOrHostAddress))
            {
                throw new ArgumentNullException("uri", "SIP DNS resolve was supplied an empty input.");
            }

            if (!ushort.TryParse(uri.HostPort, out var uriPort))
            {
                uriPort = SIPConstants.DEFAULT_SIP_PORT;
            }

            if (IPAddress.TryParse(uri.MAddrOrHostAddress, out var ipAddress))
            {
                // Target is already an IP address, no DNS lookup required.
                return(new SIPEndPoint(uri.Protocol, ipAddress, uriPort));
            }
            else
            {
                if (!uri.MAddrOrHostAddress.Contains(".") || uri.MAddrOrHostAddress.EndsWith(MDNS_TLD))
                {
                    AddressFamily family = (queryType == QueryType.AAAA) ? AddressFamily.InterNetworkV6 :
                                           AddressFamily.InterNetwork;

                    // The lookup is for a local network host. Use the OS DNS logic as the
                    // main DNS client can be configured to use external DNS servers that won't
                    // be able to lookup this hostname.

                    IPHostEntry hostEntry = null;

                    try
                    {
                        hostEntry = Dns.GetHostEntry(uri.MAddrOrHostAddress);
                    }
                    catch (SocketException)
                    {
                        // Socket exception gets thrown for failed lookups,
                    }

                    if (hostEntry != null)
                    {
                        var addressList = hostEntry.AddressList;

                        if (addressList?.Length == 0)
                        {
                            logger.LogWarning($"Operating System DNS lookup failed for {uri.MAddrOrHostAddress}.");
                            return(null);
                        }
                        else
                        {
                            if (addressList.Any(x => x.AddressFamily == family))
                            {
                                var addressResult = addressList.First(x => x.AddressFamily == family);
                                return(new SIPEndPoint(uri.Protocol, addressResult, uriPort));
                            }
                            else
                            {
                                // Didn't get a result for the preferred address family so just use the
                                // first available result.
                                var addressResult = addressList.First();
                                return(new SIPEndPoint(uri.Protocol, addressResult, uriPort));
                            }
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    if (uri.HostPort != null)
                    {
                        // Explicit port means no SRV lookup.
                        return(HostQuery(uri.Protocol, uri.MAddrOrHostAddress, uriPort, queryType));
                    }
                    else
                    {
                        // No explicit port so use a SRV -> (A | AAAA -> A | ANY) record lookup.
                        var srvProtocol = SIPServices.GetSRVProtocolForSIPURI(uri);
                        try
                        {
                            ServiceHostEntry srvResult = null;
                            var srvResults             = await _lookupClient.ResolveServiceAsync(uri.MAddrOrHostAddress, uri.Scheme.ToString(), srvProtocol.ToString()).ConfigureAwait(false);

                            if (srvResults == null || srvResults.Count() == 0)
                            {
                                logger.LogWarning($"SIP DNS SRV lookup returned no results for {uri}.");
                            }
                            else
                            {
                                srvResult = srvResults.OrderBy(y => y.Priority).ThenByDescending(w => w.Weight).FirstOrDefault();
                            }

                            string host = uri.MAddrOrHostAddress;        // If no SRV results then fallback is to lookup the hostname directly.
                            int    port = SIPConstants.DEFAULT_SIP_PORT; // If no SRV results then fallback is to use the default port.

                            if (srvResult != null)
                            {
                                host = srvResult.HostName;
                                port = srvResult.Port;
                            }

                            return(HostQuery(uri.Protocol, host, port, queryType));
                        }
                        catch (Exception e)
                        {
                            logger.LogWarning($"SIP DNS SRV lookup failure for {uri}. {e?.InnerException?.Message}");
                        }
                    }
                }
                return(null);
            }
        }
Пример #56
0
 public FreeBusyApplication(ClientContext clientContext, FreeBusyViewOptions freeBusyView, bool defaultFreeBusyOnly, QueryType queryType) : base(true)
 {
     this.freeBusyView        = freeBusyView;
     this.clientContext       = clientContext;
     this.defaultFreeBusyOnly = defaultFreeBusyOnly;
     this.queryType           = queryType;
 }
Пример #57
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Initializes a new instance of the EmailMicroService.DnsQuery class. </summary>
        ///
        /// <param name="domainName">   Name of the domain. </param>
        /// <param name="qtype">        The qtype. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public DnsQuery(string domainName, QueryType qtype)
        {
            DomainName = domainName;
            QueryType  = qtype;
            QueryClass = QueryClass.Internet;
        }
Пример #58
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Initializes a new instance of the EmailMicroService.DnsQuery class. </summary>
        ///
        /// <param name="domainName">   Name of the domain. </param>
        /// <param name="qtype">        The qtype. </param>
        /// <param name="qclass">       The qclass. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public DnsQuery(string domainName, QueryType qtype, QueryClass qclass)
        {
            DomainName = domainName;
            QueryType  = qtype;
            QueryClass = qclass;
        }
Пример #59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryAttribute"/> class.
 /// </summary>
 /// <param name="queryType">Type of the query.</param>
 public QueryAttribute(QueryType queryType)
 {
     this.queryType = queryType;
 }
 public DataLoaderTestSchema(IServiceProvider services, QueryType query, SubscriptionType subscriptionType)
     : base(new DependencyResolver(services))
 {
     Query        = query;
     Subscription = subscriptionType;
 }