|
|
@ -103,34 +103,55 @@ public class RegisterActivityNew extends AppCompatActivity { |
|
|
|
} |
|
|
|
|
|
|
|
public void saveInfo(){ |
|
|
|
/*Map<String,String> fields=new HashMap<>(); |
|
|
|
Map<String,String> fields=new HashMap<>(); |
|
|
|
fields.put("companyId",edt_comp.getText().toString()); |
|
|
|
fields.put("employeeId",edt_emp.getText().toString()); |
|
|
|
fields.put("otp",edt_otp.getText().toString());*/ |
|
|
|
|
|
|
|
RegistrationNew registrationNew = new RegistrationNew(edt_comp.getText().toString(),edt_emp.getText().toString(),edt_otp.getText().toString()); |
|
|
|
CallApiService.getClient().createpost(registrationNew); |
|
|
|
Call<RegistrationNew> call=jsonPlaceHolderApi.createpost(registrationNew); |
|
|
|
fields.put("otp",edt_otp.getText().toString()); |
|
|
|
|
|
|
|
/* RegistrationNew registrationNew = new RegistrationNew(edt_comp.getText().toString(),edt_emp.getText().toString(),edt_otp.getText().toString()); |
|
|
|
System.out.println("Value of registrationNew " );*/ |
|
|
|
CallApiService.getClient().createpost(fields); |
|
|
|
Call<RegistrationNew> call=jsonPlaceHolderApi.createpost(fields); |
|
|
|
// call.enqueue(new Callback<RegistrationNew>() { |
|
|
|
// @Override |
|
|
|
// public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
|
// if(response.isSuccessful()) |
|
|
|
// { |
|
|
|
// Log.e("code=", String.valueOf(response.code())); |
|
|
|
// Toast.makeText(RegisterActivityNew.this, "Info Added successfully", Toast.LENGTH_SHORT).show(); |
|
|
|
//// Intent intent=new Intent(AddBook.this,Home.class); |
|
|
|
//// startActivity(intent); |
|
|
|
// |
|
|
|
// RegistrationNew post=response.body(); |
|
|
|
// String content=""; |
|
|
|
// content +="COMPANYID: "+post.getCompanyId() +"\n"; |
|
|
|
// content +="EMP ID: "+post.getEmployeeId() +"\n"; |
|
|
|
// content +="OTP: "+post.getOtp() +"\n"; |
|
|
|
// |
|
|
|
// // txt_value.append(content); |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public void onFailure(Call<RegistrationNew> call, Throwable t) { |
|
|
|
// Toast.makeText(RegisterActivityNew.this, ""+t.getMessage(), Toast.LENGTH_SHORT).show(); |
|
|
|
// Log.e("error=",t.getMessage().toString()); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
call.enqueue(new Callback<RegistrationNew>() { |
|
|
|
@Override |
|
|
|
public void onResponse(Call<RegistrationNew> call, Response<RegistrationNew> response) { |
|
|
|
if(response.isSuccessful()) |
|
|
|
{ |
|
|
|
Log.e("code=", String.valueOf(response.code())); |
|
|
|
Toast.makeText(RegisterActivityNew.this, "Info Added successfully", Toast.LENGTH_SHORT).show(); |
|
|
|
// Intent intent=new Intent(AddBook.this,Home.class); |
|
|
|
// startActivity(intent); |
|
|
|
|
|
|
|
RegistrationNew post=response.body(); |
|
|
|
String content=""; |
|
|
|
content +="COMPANYID: "+post.getCompanyId() +"\n"; |
|
|
|
content +="EMP ID: "+post.getEmployeeId() +"\n"; |
|
|
|
content +="OTP: "+post.getOtp() +"\n"; |
|
|
|
|
|
|
|
// txt_value.append(content); |
|
|
|
|
|
|
|
if(response.isSuccessful()) { |
|
|
|
Log.e("register code=", String.valueOf(response.code())); |
|
|
|
Toast.makeText(RegisterActivityNew.this, "User Added succesfully", Toast.LENGTH_SHORT).show(); |
|
|
|
Intent intent = new Intent(RegisterActivityNew.this, LoginActivityNew.class); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
else{ |
|
|
|
Toast.makeText(RegisterActivityNew.this, response.message(), Toast.LENGTH_SHORT).show(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|