Exemple #1
0
        public static XQt1857OutBlock1[] ListFromQuery(XQt1857 query)
        {
            int count = query.GetBlockCount(XQt1857OutBlock1.BlockName);
            List <XQt1857OutBlock1> list = new List <XQt1857OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1857OutBlock1 block = new XQt1857OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.shcode  = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                  // char 7
                    block.hname   = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                   // char 40
                    block.price   = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");             // long 9
                    block.sign    = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                // char 1
                    block.change  = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change");           // long 9
                    block.diff    = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");              // float 6
                    block.volume  = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");           // long 12
                    block.JobFlag = query.GetFieldData(block.GetBlockName(), "JobFlag", i).FirstOrDefault();             // char 1
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemple #2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char sRealFlag = default,char sSearchFlag = default,string query_index = default */)
        {
            using (XQt1857 instance = new XQt1857())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

                string      tableName = (tableNamePostfix == null) ? "XQt1857OutBlock" : $"XQt1857OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                results.OutBlock = instance.Select <XQt1857OutBlock>(qo);

                tableName         = (tableNamePostfix == null) ? "XQt1857OutBlock1" : $"XQt1857OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1857OutBlock1>(qo);
                return(results);
            }
        }
Exemple #3
0
        public static XQt1857OutBlock1[] Get(char sRealFlag = default, char sSearchFlag = default, string query_index = default)
        {
            using (XQt1857 instance = new XQt1857())
            {
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.sRealFlag, 0, sRealFlag.ToString());          // char 1
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.sSearchFlag, 0, sSearchFlag.ToString());      // char 1
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.query_index, 0, query_index);                 // char 256

                if (instance.Request() < 0)
                {
                    return(null);
                }

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemple #4
0
        public static XQt1857OutBlock FromQuery(XQt1857 query)
        {
            XQt1857OutBlock block = new XQt1857OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.result_count = query.GetFieldData(block.GetBlockName(), "result_count", 0).ParseLong("result_count"); // long 5
                block.result_time  = query.GetFieldData(block.GetBlockName(), "result_time", 0).TrimEnd('?');               // char 6
                block.AlertNum     = query.GetFieldData(block.GetBlockName(), "AlertNum", 0).TrimEnd('?');                  // char 11
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Exemple #5
0
        public static XQAllOutBlocks Get(char sRealFlag = default, char sSearchFlag = default, string query_index = default)
        {
            using (XQt1857 instance = new XQt1857())
            {
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.sRealFlag, 0, sRealFlag.ToString());          // char 1
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.sSearchFlag, 0, sSearchFlag.ToString());      // char 1
                instance.SetFieldData(XQt1857InBlock.BlockName, XQt1857InBlock.F.query_index, 0, query_index);                 // char 256

                if (instance.Request() < 0)
                {
                    return(null);
                }

                XQAllOutBlocks results = new XQAllOutBlocks();
                results.OutBlock = instance.GetBlock();
                if (results.OutBlock.IsValidData == false)
                {
                    return(null);
                }

                results.OutBlock1 = instance.GetBlock1s();
                return(results);
            }
        }