private void loginTrader_Click(object sender, RoutedEventArgs e)
        {
            Login_Trader lTrader = new Login_Trader();

            lTrader.Show();
            this.Close();
        }
        private void LogoutButton_Click(object sender, RoutedEventArgs e)
        {
            Login_Trader exp = new Login_Trader();

            exp.Show();
            this.Close();
            Global.uname = "";
        }
Exemplo n.º 3
0
        private void Login_Click(object sender, RoutedEventArgs e)

        {
            Login_Trader logintrader = new Login_Trader();

            logintrader.Show();

            Close();
        }
        private void confirmOrder_Click(object sender, RoutedEventArgs e)
        {
            string security      = labelSecurity.Content.ToString();
            string company       = labelcompany.Content.ToString();
            string tradetype     = labeltype.Content.ToString();
            char   tradetypechar = tradetype[0];
            int    quantity;

            Int32.TryParse(labelquantity.Content.ToString(), out quantity);
            double price;

            double.TryParse(labelPrice.Content.ToString(), out price);
            double value;

            double.TryParse(labelValue.Content.ToString(), out value);
            string       date = labeltime.Content.ToString();
            Login_Trader obj  = new Login_Trader();
            // string uname = obj.userName.Text;
            string        tradertype;
            SqlConnection con1 = new SqlConnection(@"Data Source=GRAD89-HP;Integrated Security = SSPI;Initial Catalog=front_running");

            con1.Open();
            SqlCommand cmd1 = new SqlCommand($"SELECT TRADERTYPE FROM TABLE_FOR_TC WHERE USERNAME='******'", con1);

            tradertype = (string)cmd1.ExecuteScalar();
            char tradertypechar = tradertype[0];
            //cmd1.Parameters.AddWithValue("@TRADERTYPE", );
            //using (SqlDataReader reader = cmd1.ExecuteReader())
            //{
            //    tradertype = String.Format("{0}", reader["TRADERTYPE"]);
            //}

            string        today     = DateTime.Today.ToString("yyyy-MM-dd");
            string        todaytime = DateTime.Now.ToString("HH:mm:ss");
            SqlConnection con       = new SqlConnection(@"Data Source=GRAD89-HP;Integrated Security = SSPI;Initial Catalog=front_running");

            con.Open();
            SqlCommand cmd = new SqlCommand($"Insert into DATABASE_FOR_ORDERS (USERNAME, TRADERTYPE, SECURITY, TRADE_DATE, TRADE_TIME, TRADE_TYPE, SECURITY_TYPE, QUANTITY, PRICE, VALUE) values('{Global.uname}','{tradertypechar}','{company}','{today}','{todaytime}','{tradetypechar}','{security}','{quantity}','{price}','{value}')", con);

            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Your order has been placed successfully");
            Welcome w = new Welcome();

            w.Show();
            this.Close();
        }