public int Add(TblAbastecimentoDAO entity)
        {
            parameters = new List <SqlParameter>
            {
                new SqlParameter("@P0", entity.codInvoice),
                new SqlParameter("@P1", entity.idVehicle),
                new SqlParameter("@P2", entity.idCompany),
                new SqlParameter("@P3", entity.dtSupply),
                new SqlParameter("@P4", entity.price),
            };

            return(ExecuteNonQuery(insert));
        }
        public string saveChange()
        {
            string message = "";

            try
            {
                TblAbastecimentoDAO tblAbastecimentoDataRepository = new TblAbastecimentoDAO
                {
                    idSupply   = idSupply,
                    idVehicle  = idVehicle,
                    codInvoice = codInvoice,
                    dtSupply   = dtSupply,
                    idCompany  = idCompany,
                    price      = price
                };

                switch (State)
                {
                //Execulta reglas comerciais / calculos
                case EntityState.Add:
                    abastecimentoRepository.Add(tblAbastecimentoDataRepository);
                    message = "Usuário Cadastrado com sucesso!";
                    break;

                case EntityState.Modified:
                    abastecimentoRepository.Edit(tblAbastecimentoDataRepository);
                    message = "Usuário alterado com sucesso!";
                    break;

                case EntityState.Delete:
                    abastecimentoRepository.Remove((int)idSupply);
                    message = "Usuário removido com sucesso!";
                    break;
                }

                return(message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }