Esempio n. 1
0
        public void DeleteLaptop()
        {
            IRepositorio rep = new RepositorioMySQL();

            try
            {
                rep.Delete("Dell Latitude 5410");
            }
            catch (Exception ex)
            {
            }
            Assert.IsNull(rep.Consult("Dell Latitude 5410"));
        }
Esempio n. 2
0
        public void CreateLaptop()
        {
            IRepositorio rep = new RepositorioMySQL();

            try
            {
                rep.Create(new Laptop("Dell Latitude 5410", 16, 500));
            }
            catch (Exception ex)
            {
            }
            Assert.IsNotNull(rep.Consult("Dell Latitude 5410"));
        }
Esempio n. 3
0
        public void ListLaptops()
        {
            List <Laptop> laptops = null;
            IRepositorio  rep     = new RepositorioMySQL();

            try
            {
                laptops = rep.List();
            }
            catch (Exception ex)
            {
            }
            Assert.IsNotNull(laptops);
        }
Esempio n. 4
0
        public void ConsultLaptop()
        {
            Laptop       lap = null;
            IRepositorio rep = new RepositorioMySQL();

            try
            {
                lap = rep.Consult("Lenovo");
            }
            catch (Exception ex)
            {
            }
            Assert.IsNotNull(lap);
        }
Esempio n. 5
0
        private void ListLaptops()
        {
            IRepositorio rep = new RepositorioMySQL();

            try
            {
                gridLaptops.DataSource = null;
                gridLaptops.DataSource = rep.List();
                gridLaptops.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Ocorreu um erro: {ex.Message}");
            }
        }
Esempio n. 6
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            IRepositorio rep = new RepositorioMySQL();

            try
            {
                rep.Create(laptop: new Laptop(txtBrand.Text, int.Parse(txtRam.Text), int.Parse(txtStorage.Text)));
                ListLaptops();
                MessageBox.Show(text: $"Notebook {txtBrand.Text} de {txtRam.Text}GB de RAM e {txtStorage.Text} de armazenamento foi adicionado.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(text: $"Ocorreu um erro: {ex.Message}");
            }
        }