protected void btnRegister_Click(object sender, EventArgs e)
    {
        Seller seller = new Seller();

        seller.Name     = txtName.Text.ToString();
        seller.Email    = txtEmail.Text.ToString();
        seller.Password = txtPassword.Text.ToString();
        var registerHost = seller.Add();

        Session["user"] = registerHost.Id;
        Session["type"] = "host";

        Response.Redirect("products.aspx");
    }
Beispiel #2
0
        private void Candles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            var candle = (BinanceCandle)e.NewItems[0];

            var wideness = 0.27m;
            var s1       = candle.Candle.Low * (100 + wideness) / 100;
            var l1       = candle.Candle.Low * (100 - wideness) / 100;
            var l2       = candle.Candle.Low * (100 - wideness * 2) / 100;
            var l3       = candle.Candle.Low * (100 - wideness * 3) / 100;
            var l4       = candle.Candle.Low * (100 - wideness * 4) / 100;

            Console.WriteLine("Low : {0}", candle.Candle.Low);
            Console.WriteLine("L1 : {0}", l1);
            Console.WriteLine("L2 : {0}", l2);
            Console.WriteLine("L3 : {0}", l3);
            Console.WriteLine("L4 : {0}", l4);
            Console.WriteLine("S1 : {0}", s1);

            string[] row = { candle.Name,                   candle.CollectedDate.ToLongTimeString(), candle.Candle.Open.ToString(), candle.Candle.Close.ToString(),
                             candle.Candle.Low.ToString(),
                             candle.Candle.High.ToString(),
                             candle.Candle.Volume.ToString() };
            var      listViewItem = new ListViewItem(row);

            if (candle.Candle.Open < candle.Candle.Close)
            {
                listViewItem.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                listViewItem.ForeColor = System.Drawing.Color.Green;
            }
            FormUtils.AddListItem(listView1, listViewItem);

            if (candle != null)
            {
                candlesvalues.Add(new OhlcPoint
                {
                    Close = double.Parse(candle.Candle.Close.ToString()),
                    Open  = double.Parse(candle.Candle.Open.ToString()),
                    High  = double.Parse(candle.Candle.High.ToString()),
                    Low   = double.Parse(candle.Candle.Low.ToString())
                });

                High.Add(new ObservableValue(double.Parse(candle.Candle.High.ToString())));
                Low.Add(new ObservableValue(double.Parse(candle.Candle.Low.ToString())));

                //Thread Safe Caller for Carte 1



                //lets only use the last 60 values - To remove by Util function !
                if (candlesvalues.Count > 60)
                {
                    candlesvalues.RemoveAt(0);
                }
                if (High.Count > 60)
                {
                    High.RemoveAt(0);
                }
                if (Low.Count > 60)
                {
                    Low.RemoveAt(0);
                }
                if (Buyer.Count > 60)
                {
                    Buyer.RemoveAt(0);
                }
                if (Seller.Count > 60)
                {
                    Seller.RemoveAt(0);
                }
                if (Close.Count > 60)
                {
                    Close.RemoveAt(0);
                }
                solidGauge1.Invoke((MethodInvoker) delegate
                {
                    solidGauge1.Value = candle.Properties.Where(y => y.Key.ToString().Contains("TradeCount")).First().Value;
                    solidGauge1.To    = Global.Shared.IncomingBinance.BData.Select(y => y.Data.TradeCount).Max();
                });

                solidGauge2.Invoke((MethodInvoker) delegate
                {
                    solidGauge2.Value = Double.Parse(candle.Properties.Where(y => y.Key.ToString().Contains("Volume")).First().Value.ToString());
                    solidGauge2.To    = Double.Parse(Global.Shared.IncomingBinance.BData.Select(y => y.Data.Volume).Max().ToString());
                });
                Double TakerVolume = Double.Parse(candle.Properties.Where(y => y.Key.ToString().Contains("TakerBuyBaseAssetVolume")).First().Value.ToString());
                Double TotalVolume = Double.Parse(candle.Properties.Where(y => y.Key.ToString().Contains("Volume")).First().Value.ToString());

                solidGauge3.Invoke((MethodInvoker) delegate
                {
                    solidGauge3.Value = TakerVolume;
                    solidGauge3.To    = TotalVolume;
                });

                solidGauge4.Invoke((MethodInvoker) delegate
                {
                    solidGauge4.Value = TotalVolume - TakerVolume;
                    solidGauge4.To    = TotalVolume;
                });


                Buyer.Add(new ObservableValue(double.Parse(TakerVolume.ToString())));
                Seller.Add(new ObservableValue(double.Parse((TotalVolume - TakerVolume).ToString())));

                cartesianChart2.Invoke((MethodInvoker) delegate
                {
                    cartesianChart2.Series[0].Values = Buyer;
                    cartesianChart2.Series[1].Values = Seller;
                    //cartesianChart2.Series[2].Values = Close;
                });

                LastUID = candle.UID;
            }
        }