use of com.manan.dev.ec2018app.Models.QRTicketModel in project EC2018App by Manan-YMCA.
the class ContentActivity method checkCount.
private void checkCount(final String phone) {
String url = getResources().getString(R.string.get_events_qr_code);
url += phone;
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest request = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
mProgress.dismiss();
try {
JSONObject obj1 = new JSONObject(response);
JSONArray ticketDetails = obj1.getJSONArray("data");
for (int i = 0; i < ticketDetails.length(); i++) {
JSONObject obj2 = ticketDetails.getJSONObject(i);
QRTicketModel TicketModel = new QRTicketModel();
TicketModel.setPaymentStatus(obj2.getInt("paymentstatus"));
TicketModel.setArrivalStatus(obj2.getInt("arrived"));
TicketModel.setQRcode(obj2.getString("qrcode"));
TicketModel.setEventID(obj2.getString("eventid"));
TicketModel.setTimeStamp(obj2.getLong("timestamp"));
userTickets.add(TicketModel);
}
}// Try and catch are included to handle any errors due to JSON
catch (Exception e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mProgress.dismiss();
}
});
queue.add(request);
}
use of com.manan.dev.ec2018app.Models.QRTicketModel in project EC2018App by Manan-YMCA.
the class DatabaseController method retrieveTicketsByID.
public QRTicketModel retrieveTicketsByID(String EventId) {
QRTicketModel qrTicketModel = new QRTicketModel();
if (checkIfValueExists1(EventId)) {
SQLiteDatabase db = getReadableDatabase();
String[] projection = { Schema.DbEntry.EVENT_ID, Schema.DbEntry.QR_CODE, Schema.DbEntry.PAYMENT_STATUS, Schema.DbEntry.ARRIVAL_STATUS };
Cursor readCursor = db.query(Schema.DbEntry.QR_TICKET_TABLE_NAME, projection, Schema.DbEntry.EVENT_ID + " = ?", new String[] { EventId }, null, null, null);
readCursor.moveToFirst();
qrTicketModel = retrieveTickets(readCursor);
readCursor.close();
return qrTicketModel;
}
qrTicketModel.setEventID("null");
return qrTicketModel;
}
use of com.manan.dev.ec2018app.Models.QRTicketModel in project EC2018App by Manan-YMCA.
the class EventRegister method addTicket.
private void addTicket(final String phoneNumber) {
String url = getResources().getString(R.string.get_events_qr_code);
url += phoneNumber;
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest request = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject obj1 = new JSONObject(response);
JSONArray ticketDetails = obj1.getJSONArray("data");
for (int i = 0; i < ticketDetails.length(); i++) {
JSONObject obj2 = ticketDetails.getJSONObject(i);
if (obj2.getString("eventid").equals(eventId)) {
TicketModel = new QRTicketModel();
TicketModel.setPaymentStatus(obj2.getInt("paymentstatus"));
TicketModel.setArrivalStatus(obj2.getInt("arrived"));
TicketModel.setQRcode(obj2.getString("qrcode"));
TicketModel.setEventID(obj2.getString("eventid"));
TicketModel.setTimeStamp(obj2.getLong("timestamp"));
databaseController.addTicketsToDb(TicketModel);
}
}
}// Try and catch are included to handle any errors due to JSON
catch (Exception e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
queue.add(request);
}
use of com.manan.dev.ec2018app.Models.QRTicketModel in project EC2018App by Manan-YMCA.
the class ContentActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.navbar_content);
cotainer_root_frame = (RelativeLayout) findViewById(R.id.content_frame);
//
dotsLayout = (LinearLayout) findViewById(R.id.layoutDots);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(ContentActivity.this, drawer, null, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
mProgress = new ProgressDialog(ContentActivity.this);
mProgress.setMessage("I am working");
mProgress.setTitle("yes i am");
mProgress.setCanceledOnTouchOutside(false);
nav_view = (NavigationView) findViewById(R.id.nav_view);
pdfTextView = (TextView) findViewById(R.id.tv_pdf);
nav_view.setNavigationItemSelectedListener((NavigationView.OnNavigationItemSelectedListener) this);
nav_view.setCheckedItem(R.id.nav_home);
userTickets = new ArrayList<QRTicketModel>();
databaseController = new DatabaseController(ContentActivity.this);
mIncomingHandler = new IncomingHandler(ContentActivity.this);
categoriesHeadingTextView = findViewById(R.id.text_viewcategories);
viewPager = (ViewPager) findViewById(R.id.slliderview_pager);
myViewPagerAdapter = new DashboardSlideAdapter(getSupportFragmentManager());
viewPager.setAdapter(myViewPagerAdapter);
viewPager.addOnPageChangeListener(viewPagerPageChangeListener);
ImageView img = findViewById(R.id.drawerTogglebtn);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!drawer.isDrawerOpen(GravityCompat.START)) {
drawer.openDrawer(GravityCompat.START);
}
}
});
pdfTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// missing 'http://' will cause crashed
Uri uri = Uri.parse("http://www.elementsculmyca.com/schedule");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
addBottomDots(0);
addData();
RecyclerView categoryRecycleview = (RecyclerView) findViewById(R.id.category_recycler_view);
categoryRecycleview.setHasFixedSize(true);
DashboardCategoryScrollerAdapter adapter = new DashboardCategoryScrollerAdapter(ContentActivity.this, allSampleData);
categoryRecycleview.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
categoryRecycleview.setAdapter(adapter);
}
use of com.manan.dev.ec2018app.Models.QRTicketModel in project EC2018App by Manan-YMCA.
the class DatabaseController method retrieveAllTickets.
public ArrayList<QRTicketModel> retrieveAllTickets() {
SQLiteDatabase db = getReadableDatabase();
ArrayList<QRTicketModel> qrTickets = new ArrayList<>();
String[] projection = { Schema.DbEntry.EVENT_ID, Schema.DbEntry.QR_CODE, Schema.DbEntry.PAYMENT_STATUS, Schema.DbEntry.ARRIVAL_STATUS };
Cursor readCursor = db.query(Schema.DbEntry.QR_TICKET_TABLE_NAME, projection, null, null, null, null, null);
readCursor.moveToFirst();
int totalTickets = readCursor.getCount();
while (totalTickets > 0) {
totalTickets--;
QRTicketModel tickets = new QRTicketModel();
tickets = retrieveTickets(readCursor);
qrTickets.add(tickets);
readCursor.moveToNext();
}
readCursor.close();
db.close();
return qrTickets;
}
Aggregations