Exemplo n.º 1
0
        public void Insert(Servico servico)
        {
            try
            {
                MySqlCommand comando = new MySqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "Insert into Servico (codserv,tipo, porte, valor) values (@codserv,@tipo, @porte, @valor)";

                comando.Parameters.AddWithValue("@codserv", servico.Codservico);
                comando.Parameters.AddWithValue("@tipo", servico.Tipo);
                comando.Parameters.AddWithValue("@porte", servico.Porte);
                comando.Parameters.AddWithValue("@valor", servico.Valor);


                ConexaoBanco.CRUD(comando);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível se conectar" + ex.Message);
            }
        }
Exemplo n.º 2
0
        public void Insert(Atendimento atendimento)
        {
            try
            {
                MySqlCommand comando = new MySqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "Insert into Atendimento (codserv, codpet, codfunc, datahora, situacao) values (@codserv, @codpet, @codfunc, @datahora, @situacao)";

                comando.Parameters.AddWithValue("@codserv", atendimento.Servico.Codservico);
                comando.Parameters.AddWithValue("@codpet", atendimento.Pet.CodPet);
                comando.Parameters.AddWithValue("@codfunc", atendimento.Funcionario.Cod);
                comando.Parameters.AddWithValue("@datahora", atendimento.DataHora);
                comando.Parameters.AddWithValue("@situacao", atendimento.Situacao);


                ConexaoBanco.CRUD(comando);
            }
            catch (Exception ex)
            {
                throw new Exception("Não foi possível se conectar" + ex.Message);
            }
        }
Exemplo n.º 3
0
        public void Update(Servico servico)
        {
            try
            {
                MySqlCommand comando = new MySqlCommand();
                comando.CommandType = CommandType.Text;
                comando.CommandText = "Update Servico set tipo=@tipo, porte=@porte, valor=@valor where codserv=@codserv";


                comando.Parameters.AddWithValue("@codserv", servico.Codservico);
                comando.Parameters.AddWithValue("@tipo", servico.Tipo);
                comando.Parameters.AddWithValue("@porte", servico.Porte);
                comando.Parameters.AddWithValue("@valor", servico.Valor);


                ConexaoBanco.CRUD(comando);
            }

            catch (Exception ex)
            {
                throw new Exception("Não foi possível Editar o Servico" + ex.Message);
            }
        }