| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using Muchinfo.MTPClient.Data.Quote.Enum;
- using System;
- using System.Collections.Generic;
- namespace Muchinfo.MTPClient.Data.Quote.Entities
- {
- /// <summary>
- /// Class QuoteTik. -- From Muchinfo.Quote.Messages.dll
- /// </summary>
- public class QuoteTik
- {
- private Dictionary<QuoteTikPart, object> _fields;
- private string _date;
- private string _time;
- public Dictionary<QuoteTikPart, object> Fields
- {
- get
- {
- return this._fields;
- }
- }
- public string ExchangeCode
- {
- get;
- set;
- }
- public string GoodsCode
- {
- get;
- set;
- }
- public int Sort
- {
- get;
- set;
- }
- public string Symbol
- {
- get
- {
- string text = this.ExchangeCode;
- string text2 = this.GoodsCode;
- if (text != null && string.IsNullOrEmpty(text) && text.Length > 3)
- {
- text = text.Substring(0, 3);
- }
- if (text2 != null && string.IsNullOrEmpty(text2) && text2.Length > 6)
- {
- text2 = text2.Substring(text2.Length - 6, 6);
- }
- string text3 = text.PadLeft(3, ' ') + text2.PadLeft(6, ' ');
- return text3.ToUpperInvariant();
- }
- }
- public DateTime AtTime
- {
- get;
- set;
- }
- public byte DecimalPlace
- {
- get;
- set;
- }
- public string Date
- {
- get
- {
- return this._date;
- }
- set
- {
- this._date = value;
- this.SetAtTime();
- }
- }
- public string Time
- {
- get
- {
- return this._time;
- }
- set
- {
- this._time = value;
- this.SetAtTime();
- }
- }
- public QuoteTik()
- {
- this._fields = new Dictionary<QuoteTikPart, object>();
- this.DecimalPlace = 4;
- }
- private void SetAtTime()
- {
- if (!string.IsNullOrEmpty(this.Date) && this.Date.Length >= 8)
- {
- int year = int.Parse(this._date.Substring(0, 4));
- int month = int.Parse(this._date.Substring(4, 2));
- int day = int.Parse(this._date.Substring(6, 2));
- this.AtTime = new DateTime(year, month, day, this.AtTime.Hour, this.AtTime.Minute, this.AtTime.Second);
- }
- if (string.IsNullOrEmpty(this.Time) || this.Time.Length < 6)
- {
- return;
- }
- int hour = int.Parse(this._time.Substring(0, 2));
- int minute = int.Parse(this._time.Substring(2, 2));
- int second = int.Parse(this._time.Substring(4, 2));
- this.AtTime = new DateTime(this.AtTime.Year, this.AtTime.Month, this.AtTime.Day, hour, minute, second);
- }
- }
- }
|