コード例 #1
0
        static BitmapSource GetImage(QueryTypes type)
        {
            switch (type)
            {
            case QueryTypes.MyQ:
                return(DisplayImage.GetImageSource(Properties.Resources.MyQ));

            case QueryTypes.TeamQ:
                return(DisplayImage.GetImageSource(Properties.Resources.TeamQ));

            case QueryTypes.Folder:
                return(DisplayImage.GetImageSource(Properties.Resources.Folder));

            case QueryTypes.FView:
                return(DisplayImage.GetImageSource(Properties.Resources.FView));

            case QueryTypes.DView:
                return(DisplayImage.GetImageSource(Properties.Resources.DView));

            case QueryTypes.HView:
                return(DisplayImage.GetImageSource(Properties.Resources.HView));

            default:
                return(null);
            }
        }
コード例 #2
0
        public QueryTypes FetchByFilter(RepositoryFilter filter)
        {
            try
            {
                using (IDbConnection db = new SqlConnection(ConnectionString))
                {
                    var result = new QueryTypes();

                    var query = "SELECT COUNT(Id) FROM QueryCategory";
                    result.TotalItems = db.Query <int>(query).FirstOrDefault();

                    query = "SELECT qc.[Id], qc.[Name], COUNT(q.CategoryId) AS [AssociatedQueries] " +
                            "FROM QueryCategory qc LEFT JOIN Query q ON qc.Id = q.CategoryId " +
                            "GROUP BY qc.Id, qc.Name " +
                            $"ORDER BY {filter.SortColumn} {filter.SortDirection} " +
                            $"OFFSET {filter.Offset} ROWS FETCH NEXT {filter.PageSize} ROWS ONLY;";
                    result.Items = db.Query <QueryType>(query)?.ToList();

                    return(result);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #3
0
        public EditQuery()
        {
            InitializeComponent();

            // Указание формата для даты запроса
            queryDateTimeInput.Format       = DateTimePickerFormat.Custom;
            queryDateTimeInput.CustomFormat = @"dd/MM/yyyy HH:mm";
            queryDateTimeInput.Value        = DateTime.Now;
            queryDateTimeInput.MaxDate      = DateTime.Now;
            queryDateTimeInput.MinDate      = new DateTime(2020, 03, 29, 20, 20, 20);

            // Типы запросов
            var queryTypes = QueryTypes.GetData();

            // Добавление типов запросов в выпадающий список
            var queryTypesKeyValuePair = queryTypes
                                         .Select(type => new KeyValuePair <int, string>(type.Id, type.Name))
                                         .ToList();

            queryTypeInput.DataSource    = queryTypesKeyValuePair;
            queryTypeInput.DisplayMember = "Value";
            queryTypeInput.ValueMember   = "Key";

            var allTracks = Tracks.GetData();

            receivedTracksInput.AllTracks = allTracks;
        }
コード例 #4
0
 private static extern Int32 DnsApiDnsQuery(
     [MarshalAs(UnmanagedType.VBByRefStr)] ref string sName,
     QueryTypes wType,
     QueryOptions options,
     UInt32 aipServers,
     ref IntPtr ppQueryResults,
     UInt32 pReserved);
コード例 #5
0
ファイル: DataAccess.cs プロジェクト: equad525/340project
            private static string GetCRUDString(QueryTypes queryType, string[] selectFields = null)
            {
                switch (queryType)
                {
                    case QueryTypes.Create:
                        return "INSERT";
                    case QueryTypes.Retrieve:
                        StringBuilder fields = new StringBuilder();
                        fields.Append("SELECT ");

                        if(selectFields != null)
                        {
                            foreach (string f in selectFields)
                            {
                                fields.Append($"{f},");
                            }
                            fields.Remove(fields.Length - 1, 1);
                        }
                        else
                        {
                            fields.Append("*");
                        }

                        return fields.ToString();
                    case QueryTypes.Update:
                        return "UPDATE";
                    case QueryTypes.Delete:
                        return "DELETE";
                    default:
                        return "";
                }
            }
コード例 #6
0
        internal MySqlDataReader ExecuteQuery(QueryTypes type)
        {
            MySqlDataReader dataReader = null;

            using (MySqlConnection conn = new MySqlConnection("Server=" + server + ";Uid=" + user + ";Pwd=" + password + ";Database=" + database + ";")) {
                using (MySqlCommand command = new MySqlCommand(queryString, conn)) {
                    try {
                        //Add parameters to query
                        if (parameters != null)
                        {
                            foreach (MySqlParameter p in parameters)
                            {
                                command.Parameters.Add(p);
                            }
                        }
                        conn.Open();
                        switch (type)
                        {
                        case QueryTypes.INSERT: { command.ExecuteNonQuery(); break; }

                        case QueryTypes.SELECT: { dataReader = command.ExecuteReader(); break; }

                        default: { throw new InvalidOperationException(); }
                        }
                    } catch (SqlException e) {
                        Console.WriteLine(e);
                    } finally {
                        command.Clone();
                        conn.Clone();
                    }
                }
            }
            return(dataReader);
        }
コード例 #7
0
ファイル: DataAccess.cs プロジェクト: equad525/340project
            private static string GetWHEREString(QueryTypes queryType, IEnumerable<Condition> conditions)
            {
                StringBuilder whereClause = new StringBuilder();
                int characterDelete = 5;
                string op = "AND";

                whereClause.Append("WHERE ");

                if (typeof(ConditionList).IsAssignableFrom(conditions.GetType()))
                {
                    ConditionList conditionList = (ConditionList)conditions;
                    op = GetConditionListOperator(conditionList.ConditionalOperator);

                    if (op == "OR") characterDelete = 4;
                }

                foreach (Condition condition in conditions)
                {
                    whereClause.Append($"{condition.Left}{GetConditionOperator(condition.ConditionOperator)}'{condition.Right}' {op}\n");
                }

                whereClause.Remove(whereClause.Length - characterDelete, characterDelete);

                return whereClause.ToString();
            }
コード例 #8
0
        public static RecordCollection Lookup(string DnsName, QueryTypes LookupType)
        {
            IntPtr           ptr  = IntPtr.Zero;
            IntPtr           temp = IntPtr.Zero;
            RecordCollection RC   = null;
            DnsRecord        DNSR;

            int intAddress = BitConverter.ToInt32(IPAddress.Parse("8.8.8.8").GetAddressBytes(), 0);
            int result     = DnsQuery(ref DnsName,
                                      LookupType,
                                      QueryOptions.DNS_QUERY_STANDARD,
                                      0, ref ptr, 0);

            if (result == 0)
            {
                for (temp = ptr; !temp.Equals(IntPtr.Zero); temp = DNSR.pNext)
                {
                    DNSR = (DnsRecord)Marshal.PtrToStructure(temp, typeof(DnsRecord));
                    if (RC == null)
                    {
                        RC = new RecordCollection(temp, DNSR);
                    }
                    RC.Add((QueryTypes)DNSR.wType, getRecord((QueryTypes)DNSR.wType, temp));
                }
            }
            else
            {
                throw new Win32Exception(result);
            }
            return(RC);
        }
コード例 #9
0
ファイル: AwesomeDB.min.cs プロジェクト: Riki1312/AwesomeDB
        //Esegue una query parametri: testo della query, tipo di query
        public ADB_Result Query(string query, QueryTypes queryTypes = QueryTypes.query)
        {
            try
            {
                ADB_Result ret = null;
                SqlCommand cmd = new SqlCommand();

                switch (queryTypes)
                {
                    case QueryTypes.query:
                        cmd.CommandText = query;
                        ret = new ADB_Result(then: this, dataTable: LowLevel.db.EseguiQuery(cmd));
                        break;
                    case QueryTypes.notquery:
                        cmd.CommandText = query;
                        ret = new ADB_Result(then: this, changedRecords: LowLevel.db.EseguiNonQuery(cmd));
                        break;
                    case QueryTypes.scalar:
                        cmd.CommandText = query;
                        ret = new ADB_Result(then: this, singleData: LowLevel.db.EseguiScalar(cmd));
                        break;
                }
                return ret;
            }
            catch(Exception ex)
            {
                if (Settings.DebugMode) throw new Exception(ex.Message);
                else return new ADB_Result(then: this, errorsMessage: ex.Message);
            }
        }
コード例 #10
0
        /// <summary>
        /// Returns Format of Query according to QueryType.
        /// </summary>
        /// <param name="queryType"></param>
        /// <returns></returns>
        private string QueryFormat(QueryTypes queryType)
        {
            switch (queryType)
            {
            case QueryTypes.Select:
                return("Select * From {0};");

            case QueryTypes.InsertAndGetId:
            case QueryTypes.Insert:
                return("Insert Into {0}({1}) Values({2});");

            case QueryTypes.Update:
                return("Update {0} Set {1} Where {2};");

            case QueryTypes.Delete:
                return("Delete From {0} Where {1};");

            case QueryTypes.SelectWhereChangeColumns:
            case QueryTypes.SelectWhereId:
                return("Select * From {0} Where {1};");

            default:
                break;
            }
            return(string.Empty);
        }
コード例 #11
0
ファイル: QueryManager.cs プロジェクト: mguerrer/Salma
        static ImageSource GetImage(QueryTypes type)
        {
            try
            {
                switch (type)
                {
                case QueryTypes.MyQ:
                    return(WindowFactory.IconConverter(Icons.MyQueries, 16, 16));

                case QueryTypes.TeamQ:
                    return(WindowFactory.IconConverter(Icons.TeamQueries, 16, 16));

                case QueryTypes.Folder:
                    return(WindowFactory.IconConverter(Icons.Folder, 16, 16));

                case QueryTypes.FView:
                    return(WindowFactory.IconConverter(Icons.FlatView, 16, 16));

                case QueryTypes.DView:
                    return(WindowFactory.IconConverter(Icons.DirectView, 16, 16));

                case QueryTypes.HView:
                    return(WindowFactory.IconConverter(Icons.HierarchicalView, 16, 16));

                default:
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
コード例 #12
0
        public QueriesReport()
        {
            InitializeComponent();

            // Указание формата для даты запроса
            dateFromInput.Format       = DateTimePickerFormat.Custom;
            dateFromInput.CustomFormat = @"dd/MM/yyyy HH:mm";
            dateFromInput.Value        = DateTime.Now.AddDays(-7);
            dateFromInput.MaxDate      = DateTime.Now;
            dateFromInput.MinDate      = new DateTime(2020, 03, 29, 20, 20, 20);

            dateToInput.Format       = DateTimePickerFormat.Custom;
            dateToInput.CustomFormat = @"dd/MM/yyyy HH:mm";
            dateToInput.Value        = DateTime.Now;
            dateToInput.MaxDate      = DateTime.Now;
            dateToInput.MinDate      = new DateTime(2020, 03, 29, 20, 20, 20);

            var queryTypes = QueryTypes.GetData();
            // Добавление типов запросов в выпадающий список
            var queryTypesKeyValuePair = queryTypes
                                         .Select(type => new KeyValuePair <int, string>(type.Id, type.Name))
                                         .ToList();

            queryTypeInput.DataSource    = queryTypesKeyValuePair;
            queryTypeInput.DisplayMember = "Value";
            queryTypeInput.ValueMember   = "Key";
        }
コード例 #13
0
        /// <summary>
        /// Routes the search data to the necessary underlying implementation of the desired search type.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="searchData"></param>
        /// <returns></returns>
        public QueryOver <T, T> CreateQuery(QueryTypes type, object searchData)
        {
            switch (type)
            {
            case QueryTypes.Advanced:
            {
                var filters = searchData as Dictionary <Expression <Func <T, object> >, object> ??
                              throw new CommandCentralException("Your search data must be in the format of a dicionary of filters.", ErrorTypes.Validation);

                return(CreateAdvancedQuery(filters));
            }

            case QueryTypes.Simple:
            {
                var searchTerms = searchData as string ??
                                  throw new CommandCentralException("Your search terms must be a string and not be null.", ErrorTypes.Validation);

                return(CreateSimpleSearchQuery(searchTerms, GetMembersThatAreUsedIn(QueryTypes.Simple)));
            }

            default:
            {
                throw new NotImplementedException("Hit default case in query type switch.");
            }
            }
        }
コード例 #14
0
        public static string[] GetTXTRecord(string domain)
        {
            IntPtr          ptr1 = IntPtr.Zero;
            IntPtr          ptr2 = IntPtr.Zero;
            PDNS_TXT_RECORD DnsAnswer;

            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                throw new NotSupportedException();
            }
            ArrayList list1 = new ArrayList();
            int       num1  = DnsapiQuery.DnsQuery(ref domain, QueryTypes.DNS_TYPE_TXT, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ref ptr1, 0);

            if (num1 != 0)
            {
                throw new Win32Exception(num1);
            }
            for (ptr2 = ptr1; !ptr2.Equals(IntPtr.Zero); ptr2 = DnsAnswer.pNext)
            {
                DnsAnswer = (PDNS_TXT_RECORD)Marshal.PtrToStructure(ptr2, typeof(PDNS_TXT_RECORD));
                QueryTypes recType = (QueryTypes)DnsAnswer.wType;
                if (recType == QueryTypes.DNS_TYPE_TXT)
                {
                    string Result = Marshal.PtrToStringAuto(DnsAnswer.pStringArray);
                    list1.Add(Result);
                }
            }
            DnsapiQuery.DnsRecordListFree(ptr1, 0);
            return((string[])list1.ToArray(typeof(string)));
        }
コード例 #15
0
        public static object Select(GFXDClientConnection connection, string sql, QueryTypes type)
        {
            GFXDCommand command = connection.CreateCommand();

            command.CommandType = System.Data.CommandType.Text;
            command.CommandText = sql;

            if (connection.IsClosed)
            {
                connection.Open();
            }

            if (type == QueryTypes.SCALAR)
            {
                return(command.ExecuteScalar());
            }

            using (GFXDDataAdapter adapter = command.CreateDataAdapter())
            {
                switch (type)
                {
                case QueryTypes.DATAROW: return(GetDataRow(connection, adapter));

                case QueryTypes.DATATABLE: return(GetDataTable(connection, adapter));

                case QueryTypes.DATASET: return(GetDataSet(connection, adapter));

                default: return(null);
                }
            }
        }
コード例 #16
0
        public static string ReadFormatter(QueryTypes queryType){

            string name = string.Empty;
            switch(queryType){

                case QueryTypes.SELECT :
                    name = "SelectFormat.txt";
                    break;
                case QueryTypes.INSERT:
                    name = "InsertFormat.txt";
                    break;
                case QueryTypes.DELETE:
                    name = "DeleteFormat.txt";
                    break;
                case QueryTypes.UPDATE:
                    name = "UpdateFormat.txt";
                    break;

            }

            string format = File.ReadAllText(@".\resources\" + name);

            return format;

        }
コード例 #17
0
        private string QueryFormat(QueryTypes queryType)
        {
            switch (queryType)
            {
            case QueryTypes.Select:
                return("Select {0} From {1} Where {2};");

            case QueryTypes.Insert:
                return("Insert Into {0}({1}) Values({2})");

            case QueryTypes.Update:
                return("Update {0} Set {1} Where {2}");

            case QueryTypes.Delete:
                return("Delete From {0} Where {1}");

            case QueryTypes.Create:
                return("Create Table {0}{1}{2}({3});");

            case QueryTypes.Drop:
                return("Drop Table {0};");

            default:
                throw new InvalidOperationException("Onknown Query Type");
            }
        }
コード例 #18
0
 public QueryBuilder(ConnectionTypes ConnType, QueryTypes queryType, Object queryObject)
 {
     _queryObject = queryObject;
     _queryType   = queryType;
     _queryString = GetQueryString();
     _parameters  = GetParameters();
 }
コード例 #19
0
        internal void Build(IBaseBO bo, IQueryFormat qformat, IQueryAdds adds, QueryTypes query_type, ConnectionTypes conn_type)
        {
            try
            {
                string queryText = string.Empty;
                queryText = qformat.Format;
                queryText = queryText ?? string.Empty;

                string table_name = string.Empty;
                string columns    = string.Empty;
                string vals       = string.Empty;

                table_name = GetTableName(bo, adds);
                columns    = GetColumns(bo, adds, query_type, conn_type);
                vals       = GetVals(bo, adds, query_type, conn_type);

                queryText = queryText.Replace("#TABLE_NAME#", table_name);
                queryText = queryText.Replace("#COLUMNS#", columns);
                queryText = queryText.Replace("#VALS#", vals);

                query.Text = queryText;

                List <DbParameter> parameters = GetParameters(bo, adds, query_type);
                query.Parameters = parameters;
            }
            catch (Exception e)
            {
                throw;
            }
        }
コード例 #20
0
 private static extern int DnsQuery(
     [MarshalAs(UnmanagedType.VBByRefStr)] ref string pszName,
     QueryTypes wType,
     QueryOptions options,
     int aipServers,
     ref IntPtr ppQueryResults,
     int pReserved);
コード例 #21
0
        internal static string GetColumns(IBaseBO bo, IQueryAdds adds, QueryTypes query_type, ConnectionTypes conn_type)
        {
            string cols = string.Empty;

            try
            {
                List <string> colList = bo.GetColumnChangeList();

                if (query_type == QueryTypes.Insert ||
                    query_type == QueryTypes.InsertAndGetId ||
                    query_type == QueryTypes.Update)
                {
                    string id_col = bo.GetIdColumn();
                    colList.Remove(id_col);
                }

                if (query_type == QueryTypes.Insert || query_type == QueryTypes.InsertAndGetId ||
                    query_type == QueryTypes.InsertAnyChange || query_type == QueryTypes.SelectChangeColumns)
                {
                    foreach (var col in colList)
                    {
                        cols = string.Concat(cols, ", ", col);
                    }
                    cols = cols.TrimStart(',').TrimStart();
                    // RETURN
                    return(cols);
                }

                if (query_type == QueryTypes.Update)
                {
                    if (conn_type == ConnectionTypes.Odbc)
                    // || conn_type == ConnectionTypes.External)
                    {
                        foreach (var col in colList)
                        {
                            cols = string.Concat(cols, ", ", col, "=", adds.ParameterPrefix);
                        }
                    }
                    else
                    {
                        foreach (var col in colList)
                        {
                            cols = string.Concat(cols, ", ", col, "=", adds.ParameterPrefix, col);
                        }
                    }

                    cols = cols.TrimStart(',').TrimStart();

                    // RETURN
                    return(cols);
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(cols);
        }
コード例 #22
0
 /// <summary>
 /// Restores this instance to default settings.
 /// </summary>
 public void Reset()
 {
     QueryType = QueryTypes.Select;
     _columns.Clear();
     _nameValuePairs.Clear();
     _tables.Clear();
     _tables.Clear();
 }
コード例 #23
0
ファイル: QueryBuilder.cs プロジェクト: rajeshwarn/Creek
 /// <summary>
 /// Restores this instance to default settings.
 /// </summary>
 public void Reset()
 {
     this.QueryType = QueryTypes.Select;
     this._columns.Clear();
     this._nameValuePairs.Clear();
     this._tables.Clear();
     this._tables.Clear();
 }
コード例 #24
0
        public EditSubscription()
        {
            InitializeComponent();

            var queryTypeNames = QueryTypes.GetData().Select(queryType => (object)queryType.Name).ToArray();

            // Заполнение доступных типов запросов
            availableQueryTypesInput.Items.AddRange(queryTypeNames);
        }
コード例 #25
0
ファイル: Query.cs プロジェクト: dzstoever/ZenFacades
        public Query(QueryTypes qType, bool isNamed, string nameOrText)
        {
            if (qType == QueryTypes.Criteria)
                throw new ArgumentException("QueryType can not be 'Criteria' for Named or Text Queries.");

            QueryType = qType;
            IsNamed = isNamed;
            NameOrText = nameOrText;
        }
コード例 #26
0
 public QueryBuilder(ConnectionTypes ConnType, QueryTypes queryType,
                     IBaseBO queryObject)
 {
     _baseBO      = queryObject;
     _queryType   = queryType;
     _ConnType    = ConnType;
     _queryString = GetQueryString();
     _parameters  = GetParameters();
 }
コード例 #27
0
        /// <summary>
        /// Create a QueryBuilder with given object and
        /// querytype and connetiontypes.
        /// </summary>
        /// <param name="ConnType">Connetion Types of Query Builder.</param>
        /// <param name="queryType">Query Types of Query Builder.</param>
        /// <param name="queryObject">An object inherits IBaseBO interface.</param>
        public QueryBuilder(ConnectionTypes ConnType, QueryTypes queryType,
                            BaseBO queryObject)
        {
            _baseBO    = queryObject;
            _queryType = queryType;
            _ConnType  = ConnType;

            _queryString = GetQueryString();
            _property    = GetProperties();
        }
コード例 #28
0
        /// <summary>
        /// Create a QueryBuilder with given object and  querytype and connetiontypes.
        /// </summary>
        /// <param name="ConnType">Connetion Types of Query Builder.</param>
        /// <param name="queryType">Query Types of Query Builder.</param>
        /// <param name="queryObject">An object inherits IBaseBO interface.</param>
        public QueryBuilder(ConnectionTypes ConnType, QueryTypes queryType,
                            IBaseBO queryObject)
        {
            _baseBO              = queryObject;
            _queryType           = queryType;
            _ConnType            = ConnType;
            isNotEmptyChangeList = _baseBO.GetColumnChangeList().Count > 0;

            _queryString = GetQueryString();
            _parameters  = GetParameters();
        }
コード例 #29
0
ファイル: ICD.cs プロジェクト: ewin66/Management-System
        /// <summary>
        /// 获得未对照的ICD9信息
        /// </summary>
        /// <param name="type">查询类型</param>
        /// <returns>错误返回 NULL 正确返回arrayList</returns>
        /// Creator: [email protected]  2005/05/30
        public ArrayList QueryNoComparedICD9(QueryTypes type)
        {
            try
            {
                //定义字符变量 ,存储SQL语句
                string strSql = "";
                //定义字符变量 存储 Where 条件
                string strValidString = "";
                //定义动态数组 ,存储符合条件的数据集
                ArrayList arrayList = new ArrayList();
                //获取SQL语句
                if (this.Sql.GetSql("Case.ICDDML.QueryNoComparedICD9", ref strSql) == -1)
                {
                    this.Err = "获取SQL语句失败";
                    return(null);
                }
                //根据type给SQL语句赋值
                switch (type)
                {
                case QueryTypes.All:      //查询所有的
                    strValidString = "%";
                    break;

                case QueryTypes.Cancel:     //查询作废的
                    strValidString = "0";
                    break;

                case QueryTypes.Valid:     // 查询有效的
                    strValidString = "1";
                    break;
                }
                try
                {
                    strSql = string.Format(strSql, strValidString);
                }
                catch (Exception ex)
                {
                    this.Err = "SQL语句赋值出错! " + ex.Message;
                    return(null);
                }
                //执行查询操作
                this.ExecQuery(strSql);
                //利用Reader装载实体(HISFC.Object.Case.ICD)
                arrayList = ICDReaderInfo();
                //返回ArrayList
                return(arrayList);
            }
            catch (Exception ex)
            {
                this.Err = ex.Message; //捕获错误
                return(null);          //返回null
            }
        }
コード例 #30
0
        public Queries(string text) : this()
        {
            char [] delimiterChars = { '\r' };
            string  query          = text.Replace('\n', ' ');

            query = query.ToLower();
            string [] queries = query.Split(delimiterChars);

            for (int index = 0; index < queries.Length; ++index)
            {
                char []   delimiter2Chars = { ' ' };
                string [] strings         = queries [index].Trim().Split(delimiter2Chars);

                PlotTypes  plotType = PlotTypes.Default;
                double     value = 0.0, value1 = 0.0, value2 = 0.0;
                string     name         = string.Empty;
                string     detection    = string.Empty;
                string     spectral     = string.Empty;
                string     habitability = string.Empty;
                QueryTypes queryType    = QueryTypes.StartsWith;

                if (ParseName(strings, ref name, ref queryType) == true)
                {
                    AddName(name, queryType);
                }
                else if (ParseDetection(strings, ref detection, ref queryType) == true)
                {
                    AddDetection(detection, queryType);
                }
                else if (ParseSpectral(strings, ref spectral, ref queryType) == true)
                {
                    AddSpectral(spectral, queryType);
                }
                else if (ParseHabitability(strings, ref habitability, ref queryType) == true)
                {
                    AddHabitability(habitability, queryType);
                }
                else if (ParseBetweenQuery(strings, ref plotType, ref value1, ref value2) == true)
                {
                    AddBetween(plotType, value1, value2);
                }
                else if (ParseLessThanQuery(strings, ref plotType, ref value) == true)
                {
                    AddLessThan(plotType, value);
                }
                else if (ParseGreaterThanQuery(strings, ref plotType, ref value) == true)
                {
                    AddGreaterThan(plotType, value);
                }
            }
        }
コード例 #31
0
ファイル: ICD.cs プロジェクト: ewin66/Management-System
        /// <summary>
        /// 重载 获得未对照的ICD9信息
        /// </summary>
        /// <param name="type">查询类型</param>
        /// <param name="ds">数据集</param>
        /// <returns>程序中出现未处理的错误 返回 -1 正确返回 1 并返回符合条件的数据集</returns>
        /// Creator: [email protected]  2005/05/30
        public int QueryNoComparedICD9(QueryTypes type, ref DataSet ds)
        {
            try
            {
                //定义字符变量 ,存储SQL语句
                string strSql = "";
                //定义字符变量 存储 Where 条件
                string strValidString = "";
                //定义动态数组 ,存储符合条件的数据集
                ArrayList arrayList = new ArrayList();
                //获取SQL语句
                if (this.Sql.GetSql("Case.ICDDML.QueryNoComparedICD9", ref strSql) == -1)
                {
                    this.Err = "获取SQL语句失败";
                    return(-1);
                }
                //根据type给SQL语句赋值
                switch (type)
                {
                case QueryTypes.All:      //查询所有的
                    strValidString = "%";
                    break;

                case QueryTypes.Cancel:     //查询作废的
                    strValidString = "0";
                    break;

                case QueryTypes.Valid:     // 查询有效的
                    strValidString = "1";
                    break;
                }
                try
                {
                    //格式化SQL
                    strSql = string.Format(strSql, strValidString);
                }
                catch (Exception ex)
                {
                    this.Err = "SQL语句赋值出错!" + ex.Message;
                    return(-1);
                }
                //执行查询操作
                return(this.ExecQuery(strSql, ref ds));
            }
            catch (Exception ex)
            {
                this.Err = ex.Message; //捕获错误
                return(-1);            //返回null
            }
        }
コード例 #32
0
        private IEnumerable <dynamic> DynamicLookup <T>(QueryTypes queryType, Criteria criteria = null)
        {
            var handler = GetHandler <T>(criteria);

            if (handler != null)
            {
                var info = GetQueryInfo <T>(handler, queryType, criteria);
                if (info == null)
                {
                    return(new List <dynamic>());
                }
                RunInterceptor <T>(info);
                var results = CurrentRepository.DynamicQuery <T>(info).ToList();
                return(results);
            }
            return(new List <dynamic>());
        }
コード例 #33
0
ファイル: GFXDDbi.cs プロジェクト: leloulight/gemfirexd-oss
        public static object Select(GFXDClientConnection connection, string sql, QueryTypes type)
        {
            GFXDCommand command = connection.CreateCommand();
            command.CommandType = System.Data.CommandType.Text;
            command.CommandText = sql;

            if (connection.IsClosed)
                connection.Open();

            if (type == QueryTypes.SCALAR)
                return command.ExecuteScalar();

            using (GFXDDataAdapter adapter = command.CreateDataAdapter())
            {
                switch (type)
                {
                    case QueryTypes.DATAROW: return GetDataRow(connection, adapter);
                    case QueryTypes.DATATABLE: return GetDataTable(connection, adapter);
                    case QueryTypes.DATASET: return GetDataSet(connection, adapter);
                    default: return null;
                }
            }
        }
コード例 #34
0
ファイル: clsDns.cs プロジェクト: AyrA/Mailinator-Check
 private static object getRecord(QueryTypes t, IntPtr RecordPtr)
 {
     IntPtr Record = (IntPtr)(RecordPtr.ToInt32() + 16+(IntPtr.Size*2));
     switch (t)
     {
         case QueryTypes.DNS_TYPE_A:
             return Marshal.PtrToStructure(Record, typeof(DNS_A_DATA));
         case QueryTypes.DNS_TYPE_NS:
         case QueryTypes.DNS_TYPE_MD:
         case QueryTypes.DNS_TYPE_MF:
         case QueryTypes.DNS_TYPE_CNAME:
         case QueryTypes.DNS_TYPE_MB:
         case QueryTypes.DNS_TYPE_MG:
         case QueryTypes.DNS_TYPE_MR:
         case QueryTypes.DNS_TYPE_PTR:
         case QueryTypes.DNS_TYPE_DNAME:
             return Marshal.PtrToStructure(Record, typeof(DNS_PTR_DATA));
         case QueryTypes.DNS_TYPE_HINFO:
         case QueryTypes.DNS_TYPE_TEXT:
         case QueryTypes.DNS_TYPE_X25:
         case QueryTypes.DNS_TYPE_ISDN:
             return Marshal.PtrToStructure(Record, typeof(DNS_TXT_DATA));
         case QueryTypes.DNS_TYPE_AFSDB:
         case QueryTypes.DNS_TYPE_RT:
         case QueryTypes.DNS_TYPE_MX:
         case QueryTypes.DNS_TYPE_RP:
             return Marshal.PtrToStructure(Record, typeof(DNS_MX_DATA));
         case QueryTypes.DNS_TYPE_MINFO:
             return Marshal.PtrToStructure(Record, typeof(DNS_MINFO_DATA));
         case QueryTypes.DNS_TYPE_SOA:
             return Marshal.PtrToStructure(Record, typeof(DNS_SOA_DATA));
         case QueryTypes.DNS_TYPE_NULL:
             return Marshal.PtrToStructure(Record, typeof(DNS_NULL_DATA));
         case QueryTypes.DNS_TYPE_WKS:
             return Marshal.PtrToStructure(Record, typeof(DNS_WKS_DATA));
         case QueryTypes.DNS_TYPE_SIG:
             return Marshal.PtrToStructure(Record, typeof(DNS_SIG_DATA));
         case QueryTypes.DNS_TYPE_KEY:
             return Marshal.PtrToStructure(Record, typeof(DNS_KEY_DATA));
         case QueryTypes.DNS_TYPE_AAAA:
             return Marshal.PtrToStructure(Record, typeof(DNS_AAAA_DATA));
         case QueryTypes.DNS_TYPE_NXT:
             return Marshal.PtrToStructure(Record, typeof(DNS_NXT_DATA));
         case QueryTypes.DNS_TYPE_SRV:
             return Marshal.PtrToStructure(Record, typeof(DNS_SRV_DATA));
         case QueryTypes.DNS_TYPE_ATMA:
             return Marshal.PtrToStructure(Record, typeof(DNS_ATMA_DATA));
         case QueryTypes.DNS_TYPE_NAPTR:
             return Marshal.PtrToStructure(Record, typeof(DNS_NAPTR_DATA));
         case QueryTypes.DNS_TYPE_OPT:
             return Marshal.PtrToStructure(Record, typeof(DNS_OPT_DATA));
         case QueryTypes.DNS_TYPE_DS:
             return Marshal.PtrToStructure(Record, typeof(DNS_DS_DATA));
         case QueryTypes.DNS_TYPE_RRSIG:
             return Marshal.PtrToStructure(Record, typeof(DNS_RRSIG_DATA));
         case QueryTypes.DNS_TYPE_NSEC:
             return Marshal.PtrToStructure(Record, typeof(DNS_NSEC_DATA));
         case QueryTypes.DNS_TYPE_DNSKEY:
             return Marshal.PtrToStructure(Record, typeof(DNS_DNSKEY_DATA));
         case QueryTypes.DNS_TYPE_DHCID:
             return Marshal.PtrToStructure(Record, typeof(DNS_DHCID_DATA));
         case QueryTypes.DNS_TYPE_TKEY:
             return Marshal.PtrToStructure(Record, typeof(DNS_TKEY_DATA));
         case QueryTypes.DNS_TYPE_TSIG:
             return Marshal.PtrToStructure(Record, typeof(DNS_TSIG_DATA));
         case QueryTypes.DNS_TYPE_WINS:
         case QueryTypes.DNS_TYPE_WINSR:
             return Marshal.PtrToStructure(Record, typeof(DNS_WINS_DATA));
         case QueryTypes.DNS_TYPE_UINFO:
         case QueryTypes.DNS_TYPE_UID:
         case QueryTypes.DNS_TYPE_GID:
         case QueryTypes.DNS_TYPE_UNSPEC:
         case QueryTypes.DNS_TYPE_ADDRS:
         case QueryTypes.DNS_TYPE_IXFR:
         case QueryTypes.DNS_TYPE_AXFR:
         case QueryTypes.DNS_TYPE_MAILB:
         case QueryTypes.DNS_TYPE_MAILA:
         case QueryTypes.DNS_TYPE_ALL:
         case QueryTypes.DNS_TYPE_SINK:
         case QueryTypes.DNS_TYPE_KX:
         case QueryTypes.DNS_TYPE_CERT:
         case QueryTypes.DNS_TYPE_A6:
         case QueryTypes.DNS_TYPE_EID:
         case QueryTypes.DNS_TYPE_NIMLOC:
         case QueryTypes.DNS_TYPE_LOC:
         case QueryTypes.DNS_TYPE_PX:
         case QueryTypes.DNS_TYPE_GPOS:
         case QueryTypes.DNS_TYPE_NSAP:
         case QueryTypes.DNS_TYPE_NSAPPTR:
             break;
     }
     throw new Exception(string.Format("Unsupported Record type: {0}", t));
 }
コード例 #35
0
ファイル: Global.cs プロジェクト: davelondon/dontstayin
		public static void LogSqlQuery(QueryTypes QueryType, int Count)
		{
			if (HttpContext.Current != null)
			{
				string item = "";
				if (QueryType.Equals(QueryTypes.Select))
					item = "DbQueriesSelect";
				else if (QueryType.Equals(QueryTypes.Update))
					item = "DbQueriesUpdate";
				else if (QueryType.Equals(QueryTypes.Insert))
					item = "DbQueriesInsert";
				else if (QueryType.Equals(QueryTypes.Delete))
					item = "DbQueriesDelete";
				else
					item = "DbQueries";


				if (HttpContext.Current.Items[item] == null)
					HttpContext.Current.Items[item] = 0;
				else
					HttpContext.Current.Items[item] = ((int)HttpContext.Current.Items[item]) + Count;
			}
		}
コード例 #36
0
ファイル: clsDns.cs プロジェクト: AyrA/Mailinator-Check
        /// <summary>
        /// Looks up a type of DNS record
        /// </summary>
        /// <param name="DnsName">Query</param>
        /// <param name="LookupType">lookup type</param>
        /// <returns>Record collection</returns>
        public static RecordCollection Lookup(string DnsName,QueryTypes LookupType)
        {
            IntPtr ptr=IntPtr.Zero;
            IntPtr temp=IntPtr.Zero;
            RecordCollection RC=null;
            DnsRecord DNSR;

            //INFO: I have commented what is the custom DNS option.
            //INFO: It was unreliable for me.
            //int intAddress = BitConverter.ToInt32(IPAddress.Parse("8.8.8.8").GetAddressBytes(), 0);
            int result=DnsQuery(ref DnsName,
                LookupType,
                QueryOptions.DNS_QUERY_STANDARD,
                0/*intAddress*/,ref ptr, 0);

            if (result == 0)
            {
                for (temp = ptr; !temp.Equals(IntPtr.Zero); temp = DNSR.pNext)
                {
                    DNSR = (DnsRecord)Marshal.PtrToStructure(temp, typeof(DnsRecord));
                    if(RC==null)
                    {
                        RC=new RecordCollection(temp,DNSR);
                    }
                    if (Marshal.PtrToStringAuto(DNSR.pName).ToLower() == DnsName.ToLower())
                    {
            #if XX_DEBUG_XX
                        Console.WriteLine("{0} {1} {2} {3}",
                            Marshal.PtrToStringAuto(DNSR.pName),
                            DNSR.wType,
                            DNSR.wDataLength,
                            new IPAddress(BitConverter.GetBytes((uint)DNSR.Record.ToInt64()))
                            );
            #endif
                        RC.Add((QueryTypes)DNSR.wType, getRecord((QueryTypes)DNSR.wType, temp));
                    }
                }
            }
            else
            {
                //throw new Win32Exception(result);
                return null;
            }
            return RC;
        }
コード例 #37
0
ファイル: Global.cs プロジェクト: davelondon/dontstayin
		public static void LogSqlQuery(QueryTypes QueryType) { LogSqlQuery(QueryType, 1); }
コード例 #38
0
ファイル: QueryManager.cs プロジェクト: nkravch/SALMA-2.0
        private StackPanel CreateTreeItem(string value, QueryTypes type)
        {
            var stake = new StackPanel { Orientation = Orientation.Horizontal };

            var img = new Image { Stretch = Stretch.Uniform, Source = GetImage(type) };
            var lbl = new Label { Content = value };

            stake.Children.Add(img);
            stake.Children.Add(lbl);

            return stake;
        }
コード例 #39
0
ファイル: QueryManager.cs プロジェクト: nkravch/SALMA-2.0
 static ImageSource GetImage(QueryTypes type)
 {
     try
     {
         switch (type)
         {
             case QueryTypes.MyQ:
                 return WindowFactory.IconConverter(Icons.MyQueries, 16, 16);
             case QueryTypes.TeamQ:
                 return WindowFactory.IconConverter(Icons.TeamQueries, 16, 16);
             case QueryTypes.Folder:
                 return WindowFactory.IconConverter(Icons.Folder, 16, 16);
             case QueryTypes.FView:
                 return WindowFactory.IconConverter(Icons.FlatView, 16, 16);
             case QueryTypes.DView:
                 return WindowFactory.IconConverter(Icons.DirectView, 16, 16);
             case QueryTypes.HView:
                 return WindowFactory.IconConverter(Icons.HierarchicalView, 16, 16);
             default:
                 return null;
         }
     }
     catch 
     {
         return null;
     }
 }
コード例 #40
0
ファイル: Query.cs プロジェクト: dzstoever/ZenFacades
 public Query(QueryTypes qType)
 {
     QueryType = qType;
 }
コード例 #41
0
ファイル: DnsTools.cs プロジェクト: kstaruch/Toxy
 private static extern int DnsQuery([MarshalAs(UnmanagedType.VBByRefStr)]ref string pszName, QueryTypes wType, QueryOptions options, int aipServers, ref IntPtr ppQueryResults, int pReserved);
コード例 #42
0
 private static StackPanel CreateTreeItem(string value, QueryTypes type)
 {
     var stake = new StackPanel {Orientation = Orientation.Horizontal, Margin=new Thickness(2, 2, 0, 2)};
       var img = new Image
             {
               Stretch = System.Windows.Media.Stretch.Uniform,
               Source = GetImage(type),
               Margin = new Thickness(0, 0, 5, 0)
             };
       var lbl = new TextBlock {Text = value};
       stake.Children.Add(img);
       stake.Children.Add(lbl);
       return stake;
 }
コード例 #43
0
 static BitmapSource GetImage(QueryTypes type)
 {
     switch (type)
       {
     case QueryTypes.MyQ:
       return DisplayImage.GetImageSource(Properties.Resources.MyQ);
     case QueryTypes.TeamQ:
       return DisplayImage.GetImageSource(Properties.Resources.TeamQ);
     case QueryTypes.Folder:
       return DisplayImage.GetImageSource(Properties.Resources.Folder);
     case QueryTypes.FView:
       return DisplayImage.GetImageSource(Properties.Resources.FView);
     case QueryTypes.DView:
       return DisplayImage.GetImageSource(Properties.Resources.DView);
     case QueryTypes.HView:
       return DisplayImage.GetImageSource(Properties.Resources.HView);
     default:
       return null;
       }
 }