Пример #1
0
        public static XQt1638OutBlock[] ReadFromDB(string tableNamePostfix = null /*, char gubun1 = default,string shcode = default,char gubun2 = default */)
        {
            using (XQt1638 instance = new XQt1638())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1638OutBlock" : $"XQt1638OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (gubun1 != default) qo.Add("gubun1", gubun1);
                // if (shcode != default) qo.Add("shcode", shcode);
                // if (gubun2 != default) qo.Add("gubun2", gubun2);


                var outBlock = instance.SelectMany <XQt1638OutBlock>(qo);
                return(outBlock);
            }
        }
Пример #2
0
        public static XQt1638OutBlock[] Get(char gubun1 = default, string shcode = default, char gubun2 = default)
        {
            using (XQt1638 instance = new XQt1638())
            {
                instance.SetFieldData(XQt1638InBlock.BlockName, XQt1638InBlock.F.gubun1, 0, gubun1.ToString());      // char 1
                instance.SetFieldData(XQt1638InBlock.BlockName, XQt1638InBlock.F.shcode, 0, shcode);                 // char 6
                instance.SetFieldData(XQt1638InBlock.BlockName, XQt1638InBlock.F.gubun2, 0, gubun2.ToString());      // char 1

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

                var outBlock = instance.GetBlocks();
                return(outBlock);
            }
        }
Пример #3
0
        public static XQt1638OutBlock[] ListFromQuery(XQt1638 query)
        {
            int count = query.GetBlockCount(XQt1638OutBlock.BlockName);
            List <XQt1638OutBlock> list = new List <XQt1638OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1638OutBlock block = new XQt1638OutBlock();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.rank      = query.GetFieldData(block.GetBlockName(), "rank", i).ParseLong("rank");             // long 4
                    block.hname     = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                 // char 20
                    block.price     = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");           // long 8
                    block.sign      = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();              // char 1
                    block.change    = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change");         // long 8
                    block.diff      = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");            // float 6.2
                    block.sigatotrt = query.GetFieldData(block.GetBlockName(), "sigatotrt", i).ParseFloat("sigatotrt");  // float 6.2
                    block.obuyvol   = query.GetFieldData(block.GetBlockName(), "obuyvol", i).ParseLong("obuyvol");       // long 12
                    block.buyrem    = query.GetFieldData(block.GetBlockName(), "buyrem", i).ParseLong("buyrem");         // long 12
                    block.psgvolume = query.GetFieldData(block.GetBlockName(), "psgvolume", i).ParseLong("psgvolume");   // long 12
                    block.sellrem   = query.GetFieldData(block.GetBlockName(), "sellrem", i).ParseLong("sellrem");       // long 12
                    block.pdgvolume = query.GetFieldData(block.GetBlockName(), "pdgvolume", i).ParseLong("pdgvolume");   // long 12
                    block.sigatot   = query.GetFieldData(block.GetBlockName(), "sigatot", i).ParseLong("sigatot");       // long 20
                    block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                // char 6
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }