Esempio n. 1
0
 public OrderUpdate(String sym, Request.RequestType fill_type, Update.UpdateType upt, String time, int id, double px, double q, String FFT)
     : base(sym, upt, id, FFT)
 {
     m_Price    = px;
     m_FillTime = time;
     m_FillType = fill_type;
     m_Qty      = q;
 }
Esempio n. 2
0
        public OrderRequest(String symbol, Request.RequestType request_type, OrderRequest.OrderType order_type, double qty, double price = 0, String FFT = "000") : base(symbol, request_type, 0, FFT)
        {
            OrdType = order_type;
            Price   = price;
            //m_Time = new Time(clock.CurrentTime);
            Qty = qty;

            //Debug.WriteLine("START:  OrderTime: " + Time.TimeToString( clock.CurrentTime ) + "  " + "ActiveTime: " + Time.TimeToString( m_ActiveTime.CurrentTime ));
        }
Esempio n. 3
0
        public async Task <bool> CreateRequest(Request.RequestType requestType, int fromCityFK, int toCityFK, DateTime dateTime, bool isUrgent,
                                               int flexibility, string subject, string itemDescription, string image, int options, bool shareOnFacebook, int willingToPay, string flightInformation)
        {
            try
            {
                RequestModel request = new RequestModel()
                {
                    UserFK            = App.UserPK,
                    RequestTypeFK     = (int)requestType,
                    FromCityFK        = fromCityFK,
                    ToCityFK          = toCityFK,
                    DateTimeUtc       = dateTime,
                    IsUrgent          = isUrgent,
                    FlexibilityDays   = flexibility,
                    Subject           = subject,
                    ItemDescription   = itemDescription,
                    Image             = image,
                    Options           = options,
                    PackageInfoFK     = null,
                    AccompanyInfoFK   = null,
                    WillingToPay      = willingToPay,
                    FlightInformation = flightInformation
                };

                string json     = JsonConvert.SerializeObject(request, Formatting.Indented);
                var    content  = new StringContent(json, Encoding.UTF8, "application/json");
                var    response = await m_httpClient.PostAsync(m_uri, content);

                if (response.IsSuccessStatusCode)
                {
                    //var content = await response.Content.ReadAsStringAsync();
                    string res = await response.Content.ReadAsStringAsync();

                    if (res.Contains("failed"))
                    {
                        return(false);
                    }
                }
            }

            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        public Response SendRequest(Request.RequestType type, object body)
        {
            Response response = null;

            try
            {
                TcpClient client = new TcpClient();
                client.Connect(server, port);
                NetworkStream stream  = client.GetStream();
                Request       request = new Request(type, body);
                formatter.Serialize(stream, request);
                response = (Response)formatter.Deserialize(stream);
                stream.Close();
                client.Close();
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(ex.Message, App.Current.Windows[0]);
            }
            return(response);
        }
Esempio n. 5
0
 public CancelRequest(String symbol, Request.RequestType request_type, int id, String fft = "000") : base(symbol, request_type, id, fft)
 {
 }
Esempio n. 6
0
        public void SendRequest(Request.RequestType type, object body)
        {
            Request request = new Request(type, body);

            formatter.Serialize(stream, request);
        }