Exemplo n.º 1
0
        private void ModifButton_Click(object sender, EventArgs e)
        {
            string sqlExpression = "Insert into Modification Values((select TOP 1 ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "'),'" +
                                   ColorModifCB.Text + "','" + ComplectModifCB.Text + "','" + SpecsModifCB.Text + "'," + Convert.ToInt32(YearTB.Text) + "," + Convert.ToInt32(PriceTB.Text) + ", NULL)";

            ExecuteQuery(sqlExpression);
            sqlExpression = "insert into Storage Values((select max(ID_Modification) From Modification), NULL)";
            ExecuteQuery(sqlExpression);
            ColorModif.Hide();
            EngineModif.Hide();
            ComplectationModif.Hide();
            YearModif.Hide();
            YearTB.Hide();
            Pricelbl.Hide();
            PriceTB.Hide();
            ModifButton.Hide();
            ColorModifCB.Hide();
            SpecsModifCB.Hide();
            ComplectModifCB.Hide();
            СhooseMarkModifCB.Items.Clear();
            sqlExpression = "SELECT Distinct Mark_auto FROM Automobile";
            CBquery(sqlExpression, СhooseMarkModifCB);
            ChooseModelModifCB.Items.Clear();
            sqlExpression = "SELECT Model_auto FROM Automobile";
            CBquery(sqlExpression, ChooseModelModifCB);
        }
Exemplo n.º 2
0
        private void ChooseModelModifCB_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            СhooseMarkModifCB.Items.Clear();
            string sqlExpression = "SELECT Mark_auto FROM Automobile Where Model_auto = '" + ChooseModelModifCB.Text + "'";

            CBquery(sqlExpression, СhooseMarkModifCB);
            if (!Model)
            {
                ++countChosenauto;
                Model = true;
            }
            if (countChosenauto == 2)
            {
                countChosenauto = 0;
                ColorModif.Show();
                EngineModif.Show();
                ComplectationModif.Show();
                YearModif.Show();
                YearTB.Show();
                Pricelbl.Show();
                PriceTB.Show();
                ModifButton.Show();
                ColorModifCB.Show();
                sqlExpression = "SELECT Colour FROM Automobile_colour Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, ColorModifCB);
                SpecsModifCB.Show();
                sqlExpression = "SELECT Engine_type FROM Automobile_Specification Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, SpecsModifCB);
                ComplectModifCB.Show();
                sqlExpression = "SELECT Equipment FROM Automobile_Complectation Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, ComplectModifCB);
                Model = false;
            }
        }