Exemple #1
0
        public static XQt1959OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default */)
        {
            using (XQt1959 instance = new XQt1959())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1959OutBlock1" : $"XQt1959OutBlock1_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (shcode != default) qo.Add("shcode", shcode);


                var outBlock = instance.SelectMany <XQt1959OutBlock1>(qo);
                return(outBlock);
            }
        }
Exemple #2
0
        public static XQt1959OutBlock1[] Get(string shcode = default)
        {
            using (XQt1959 instance = new XQt1959())
            {
                instance.SetFieldData(XQt1959InBlock.BlockName, XQt1959InBlock.F.shcode, 0, shcode);                 // char 6

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemple #3
0
        public static XQt1959OutBlock1[] ListFromQuery(XQt1959 query)
        {
            int count = query.GetBlockCount(XQt1959OutBlock1.BlockName);
            List <XQt1959OutBlock1> list = new List <XQt1959OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1959OutBlock1 block = new XQt1959OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.shcode      = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');               // char 6
                    block.hname       = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                // char 40
                    block.price       = query.GetFieldData(block.GetBlockName(), "price", i).TrimEnd('?');                // char 12
                    block.sign        = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();             // char 1
                    block.change      = query.GetFieldData(block.GetBlockName(), "change", i).TrimEnd('?');               // char 12
                    block.rate        = query.GetFieldData(block.GetBlockName(), "rate", i).ParseFloat("rate");           // float 5.2
                    block.volume      = query.GetFieldData(block.GetBlockName(), "volume", i).TrimEnd('?');               // char 12
                    block.value       = query.GetFieldData(block.GetBlockName(), "value", i).TrimEnd('?');                // char 12
                    block.lp_gb       = query.GetFieldData(block.GetBlockName(), "lp_gb", i).TrimEnd('?');                // char 4
                    block.lp_mem_nm1  = query.GetFieldData(block.GetBlockName(), "lp_mem_nm1", i).TrimEnd('?');           // char 20
                    block.lp_mem_nm2  = query.GetFieldData(block.GetBlockName(), "lp_mem_nm2", i).TrimEnd('?');           // char 20
                    block.lp_mem_nm3  = query.GetFieldData(block.GetBlockName(), "lp_mem_nm3", i).TrimEnd('?');           // char 20
                    block.lp_mem_nm4  = query.GetFieldData(block.GetBlockName(), "lp_mem_nm4", i).TrimEnd('?');           // char 20
                    block.lp_mem_nm5  = query.GetFieldData(block.GetBlockName(), "lp_mem_nm5", i).TrimEnd('?');           // char 20
                    block.lp_min_qty  = query.GetFieldData(block.GetBlockName(), "lp_min_qty", i).TrimEnd('?');           // char 10
                    block.lp_st_date  = query.GetFieldData(block.GetBlockName(), "lp_st_date", i).TrimEnd('?');           // char 8
                    block.lp_end_date = query.GetFieldData(block.GetBlockName(), "lp_end_date", i).TrimEnd('?');          // char 8
                    block.lp_spread   = query.GetFieldData(block.GetBlockName(), "lp_spread", i).ParseFloat("lp_spread"); // float 5.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }