예제 #1
0
파일: t1701.cs 프로젝트: tdoobw/XingAPI
        public static XQt1701OutBlock[] ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun = default,string fromdt = default,string todt = default,long prapp = default,char prgubun = default,char orggubun = default,char frggubun = default */)
        {
            using (XQt1701 instance = new XQt1701())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt1701OutBlock" : $"XQt1701OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (shcode != default) qo.Add("shcode", shcode);
                // if (gubun != default) qo.Add("gubun", gubun);
                // if (fromdt != default) qo.Add("fromdt", fromdt);
                // if (todt != default) qo.Add("todt", todt);
                // if (prapp != default) qo.Add("prapp", prapp);
                // if (prgubun != default) qo.Add("prgubun", prgubun);
                // if (orggubun != default) qo.Add("orggubun", orggubun);
                // if (frggubun != default) qo.Add("frggubun", frggubun);


                var outBlock = instance.SelectMany <XQt1701OutBlock>(qo);
                return(outBlock);
            }
        }
예제 #2
0
        public static XQt1701OutBlock[] Get(string shcode = default, char gubun = default, string fromdt = default, string todt = default, long prapp = default, char prgubun = default, char orggubun = default, char frggubun = default)
        {
            using (XQt1701 instance = new XQt1701())
            {
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.shcode, 0, shcode);                // char 6
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.gubun, 0, gubun.ToString());       // char 1
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.fromdt, 0, fromdt);                // char 8
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.todt, 0, todt);                    // char 8
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.prapp, 0, prapp.ToString("d3"));   // long 3
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.prgubun, 0, prgubun.ToString());   // char 1
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.orggubun, 0, orggubun.ToString()); // char 1
                instance.SetFieldData(XQt1701InBlock.BlockName, XQt1701InBlock.F.frggubun, 0, frggubun.ToString()); // char 1

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

                var outBlock = instance.GetBlocks();
                return(outBlock);
            }
        }
예제 #3
0
        public static XQt1701OutBlock[] ListFromQuery(XQt1701 query)
        {
            int count = query.GetBlockCount(XQt1701OutBlock.BlockName);
            List <XQt1701OutBlock> list = new List <XQt1701OutBlock>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1701OutBlock block = new XQt1701OutBlock();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date         = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                      // char 8
                    block.close        = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");               // 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.psnvolume    = query.GetFieldData(block.GetBlockName(), "psnvolume", i).ParseLong("psnvolume");       // long 12
                    block.orgvolume    = query.GetFieldData(block.GetBlockName(), "orgvolume", i).ParseLong("orgvolume");       // long 12
                    block.frgvolume    = query.GetFieldData(block.GetBlockName(), "frgvolume", i).ParseLong("frgvolume");       // long 12
                    block.frgvolumesum = query.GetFieldData(block.GetBlockName(), "frgvolumesum", i).ParseLong("frgvolumesum"); // long 12
                    block.pgmvolume    = query.GetFieldData(block.GetBlockName(), "pgmvolume", i).ParseLong("pgmvolume");       // long 12
                    block.listing      = query.GetFieldData(block.GetBlockName(), "listing", i).ParseLong("listing");           // long 12
                    block.listupdn     = query.GetFieldData(block.GetBlockName(), "listupdn", i).ParseLong("listupdn");         // long 12
                    block.sjrate       = query.GetFieldData(block.GetBlockName(), "sjrate", i).ParseFloat("sjrate");            // float 6.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }