コード例 #1
0
ファイル: Rate.cs プロジェクト: MarwanELAdawy/Uber
        private void button1_Click(object sender, EventArgs e)
        {
            OracleCommand cmd = new OracleCommand();

            cmd.Connection  = conn;
            cmd.CommandText = "Update_Rate";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("RID", textBox1.Text);
            cmd.Parameters.Add("tripid", TRIP);
            cmd.ExecuteNonQuery();

            OracleCommand cm = new OracleCommand();

            cm.Connection  = conn;
            cm.CommandText = "getAllRate";
            cm.CommandType = CommandType.StoredProcedure;
            cm.Parameters.Add("sumRate", OracleDbType.Int32, ParameterDirection.Output);
            cm.Parameters.Add("dphone", driverphone);
            cm.ExecuteNonQuery();
            rate = int.Parse(cm.Parameters["sumRate"].Value.ToString());

            OracleCommand cmd2 = new OracleCommand();

            cmd2.Connection  = conn;
            cmd2.CommandText = "Update_DriverRate";
            cmd2.CommandType = CommandType.StoredProcedure;
            cmd2.Parameters.Add("ratevalue", rate);
            cmd2.Parameters.Add("phonedriver", driverphone);
            cmd2.ExecuteNonQuery();
            MessageBox.Show("Thank You");
            Userpanel up = new Userpanel();

            up.Show();
            this.Hide();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool fola = true;

            if (comboBox1.Text == "Client")
            {
                if (textBox1.Text != null && textBox2.Text != null)
                {
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection  = conn;
                    cmd.CommandText = "Select phone from client where phone =:p and pass =:bl7";
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.Add("p", textBox1.Text);
                    cmd.Parameters.Add("bl7", textBox2.Text);
                    OracleDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        if (textBox1.Text == dr[0].ToString())
                        {
                            fola = false;
                        }
                    }
                    dr.Close();
                    if (!fola)
                    {
                        this.Hide();
                        phoneclient = textBox1.Text;
                        Userpanel f2 = new Userpanel();
                        f2.Show();
                    }
                }
            }
            else if (comboBox1.Text == "Driver")
            {
                if (textBox1.Text != null && textBox2.Text != null)
                {
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection  = conn;
                    cmd.CommandText = "Select phone from driver where phone =:p and pass =:bl7";
                    cmd.CommandType = CommandType.Text;
                    cmd.Parameters.Add("p", textBox1.Text);
                    cmd.Parameters.Add("bl7", textBox2.Text);
                    OracleDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        if (textBox1.Text == dr[0].ToString())
                        {
                            fola = false;
                        }
                    }
                    dr.Close();
                    if (!fola)
                    {
                        phoneDriver = textBox1.Text;
                        this.Hide();
                        DriverForm df = new DriverForm();
                        df.Show();
                    }
                }
            }
        }