-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc3d344
commit 08b70a6
Showing
14 changed files
with
339 additions
and
24 deletions.
There are no files selected for viewing
Binary file added
BIN
+162 Bytes
...2.1.Modelo de Caso de Uso - MCU/~$scrição casos de uso - PS-2017-2-ES-LocacaoVeiculo.docx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/CadastroMotorista.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package br.com.flores.marcio.loccarr; | ||
|
||
import android.provider.Settings; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.text.TextUtils; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
|
||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
|
||
import java.util.Calendar; | ||
import java.util.Date; | ||
|
||
import br.com.flores.marcio.loccarr.Modelos.Motorista; | ||
|
||
public class CadastroMotorista extends AppCompatActivity { | ||
EditText editNome, editCnh, editData; | ||
String nome, cnh, data; | ||
DatabaseReference databaseReference; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_cadastro_motorista); | ||
|
||
editNome = findViewById(R.id.editNome); | ||
editCnh = findViewById(R.id.editCnh); | ||
editData = findViewById(R.id.editData); | ||
} | ||
|
||
public void cadastrar (View view){ | ||
nome = editNome.getText().toString().trim(); | ||
cnh = editCnh.getText().toString().trim(); | ||
String matricula = nome+cnh; | ||
data = editData.getText().toString().trim(); | ||
|
||
if(TextUtils.isEmpty(nome)){ | ||
Toast.makeText(this, "O nome não pode estar em branco.", Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
|
||
if(TextUtils.isEmpty(cnh)){ | ||
Toast.makeText(this, "A CNH não pode estar em branco..", Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
|
||
databaseReference = FirebaseDatabase.getInstance().getReference("Motorista"); | ||
|
||
Motorista motorista = new Motorista(nome, cnh, matricula, data); | ||
databaseReference.child(cnh).setValue(motorista); | ||
Toast.makeText(this, "Motorista cadastrado.", Toast.LENGTH_SHORT).show(); | ||
finish(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Dashboard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package br.com.flores.marcio.loccarr; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
public class Dashboard extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_dashboard); | ||
} | ||
|
||
public void manterMotorista (View view){ | ||
startActivity(new Intent(getApplicationContext(), ManterMotorista.class)); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ExclusaoMotorista.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package br.com.flores.marcio.loccarr; | ||
|
||
import android.support.annotation.NonNull; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.Toast; | ||
|
||
import com.google.android.gms.tasks.OnCompleteListener; | ||
import com.google.android.gms.tasks.Task; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.database.DataSnapshot; | ||
import com.google.firebase.database.DatabaseError; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
import com.google.firebase.database.Query; | ||
import com.google.firebase.database.ValueEventListener; | ||
|
||
public class ExclusaoMotorista extends AppCompatActivity { | ||
EditText editCnh; | ||
String cnh; | ||
DatabaseReference databaseReference; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_exclusao_motorista); | ||
|
||
editCnh = findViewById(R.id.editCnh); | ||
} | ||
|
||
public void excluir (View view){ | ||
|
||
databaseReference = FirebaseDatabase.getInstance().getReference("Motorista"); | ||
|
||
//String nome = databaseReference. | ||
|
||
cnh = editCnh.getText().toString().trim(); | ||
|
||
Query query = databaseReference.orderByChild("Motorista").equalTo(cnh); | ||
query.addValueEventListener(new ValueEventListener() { | ||
@Override | ||
public void onDataChange(DataSnapshot dataSnapshot) { | ||
if (dataSnapshot.exists()){ | ||
databaseReference.removeValue(); | ||
Toast.makeText(ExclusaoMotorista.this, "Motorista excluído.", Toast.LENGTH_SHORT).show(); | ||
} else { | ||
Toast.makeText(ExclusaoMotorista.this, "Não foi possível excluir o motorista. Confira a CNH.", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onCancelled(DatabaseError databaseError) { | ||
|
||
} | ||
}); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/ManterMotorista.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.com.flores.marcio.loccarr; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
public class ManterMotorista extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_manter_motorista); | ||
} | ||
|
||
public void cadastrarMotorista (View view){ | ||
startActivity(new Intent(getApplicationContext(), CadastroMotorista.class)); | ||
} | ||
|
||
public void excluirMotorista (View view){ | ||
startActivity(new Intent(getApplicationContext(), ExclusaoMotorista.class)); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
4.Sistema/LOCCARR/app/src/main/java/br/com/flores/marcio/loccarr/Modelos/Motorista.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package br.com.flores.marcio.loccarr.Modelos; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Created by marci on 24/11/2017. | ||
*/ | ||
|
||
public class Motorista { | ||
public String nome, matricula, cnh, dataIngresso; | ||
|
||
public Motorista(String nome, String matricula, String cnh, String dataIngresso) { | ||
this.nome = nome; | ||
this.matricula = matricula; | ||
this.cnh = cnh; | ||
this.dataIngresso = dataIngresso; | ||
} | ||
|
||
public String getNome() { | ||
return nome; | ||
} | ||
|
||
public String getMatricula() { | ||
return matricula; | ||
} | ||
|
||
public String getCnh() { | ||
return cnh; | ||
} | ||
|
||
public String getDataIngresso() { | ||
return dataIngresso; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
4.Sistema/LOCCARR/app/src/main/res/layout/activity_cadastro_motorista.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="16dp" | ||
tools:context="br.com.flores.marcio.loccarr.CadastroMotorista"> | ||
|
||
<EditText | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="Nome do motorista" | ||
android:inputType="textPersonName" | ||
android:id="@+id/editNome"/> | ||
|
||
<EditText | ||
android:id="@+id/editCnh" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:layout_below="@+id/editNome" | ||
android:inputType="number" | ||
android:hint="CNH do motorista" /> | ||
|
||
<EditText | ||
android:id="@+id/editData" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:layout_below="@+id/editCnh" | ||
android:hint="Data de ingresso (DDMMAAAA)" | ||
android:inputType="number" /> | ||
|
||
<Button | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:layout_below="@+id/editData" | ||
android:background="@color/colorPrimary" | ||
android:onClick="cadastrar" | ||
android:text="Cadastrar" | ||
android:textColor="@color/colorWhite" /> | ||
|
||
</RelativeLayout> |
20 changes: 20 additions & 0 deletions
20
4.Sistema/LOCCARR/app/src/main/res/layout/activity_dashboard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="16dp" | ||
tools:context="br.com.flores.marcio.loccarr.Dashboard"> | ||
|
||
<Button | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Manter\nMotorista" | ||
android:background="@color/colorPrimary" | ||
android:textColor="@color/colorWhite" | ||
android:textSize="30dp" | ||
android:padding="7dp" | ||
android:onClick="manterMotorista"/> | ||
|
||
</RelativeLayout> |
27 changes: 27 additions & 0 deletions
27
4.Sistema/LOCCARR/app/src/main/res/layout/activity_exclusao_motorista.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="16dp" | ||
tools:context="br.com.flores.marcio.loccarr.ExclusaoMotorista"> | ||
|
||
<EditText | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="CNH do motorista" | ||
android:id="@+id/editCnh"/> | ||
|
||
<Button | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentStart="true" | ||
android:layout_below="@+id/editCnh" | ||
android:text="Excluir" | ||
android:background="@color/colorPrimary" | ||
android:textColor="@color/colorWhite" | ||
android:id="@+id/botaoExcluir" | ||
android:onClick="excluir"/> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.