Beispiel #1
0
        public void SalvarXML(CadVeículo o)
        {
            if (Placa != "" && Quilometragem != "" && Ano != "" && Combustível != "" && Modelo != "" && Situação != "" && Marca != "" && IMG != "" && ValorTotal != "")
            {
                XElement raiz     = XElement.Load(@"C:\Dados.xml");
                XElement NovoAuto = new XElement("Veículo",
                                                 new XElement("Marca", Marca),
                                                 new XElement("Modelo", Modelo),
                                                 new XElement("Cor", Cor),
                                                 new XElement("Ano", Ano),
                                                 new XElement("Combustível", Combustível),
                                                 new XElement("Placa", Placa),
                                                 new XElement("UF", UF),
                                                 new XElement("Cidade", Cidade),
                                                 new XElement("Chassi", Chassi),
                                                 new XElement("Renavam", Renavam),
                                                 new XElement("ValordoVeículo", ValorTotal),
                                                 new XElement("Quilometragem", Quilometragem),
                                                 new XElement("ArCond", ArCond),
                                                 new XElement("Vidro", Vidro),
                                                 new XElement("Trava", Trava),
                                                 new XElement("Direção", Direção),
                                                 new XElement("IMG", IMG),
                                                 new XElement("Observações", Observações),
                                                 new XElement("Situação", Situação));
                raiz.Add(NovoAuto);
                raiz.Save(@"C:\Dados.xml");

                CadCliente.ActiveForm.Close();
            }
            else
            {
                MessageBox.Show("\nOs campos: \nPlaca \nModelo \nQuilometragem \nAno \nCombustível \nSituação \nImagem \nSão obrigatórios!");
            }
        }
Beispiel #2
0
        public void AddImagem(CadVeículo o)
        {
            string nome;


            if (o.pictureBox1.Image != null)
            {
                try
                {
                    try
                    {
                        nome = Guid.NewGuid().ToString().Substring(0, 7).ToUpper();
                        File.Copy(o.pictureBox1.ImageLocation.ToString(), @"Imagens dos Veículos\" + nome + ".png");
                        IMG = @"Imagens dos Veículos\" + nome + ".png";
                    }
                    catch (Exception)
                    {
                        nome = Guid.NewGuid().ToString().Substring(0, 7).ToUpper();
                        File.Copy(o.pictureBox1.ImageLocation.ToString(), @"Imagens dos Veículos\" + nome + ".png");
                        IMG = @"Imagens dos Veículos\" + nome + ".png";
                    }
                    catch
                    {
                        nome  = Guid.NewGuid().ToString().Substring(0, 7).ToUpper();
                        nome += ".1";
                        File.Copy(o.pictureBox1.ImageLocation.ToString(), @"Imagens dos Veículos\" + nome + ".png");
                        IMG = @"Imagens dos Veículos\" + nome + ".png";
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #3
0
        public void ledados(CadVeículo o)
        {
            ValorTotal    = o.txtBoxValorTotal.Text.ToString();
            Ano           = o.txtboxAno.Text.ToString();
            Renavam       = o.txtboxRenavam.Text.ToString();
            Quilometragem = o.txtboxKM.Text.ToString();
            Observações   = o.txtboxObservações.Text.ToString();
            UF            = o.txtboxUF.Text.ToString();
            Modelo        = o.txtboxModelo.Text.ToString();
            Marca         = o.txtboxMarca.Text.ToString();
            Placa         = o.txtboxPLaca.Text.ToString();
            Cor           = o.txtboxCor.Text.ToString();
            Chassi        = o.txtboxChassi.Text.ToString();
            Cidade        = o.txtboxCidade.Text.ToString();
            Combustível   = o.ComboboxCombustivel.Text.ToString();

            if (o.radioButton1.Checked == true)
            {
                Situação = "Comprado";
            }
            else if (o.radioButton2.Checked == true)
            {
                Situação = "De Estoque";
            }
            else
            {
                Situação = "";
            }

            if (o.checkBoxArCond.Checked == true)
            {
                ArCond = "Ar Condicionado";
            }

            if (o.checkBoxVidro.Checked == true)
            {
                Vidro = "Vidro elétrico";
            }

            if (o.checkBoxTrava.Checked == true)
            {
                Trava = "Trava elétrica";
            }

            if (o.checkBoxDireção.Checked == true)
            {
                Direção = "Direção";
            }
        }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            CadVeículo o = new CadVeículo();

            o.Show();
        }