Imports System.ComponentModel
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.CompilerServices

Public Class QuoteData
    Implements INotifyPropertyChanged
    'Public Event PropertyChanged As ProgressChangedEventHandler
    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
    'Private Sub onPropertyChanged(sender As Object, propertyName As String)
    '    If PropertyChanged <> null Then
    '        { PropertyChanged(sender, new PropertyChangedEventArgs(propertyName)); }
    '    End If
    'End Sub
    Protected Sub NotifyPropertyChanged(ByVal name As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name))
    End Sub



    Private _del As Boolean = False
    Private _account As String = String.Empty
    Private _orderno As String = String.Empty
    Private _symbolID As String = String.Empty    '2商品ID
    Private _orderCategory As String = String.Empty    '3商品類別, S:證券, F:期貨, O:選擇權
    Private _orderType As String = String.Empty '4委託別 R/I/F,普通,融資,融券
    Private _priceFlag As String = String.Empty '5價格別, L:限價, U:漲停, D:跌停, N:平盤
    Private _buySell As String = String.Empty '6買賣別, B:買進, S:賣出
    Private _dayTrade As String = String.Empty '7當沖, Y/N
    Private _price As Double '7(數值)委託價格
    Private _qty As Int32 '8(數值)有效委託數量
    Private _dealQty As Int32 '9(數值)已成交數量
    Private _dealAvgPrice As Double '10(數值)成交均價
    Private _status As String = String.Empty '11狀態
    Private _udateTime As String = String.Empty '12更新時間
    Private _source As String = String.Empty '13來源別
    Private _userKey As String = String.Empty '14UserKey
    Private _openClose As String = String.Empty '15倉別, A:自動, O:新倉, C:平倉
    Private _canData As String = String.Empty '20可見資料
    Private _memo As String = String.Empty '24備註
    Private _gQuoteID As String = String.Empty '25gQuoteID
    Private _symbolID2 As String = String.Empty '商品名稱2
    Private _buySell2 As String = String.Empty '30買賣別2
    Private _gQuoteID2 As String = String.Empty '31gQuoteID2
    Public Property del() As Boolean
        Get
            Return _del
        End Get
        Set(value As Boolean)
            _del = value
        End Set
    End Property
    Public Property account As String
        Get
            Return _account
        End Get
        Set(value As String)
            _account = value
        End Set
    End Property
    Public Property udateTime() As String
        Get
            Return _udateTime
        End Get
        Set(value As String)
            _udateTime = value
        End Set
    End Property
    Public Property symbolID() As String
        Get
            Return _symbolID
        End Get
        Set(value As String)
            _symbolID = value
        End Set
    End Property
    Public Property orderCategory() As String
        Get
            Return _orderCategory
        End Get
        Set(value As String)
            _orderCategory = value
        End Set
    End Property
    Public Property orderType() As String
        Get
            Return _orderType
        End Get
        Set(value As String)
            _orderType = value
        End Set
    End Property
    Public Property priceFlag() As String
        Get
            Return _priceFlag
        End Get
        Set(value As String)
            _priceFlag = value
        End Set
    End Property
    Public Property buySell() As String
        Get
            Return _buySell
        End Get
        Set(value As String)
            _buySell = value
        End Set
    End Property
    Public Property dayTrade() As String
        Get
            Return _dayTrade
        End Get
        Set(value As String)
            _dayTrade = value
        End Set
    End Property
    Public Property dealAvgPrice() As Double
        Get
            Return _dealAvgPrice
        End Get
        Set(value As Double)
            _dealAvgPrice = value
        End Set
    End Property
    Public Property status() As String
        Get
            Return _status
        End Get
        Set(value As String)
            _status = value
        End Set
    End Property
    Public Property source() As String
        Get
            Return _source
        End Get
        Set(value As String)
            _source = value
        End Set
    End Property
    Public Property openClose() As String
        Get
            Return _openClose
        End Get
        Set(value As String)
            _openClose = value
        End Set
    End Property
    Public Property orderno() As String
        Get
            Return _orderno
        End Get
        Set(value As String)
            If value <> _orderno Then
                _orderno = value
                NotifyPropertyChanged("orderno")
            End If
        End Set
    End Property
    Public Property userKey() As String
        Get
            Return _userKey
        End Get
        Set(value As String)
            _userKey = value
        End Set
    End Property
    Public Property canData() As String
        Get
            Return _canData
        End Get
        Set(value As String)
            _canData = value
        End Set
    End Property
    Public Property memo() As String
        Get
            Return _memo
        End Get
        Set(value As String)
            _memo = value
        End Set
    End Property
    Public Property gQuoteID() As String
        Get
            Return _gQuoteID
        End Get
        Set(value As String)
            _gQuoteID = value
        End Set
    End Property
    Public Property symbolID2() As String
        Get
            Return _symbolID2
        End Get
        Set(value As String)
            _symbolID2 = value
        End Set
    End Property
    Public Property buySell2() As String
        Get
            Return _buySell2
        End Get
        Set(value As String)
            _buySell2 = value
        End Set
    End Property
    Public Property gQuoteID2() As String
        Get
            Return _gQuoteID2
        End Get
        Set(value As String)
            _gQuoteID2 = value
        End Set
    End Property
    Public Property price() As Double
        Get
            Return _price
        End Get
        Set(value As Double)
            If value <> _price Then
                _price = value
                NotifyPropertyChanged("price")
            End If
        End Set
    End Property
    Public Property qty() As Int32
        Get
            Return _qty
        End Get
        Set(value As Int32)
            If value <> _qty Then
                _qty = value
                NotifyPropertyChanged("qty")
            End If
        End Set
    End Property
    Public Property dealQty() As Int32
        Get
            Return _dealQty
        End Get
        Set(value As Int32)
            If value <> _dealQty Then
                _dealQty = value
                NotifyPropertyChanged("dealQty")
            End If
        End Set
    End Property
    Public Sub update(qd As QuoteData)
        status = qd.status
        qty = qd.qty
        dealQty = qd.dealQty
        price = qd.price
        orderno = qd.orderno
    End Sub
    Public Function _toString()
        Dim sb As 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()
    End Function
End Class
