Esempio n. 1
0
        public static XQt1941OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string sdate = default,string edate = default */)
        {
            using (XQt1941 instance = new XQt1941())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1941OutBlock1" : $"XQt1941OutBlock1_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (shcode != default) qo.Add("shcode", shcode);
                // if (sdate != default) qo.Add("sdate", sdate);
                // if (edate != default) qo.Add("edate", edate);


                var outBlock = instance.SelectMany <XQt1941OutBlock1>(qo);
                return(outBlock);
            }
        }
Esempio n. 2
0
        public static XQt1941OutBlock1[] Get(string shcode = default, string sdate = default, string edate = default)
        {
            using (XQt1941 instance = new XQt1941())
            {
                instance.SetFieldData(XQt1941InBlock.BlockName, XQt1941InBlock.F.shcode, 0, shcode);               // char 6
                instance.SetFieldData(XQt1941InBlock.BlockName, XQt1941InBlock.F.sdate, 0, sdate);                 // char 8
                instance.SetFieldData(XQt1941InBlock.BlockName, XQt1941InBlock.F.edate, 0, edate);                 // char 8

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Esempio n. 3
0
        public static XQt1941OutBlock1[] ListFromQuery(XQt1941 query)
        {
            int count = query.GetBlockCount(XQt1941OutBlock1.BlockName);
            List <XQt1941OutBlock1> list = new List <XQt1941OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1941OutBlock1 block = new XQt1941OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date     = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                 // char 8
                    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.volume   = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");        // long 12
                    block.upvolume = query.GetFieldData(block.GetBlockName(), "upvolume", i).ParseLong("upvolume");    // long 12
                    block.dnvolume = query.GetFieldData(block.GetBlockName(), "dnvolume", i).ParseLong("dnvolume");    // long 12
                    block.tovolume = query.GetFieldData(block.GetBlockName(), "tovolume", i).ParseLong("tovolume");    // long 12
                    block.tovalue  = query.GetFieldData(block.GetBlockName(), "tovalue", i).ParseLong("tovalue");      // long 12
                    block.shcode   = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');               // char 6
                    block.tovoldif = query.GetFieldData(block.GetBlockName(), "tovoldif", i).ParseLong("tovoldif");    // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }