示例#1
0
文件: t1966.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks Get(char gubun = default, string ggubun = default, string itemcode = default, string lastdate = default, string exgubun = default, long sprice = default, long eprice = default, long volume = default, long sjanday = default, long ejanday = default, long idx = default)
        {
            using (XQt1966 instance = new XQt1966())
            {
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.gubun, 0, gubun.ToString());         // char 1
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.ggubun, 0, ggubun);                  // char 2
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.itemcode, 0, itemcode);              // char 12
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.lastdate, 0, lastdate);              // char 8
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.exgubun, 0, exgubun);                // char 6
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.sprice, 0, sprice.ToString("d8"));   // long 8
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.eprice, 0, eprice.ToString("d8"));   // long 8
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.volume, 0, volume.ToString("d12"));  // long 12
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.sjanday, 0, sjanday.ToString("d8")); // long 8
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.ejanday, 0, ejanday.ToString("d8")); // long 8
                instance.SetFieldData(XQt1966InBlock.BlockName, XQt1966InBlock.F.idx, 0, idx.ToString("d4"));         // long 4

                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);
            }
        }
示例#2
0
文件: t1966.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char gubun = default,string ggubun = default,string itemcode = default,string lastdate = default,string exgubun = default,long sprice = default,long eprice = default,long volume = default,long sjanday = default,long ejanday = default,long idx = default */)
        {
            using (XQt1966 instance = new XQt1966())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1966OutBlock1" : $"XQt1966OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1966OutBlock1>(qo);
                return(results);
            }
        }
示例#3
0
文件: t1966.cs 项目: tdoobw/XingAPI
        public static XQt1966OutBlock1[] ListFromQuery(XQt1966 query)
        {
            int count = query.GetBlockCount(XQt1966OutBlock1.BlockName);
            List <XQt1966OutBlock1> list = new List <XQt1966OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1966OutBlock1 block = new XQt1966OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname      = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                 // char 40
                    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.value      = query.GetFieldData(block.GetBlockName(), "value", i).ParseDouble("value");         // double 12.0
                    block.jnilvalue  = query.GetFieldData(block.GetBlockName(), "jnilvalue", i).ParseDouble("jnilvalue"); // double 12.0
                    block.elwexec    = query.GetFieldData(block.GetBlockName(), "elwexec", i).ParseDouble("elwexec");     // double 10.2
                    block.convrate   = query.GetFieldData(block.GetBlockName(), "convrate", i).ParseDouble("convrate");   // double 12.4
                    block.lastdate   = query.GetFieldData(block.GetBlockName(), "lastdate", i).TrimEnd('?');              // char 8
                    block.itemcode   = query.GetFieldData(block.GetBlockName(), "itemcode", i).TrimEnd('?');              // char 12
                    block.itemshcode = query.GetFieldData(block.GetBlockName(), "itemshcode", i).TrimEnd('?');            // char 9
                    block.itemname   = query.GetFieldData(block.GetBlockName(), "itemname", i).TrimEnd('?');              // char 20
                    block.itemprice  = query.GetFieldData(block.GetBlockName(), "itemprice", i).TrimEnd('?');             // char 10
                    block.itemsign   = query.GetFieldData(block.GetBlockName(), "itemsign", i).FirstOrDefault();          // char 1
                    block.itemchange = query.GetFieldData(block.GetBlockName(), "itemchange", i).TrimEnd('?');            // char 10
                    block.itemdiff   = query.GetFieldData(block.GetBlockName(), "itemdiff", i).ParseDouble("itemdiff");   // double 6.2
                    block.elwshcode  = query.GetFieldData(block.GetBlockName(), "elwshcode", i).TrimEnd('?');             // char 6
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
示例#4
0
文件: t1966.cs 项目: tdoobw/XingAPI
        public static XQt1966OutBlock FromQuery(XQt1966 query)
        {
            XQt1966OutBlock block = new XQt1966OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.idx = query.GetFieldData(block.GetBlockName(), "idx", 0).ParseLong("idx");                 // long 4
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }