Exemple #1
0
        private void Search_Click(object sender, EventArgs e)
        {
            string            val;
            ToolStripMenuItem MenuButton = (ToolStripMenuItem)sender;
            Search            search     = new Search();

            if (search.ShowDialog() == DialogResult.OK)
            {
                if (MenuButton.Text == "mark")
                {
                    textBox1.Text = XMLjobs.SearchCarMark(search.val);
                }
                else if (MenuButton.Text == "owner")
                {
                    textBox1.Text = XMLjobs.SearchCarOwner(search.val);
                }
                else if (MenuButton.Text == "fuel")
                {
                    textBox1.Text = XMLjobs.SearchCarFuel(search.val);
                }
                else if (MenuButton.Text == "power")
                {
                    textBox1.Text = XMLjobs.SearchCarPower(search.val);
                }
            }
        }
Exemple #2
0
        private void buttonremove_Click(object sender, EventArgs e)
        {
            if (textBoxRemove.Text != "")
            {
                string mark_code = textBoxRemove.Text;
                XMLjobs.CarRemove(mark_code);
            }
            else
            {
                MessageBox.Show("Error! Mark code is not correct!");
            }

            textBox1.Text = XMLjobs.GetCars();
        }
Exemple #3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                // фамилия владельца, код марки автомобиля, марка автомобиля, требуемая марка бензина, мощность двигателя, объем бака, остаток бензина, объем масла
                string mark_code
                , owner
                , mark
                , fuel;

                float power
                , volume
                , fuel_left
                , oil;


                mark_code = textBoxMarkcode.Text;
                owner     = textBoxOwner.Text;
                mark      = textBoxMarked.Text;
                fuel      = textBoxFuel.Text;

                power     = float.Parse(textBoxPower.Text);
                volume    = float.Parse(textBoxVolume.Text);
                fuel_left = float.Parse(textBoxFuelLeft.Text);
                oil       = float.Parse(textBoxOil.Text);

                if (mark_code == "" || owner == "" || mark == "" || fuel == "" || power < 0 || volume < 0 || fuel_left < 0 || oil < 0)
                {
                    MessageBox.Show("Null or negative values are not allowed! Check you values!");
                }
                else
                {
                    XMLjobs.CarAdd(mark_code, owner, mark, fuel, textBoxPower.Text, textBoxVolume.Text, textBoxFuelLeft.Text, textBoxOil.Text);
                }

                textBox1.Text = XMLjobs.GetCars();
            }
            catch (FormatException)
            {
                MessageBox.Show("Wrong data input! Check float values!");
            }
        }
Exemple #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     textBox1.Text = XMLjobs.GetCars();
 }