Example #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            SeeOffers so = new SeeOffers();

            this.Hide();
            so.Show();
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int carID = checkIfCarAvailable();

            if (DateTime.Compare(dateTimePicker1.Value, dateTimePicker2.Value) >= 0)
            {
                MessageBox.Show("Choose correct date!");
            }
            else if (carID == 0)
            {
                MessageBox.Show("Car is not available at the moment");
            }
            else
            {
                String insertRes = @"INSERT INTO `wypozyczenia`(`ID_WYP`, `ID_SAM`, `ID_KLI`, `DATA_WYP`, `DATA_ZWR`, `KOSZT`) VALUES (" + maxIDVal() + ", " + carID + ", " + Form1.gimme() + ", '" + dateTimePicker1.Value.ToString().Substring(0, 10) + "', '" + dateTimePicker2.Value.ToString().Substring(0, 10) + "', " + totalCost().ToString() + ")";

                Connection       conn = new Connection();
                MySqlDataAdapter msda = new MySqlDataAdapter();
                MySqlCommand     msc  = new MySqlCommand();
                conn.OpenConnection();
                msc.CommandText = insertRes;
                msc.Connection  = conn.GetConnection();


                if (msc.ExecuteNonQuery() == 1)
                {
                    conn.CloseConnection();
                    MessageBox.Show("Rezerwacja zostala zalozona!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    SeeOffers so = new SeeOffers();
                    so.Show();
                    this.Hide();
                }
            }
        }