예제 #1
0
 private void loadBills() {
   String paymentType = AppConfig.PAYABLE;
   Utilities.setAPIContext(getActivity());
   APIConnect.GetBillsTask getBillsTask = new APIConnect.GetBillsTask();
   getBillsTask.crdDelegate = this;
   getBillsTask.execute(paymentType);
 }
예제 #2
0
 private void updateBill() {
   Utilities.setAPIContext(manage_bill.this);
   JSONObject updateBill = getUpdateDetails();
   APIConnect.UpdateBillTask updateBillTask = new APIConnect.UpdateBillTask();
   updateBillTask.cruBill = this;
   updateBillTask.execute(updateBill);
 }
예제 #3
0
  @Override
  public void deleteBillTask(BillTaskResponse deleteResponse) {
    HttpStatus code = deleteResponse.code;

    if (StatusCode.isOk(code)) {
      loadBills();
    } else if (StatusCode.isUnauthorised(code)) {
      Utilities.setAPIContext(getActivity());
      new APIConnect.UpdateTokenTask().execute();
      deleteBill();
    } else if (StatusCode.isBadRequest(code)) {
      Toast.makeText(getActivity(), deleteResponse.error, Toast.LENGTH_SHORT).show();
    } else if (StatusCode.isForbidden(code)) {
      Toast.makeText(getActivity(), AppConfig.FORBIDDEN, Toast.LENGTH_SHORT).show();
    }
  }
예제 #4
0
  @Override
  public void getBillTask(BillTaskResponse billTaskResponse) {
    HttpStatus code = billTaskResponse.code;

    if (StatusCode.isOk(code)) {
      Utilities.showRecycler(recyclerView, layoutNoContent);

      getBills = billTaskResponse.bills;
      adapter = new PayableAdapter(getActivity(), getBills);
      recyclerView.setAdapter(adapter);
      recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    } else if (StatusCode.isUnauthorised(code)) {
      Utilities.setAPIContext(getActivity());
      new APIConnect.UpdateTokenTask().execute();
      loadBills();
    } else if (StatusCode.isNoContent(code)) {
      Utilities.showNoContentLayout(recyclerView, layoutNoContent);
    } else if (StatusCode.isBadRequest(code)) {
      Toast.makeText(getActivity(), billTaskResponse.error, Toast.LENGTH_SHORT).show();
    }
  }
예제 #5
0
 private void restoreBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.AddBillTask addBillTask = new APIConnect.AddBillTask(deletedBill);
   addBillTask.crdDelegate = this;
   addBillTask.execute();
 }
예제 #6
0
 private void deleteBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.DeleteBillTask deleteTask = new APIConnect.DeleteBillTask();
   deleteTask.crdDelegate = this;
   deleteTask.execute(billId);
 }
예제 #7
0
 private void getSingleBill() {
   Utilities.setAPIContext(getActivity());
   APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill();
   getSingleBill.crdDelegate = this;
   getSingleBill.execute(billId);
 }
예제 #8
0
 private void checkForOverdueBills() {
   Utilities.setAPIContext(this);
   APIConnect.UpdatePayableToOverdue toOverdue = new APIConnect.UpdatePayableToOverdue();
   toOverdue.delegate = this;
   toOverdue.execute();
 }
예제 #9
0
 public void prepareToModify() {
   Utilities.setAPIContext(this);
   APIConnect.GetSingleBill getSingleBill = new APIConnect.GetSingleBill();
   getSingleBill.cruDelegate = this;
   getSingleBill.execute(billId);
 }