Exemplo n.º 1
0
        public static XQt2105OutBlock ReadFromDB(string tableNamePostfix = null /*, string shcode = default */)
        {
            using (XQt2105 instance = new XQt2105())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt2105OutBlock" : $"XQt2105OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (shcode != default) qo.Add("shcode", shcode);


                var outBlock = instance.Select <XQt2105OutBlock>(qo);
                return(outBlock);
            }
        }
Exemplo n.º 2
0
        public static XQt2105OutBlock Get(string shcode = default)
        {
            using (XQt2105 instance = new XQt2105())
            {
                instance.SetFieldData(XQt2105InBlock.BlockName, XQt2105InBlock.F.shcode, 0, shcode);                 // char 8

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

                var outBlock = instance.GetBlock();
                if (outBlock.IsValidData == false)
                {
                    return(null);
                }
                return(outBlock);
            }
        }
Exemplo n.º 3
0
        public static XQt2105OutBlock FromQuery(XQt2105 query)
        {
            XQt2105OutBlock block = new XQt2105OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.hname     = query.GetFieldData(block.GetBlockName(), "hname", 0).TrimEnd('?');                // char 20
                block.price     = query.GetFieldData(block.GetBlockName(), "price", 0).ParseFloat("price");         // float 6.2
                block.sign      = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();             // char 1
                block.change    = query.GetFieldData(block.GetBlockName(), "change", 0).ParseFloat("change");       // float 6.2
                block.diff      = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff");           // float 6.2
                block.volume    = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume");        // long 12
                block.stimeqrt  = query.GetFieldData(block.GetBlockName(), "stimeqrt", 0).ParseFloat("stimeqrt");   // float 6.2
                block.jnilclose = query.GetFieldData(block.GetBlockName(), "jnilclose", 0).ParseFloat("jnilclose"); // float 6.2
                block.offerho1  = query.GetFieldData(block.GetBlockName(), "offerho1", 0).ParseFloat("offerho1");   // float 6.2
                block.bidho1    = query.GetFieldData(block.GetBlockName(), "bidho1", 0).ParseFloat("bidho1");       // float 6.2
                block.offerrem1 = query.GetFieldData(block.GetBlockName(), "offerrem1", 0).ParseLong("offerrem1");  // long 8
                block.bidrem1   = query.GetFieldData(block.GetBlockName(), "bidrem1", 0).ParseLong("bidrem1");      // long 8
                block.dcnt1     = query.GetFieldData(block.GetBlockName(), "dcnt1", 0).ParseLong("dcnt1");          // long 8
                block.scnt1     = query.GetFieldData(block.GetBlockName(), "scnt1", 0).ParseLong("scnt1");          // long 8
                block.offerho2  = query.GetFieldData(block.GetBlockName(), "offerho2", 0).ParseFloat("offerho2");   // float 6.2
                block.bidho2    = query.GetFieldData(block.GetBlockName(), "bidho2", 0).ParseFloat("bidho2");       // float 6.2
                block.offerrem2 = query.GetFieldData(block.GetBlockName(), "offerrem2", 0).ParseLong("offerrem2");  // long 8
                block.bidrem2   = query.GetFieldData(block.GetBlockName(), "bidrem2", 0).ParseLong("bidrem2");      // long 8
                block.dcnt2     = query.GetFieldData(block.GetBlockName(), "dcnt2", 0).ParseLong("dcnt2");          // long 8
                block.scnt2     = query.GetFieldData(block.GetBlockName(), "scnt2", 0).ParseLong("scnt2");          // long 8
                block.offerho3  = query.GetFieldData(block.GetBlockName(), "offerho3", 0).ParseFloat("offerho3");   // float 6.2
                block.bidho3    = query.GetFieldData(block.GetBlockName(), "bidho3", 0).ParseFloat("bidho3");       // float 6.2
                block.offerrem3 = query.GetFieldData(block.GetBlockName(), "offerrem3", 0).ParseLong("offerrem3");  // long 8
                block.bidrem3   = query.GetFieldData(block.GetBlockName(), "bidrem3", 0).ParseLong("bidrem3");      // long 8
                block.dcnt3     = query.GetFieldData(block.GetBlockName(), "dcnt3", 0).ParseLong("dcnt3");          // long 8
                block.scnt3     = query.GetFieldData(block.GetBlockName(), "scnt3", 0).ParseLong("scnt3");          // long 8
                block.offerho4  = query.GetFieldData(block.GetBlockName(), "offerho4", 0).ParseFloat("offerho4");   // float 6.2
                block.bidho4    = query.GetFieldData(block.GetBlockName(), "bidho4", 0).ParseFloat("bidho4");       // float 6.2
                block.offerrem4 = query.GetFieldData(block.GetBlockName(), "offerrem4", 0).ParseLong("offerrem4");  // long 8
                block.bidrem4   = query.GetFieldData(block.GetBlockName(), "bidrem4", 0).ParseLong("bidrem4");      // long 8
                block.dcnt4     = query.GetFieldData(block.GetBlockName(), "dcnt4", 0).ParseLong("dcnt4");          // long 8
                block.scnt4     = query.GetFieldData(block.GetBlockName(), "scnt4", 0).ParseLong("scnt4");          // long 8
                block.offerho5  = query.GetFieldData(block.GetBlockName(), "offerho5", 0).ParseFloat("offerho5");   // float 6.2
                block.bidho5    = query.GetFieldData(block.GetBlockName(), "bidho5", 0).ParseFloat("bidho5");       // float 6.2
                block.offerrem5 = query.GetFieldData(block.GetBlockName(), "offerrem5", 0).ParseLong("offerrem5");  // long 8
                block.bidrem5   = query.GetFieldData(block.GetBlockName(), "bidrem5", 0).ParseLong("bidrem5");      // long 8
                block.dcnt5     = query.GetFieldData(block.GetBlockName(), "dcnt5", 0).ParseLong("dcnt5");          // long 8
                block.scnt5     = query.GetFieldData(block.GetBlockName(), "scnt5", 0).ParseLong("scnt5");          // long 8
                block.dvol      = query.GetFieldData(block.GetBlockName(), "dvol", 0).ParseLong("dvol");            // long 8
                block.svol      = query.GetFieldData(block.GetBlockName(), "svol", 0).ParseLong("svol");            // long 8
                block.toffernum = query.GetFieldData(block.GetBlockName(), "toffernum", 0).ParseLong("toffernum");  // long 8
                block.tbidnum   = query.GetFieldData(block.GetBlockName(), "tbidnum", 0).ParseLong("tbidnum");      // long 8
                block.time      = query.GetFieldData(block.GetBlockName(), "time", 0).TrimEnd('?');                 // char 6
                block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", 0).TrimEnd('?');               // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }