Пример #1
0
        public static XQAllOutBlocks Get(long indexid = default, string indexname = default, string indexparam = default, char indexouttype = default, char market = default, char period = default, string shcode = default, char isexcelout = default, string excelfilename = default, char IsReal = default)
        {
            using (XQCHARTEXCEL instance = new XQCHARTEXCEL())
            {
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.indexid, 0, indexid.ToString("d10"));      // long 10
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.indexname, 0, indexname);                  // char 40
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.indexparam, 0, indexparam);                // char 40
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.indexouttype, 0, indexouttype.ToString()); // char 1
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.market, 0, market.ToString());             // char 1
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.period, 0, period.ToString());             // char 1
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.shcode, 0, shcode);                        // char 8
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.isexcelout, 0, isexcelout.ToString());     // char 1
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.excelfilename, 0, excelfilename);          // char 256
                instance.SetFieldData(XQChartExcelInBlock.BlockName, XQChartExcelInBlock.F.IsReal, 0, IsReal.ToString());             // char 1

                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
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, long indexid = default,string indexname = default,string indexparam = default,char indexouttype = default,char market = default,char period = default,string shcode = default,char isexcelout = default,string excelfilename = default,char IsReal = default */)
        {
            using (XQCHARTEXCEL instance = new XQCHARTEXCEL())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQChartExcelOutBlock1" : $"XQChartExcelOutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQChartExcelOutBlock1>(qo);
                return(results);
            }
        }
Пример #3
0
        public static XQChartExcelOutBlock FromQuery(XQCHARTEXCEL query)
        {
            XQChartExcelOutBlock block = new XQChartExcelOutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.indexid       = query.GetFieldData(block.GetBlockName(), "indexid", 0).ParseLong("indexid");             // long 10
                block.rec_cnt       = query.GetFieldData(block.GetBlockName(), "rec_cnt", 0).ParseLong("rec_cnt");             // long 5
                block.validdata_cnt = query.GetFieldData(block.GetBlockName(), "validdata_cnt", 0).ParseLong("validdata_cnt"); // long 2
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Пример #4
0
        public static XQChartExcelOutBlock1[] ListFromQuery(XQCHARTEXCEL query)
        {
            int count = query.GetBlockCount(XQChartExcelOutBlock1.BlockName);
            List <XQChartExcelOutBlock1> list = new List <XQChartExcelOutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQChartExcelOutBlock1 block = new XQChartExcelOutBlock1();
                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 10
                    block.high   = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high");             // float 10
                    block.low    = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low");               // float 10
                    block.close  = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close");           // float 10
                    block.volume = query.GetFieldData(block.GetBlockName(), "volume", i).ParseFloat("volume");         // float 12
                    block.value1 = query.GetFieldData(block.GetBlockName(), "value1", i).ParseFloat("value1");         // float 10
                    block.value2 = query.GetFieldData(block.GetBlockName(), "value2", i).ParseFloat("value2");         // float 10
                    block.value3 = query.GetFieldData(block.GetBlockName(), "value3", i).ParseFloat("value3");         // float 10
                    block.value4 = query.GetFieldData(block.GetBlockName(), "value4", i).ParseFloat("value4");         // float 10
                    block.value5 = query.GetFieldData(block.GetBlockName(), "value5", i).ParseFloat("value5");         // float 10
                    block.pos    = query.GetFieldData(block.GetBlockName(), "pos", i).ParseLong("pos");                // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }