using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
namespace MasterLinkFutures.Data
{
    public class QuoteData : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void onPropertyChanged(object sender, string propertyName)
        {
            if (this.PropertyChanged != null)
            { PropertyChanged(sender, new PropertyChangedEventArgs(propertyName)); }
        } 
        public bool del { get; set; }//刪單標記
        public string account { get; set; }//0帳號
        private string _orderno;//1委託書號
        public string orderno
        {
            get { return _orderno; }
            set
            {
                if (_orderno != value)
                {
                    _orderno = value;
                    onPropertyChanged(this, "orderno");
                }
            }
        }		 
        public string symbolID { get; set; }//2商品ID
        public string orderCategory { get; set; }//3商品類別, S:證券, F:期貨, O:選擇權
        public string orderType { get; set; }//4委託別 R/I/F,普通,融資,融券
        public string priceFlag { get; set; }//5價格別, L:限價, U:漲停, D:跌停, N:平盤
        public string buySell { get; set; }//6買賣別, B:買進, S:賣出
        public string dayTrade { get; set; }//7當沖, Y/N
        private double _price;
        public double price//7(數值)委託價格
        {
            get { return _price; }
            set
            {
                if (_price != value)
                {
                    _price = value;
                    onPropertyChanged(this, "price");
                }
            }
        }		 
        private int _qty { get; set; }//8(數值)有效委託數量
        public int qty
        {
            get { return _qty; }
            set
            {
                if (_qty != value)
                {
                    _qty = value;
                    onPropertyChanged(this, "qty");
                }
            }
        }
        private int _dealQty { get; set; }//9(數值)已成交數量
        public int dealQty
        {
            get { return _dealQty; }
            set
            {
                if (_dealQty != value)
                {
                    _dealQty = value;
                    onPropertyChanged(this, "dealQty");
                }
            }
        }
        public double dealAvgPrice { get; set; }//10(數值)成交均價
        public string status { get; set; }//11狀態
        public string udateTime { get; set; }//12更新時間
        public string source { get; set; }//13來源別
        public string userKey { get; set; }//14UserKey
        public string openClose { get; set; }//15倉別, A:自動, O:新倉, C:平倉
        public string canData { get; set; }//20可見資料
        public string memo { get; set; }//24備註
        public string gQuoteID { get; set; }//25gQuoteID
        public string symbolID2 { get; set; }//29商品名稱2
        public string buySell2 { get; set; }//30買賣別2
        public string gQuoteID2 { get; set; }//31gQuoteID2

        public void update(QuoteData qd)
        {
            this.status = qd.status;
            this.qty = qd.qty;
            this.dealQty = qd.dealQty;
            this.price = qd.price;
            this.orderno = qd.orderno;
        }
        public string toString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("del:"); sb.Append(del); sb.Append(", ");
            sb.Append("account:"); sb.Append(account); sb.Append(", ");
            sb.Append("orderno:"); sb.Append(orderno); sb.Append(", ");
            sb.Append("symbolID:"); sb.Append(symbolID); sb.Append(", ");
            sb.Append("orderCategory:"); sb.Append(orderCategory); sb.Append(", ");
            sb.Append("orderType:"); sb.Append(orderType); sb.Append(", ");
            sb.Append("priceFlag:"); sb.Append(priceFlag); sb.Append(", ");
            sb.Append("buySell:"); sb.Append(buySell); sb.Append(", ");
            sb.Append("dayTrade:"); sb.Append(dayTrade); sb.Append(", ");
            sb.Append("price:"); sb.Append(price); sb.Append(", ");
            sb.Append("qty:"); sb.Append(qty); sb.Append(", ");
            sb.Append("dealQty:"); sb.Append(dealQty); sb.Append(", ");
            sb.Append("dealAvgPrice:"); sb.Append(dealAvgPrice); sb.Append(", ");
            sb.Append("status:"); sb.Append(status); sb.Append(", ");
            sb.Append("udateTime:"); sb.Append(udateTime); sb.Append(", ");
            sb.Append("source:"); sb.Append(source); sb.Append(", ");
            sb.Append("userKey:"); sb.Append(userKey); sb.Append(", ");
            sb.Append("openClose:"); sb.Append(openClose); sb.Append(", ");
            sb.Append("canData:"); sb.Append(canData); sb.Append(", ");
            sb.Append("memo:"); sb.Append(memo); sb.Append(", ");
            sb.Append("gQuoteID:"); sb.Append(gQuoteID); sb.Append(", ");
            sb.Append("symbolID2:"); sb.Append(symbolID2); sb.Append(", ");
            sb.Append("buySell2:"); sb.Append(buySell2); sb.Append(", ");
            sb.Append("gQuoteID2:"); sb.Append(gQuoteID2); sb.Append(", ");
            return sb.ToString();
        }
    }
}
