Esempio n. 1
0
        public static XQAllOutBlocks Get(char fo_gbn = default, string yyyy = default, string mm = default, char cp_gbn = default, float actprice = default, string focode = default, char dt_gbn = default, string min_term = default, string date = default, string time = default)
        {
            using (XQt8427 instance = new XQt8427())
            {
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.fo_gbn, 0, fo_gbn.ToString());                // char 1
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.yyyy, 0, yyyy);                               // char 4
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.mm, 0, mm);                                   // char 2
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.cp_gbn, 0, cp_gbn.ToString());                // char 1
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.actprice, 0, actprice.ToString("000000.00")); // float 6.2
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.focode, 0, focode);                           // char 8
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.dt_gbn, 0, dt_gbn.ToString());                // char 1
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.min_term, 0, min_term);                       // char 2
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.date, 0, date);                               // char 8
                instance.SetFieldData(XQt8427InBlock.BlockName, XQt8427InBlock.F.time, 0, time);                               // char 6

                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);
            }
        }
Esempio n. 2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, char fo_gbn = default,string yyyy = default,string mm = default,char cp_gbn = default,float actprice = default,string focode = default,char dt_gbn = default,string min_term = default,string date = default,string time = default */)
        {
            using (XQt8427 instance = new XQt8427())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt8427OutBlock1" : $"XQt8427OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt8427OutBlock1>(qo);
                return(results);
            }
        }
Esempio n. 3
0
        public static XQt8427OutBlock1[] ListFromQuery(XQt8427 query)
        {
            int count = query.GetBlockCount(XQt8427OutBlock1.BlockName);
            List <XQt8427OutBlock1> list = new List <XQt8427OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8427OutBlock1 block = new XQt8427OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date        = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                    // char 8
                    block.time        = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                    // char 6
                    block.open        = query.GetFieldData(block.GetBlockName(), "open", i).ParseFloat("open");              // float 6.2
                    block.high        = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high");              // float 6.2
                    block.low         = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low");                // float 6.2
                    block.close       = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close");            // float 6.2
                    block.sign        = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                // char 1
                    block.change      = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");          // float 6.2
                    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.diff_vol    = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol");      // float 10.2
                    block.openyak     = query.GetFieldData(block.GetBlockName(), "openyak", i).ParseLong("openyak");         // long 8
                    block.openyakupdn = query.GetFieldData(block.GetBlockName(), "openyakupdn", i).ParseLong("openyakupdn"); // long 8
                    block.value       = query.GetFieldData(block.GetBlockName(), "value", i).ParseFloat("value");            // float 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Esempio n. 4
0
        public static XQt8427OutBlock FromQuery(XQt8427 query)
        {
            XQt8427OutBlock block = new XQt8427OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.focode = query.GetFieldData(block.GetBlockName(), "focode", 0).TrimEnd('?');             // char 8
                block.date   = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?');               // char 8
                block.time   = query.GetFieldData(block.GetBlockName(), "time", 0).TrimEnd('?');               // char 6
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }