public void enterBillItem(long bid, String itemName, double qty, double amount) { dataSource.open(); BillItem billItem = new BillItem(); billItem.set_billItemName(itemName); billItem.set_billItemQuantity(qty); billItem.set_billItemAmount(amount); billItem.set_billItemBillId(bid); // BillItem item = dataSource.createBillItem(billItem); dataSource.createBillItem(billItem); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_non_static_filtered_result); if (savedInstanceState != null) { Toast.makeText(this, savedInstanceState.getString("message"), Toast.LENGTH_LONG).show(); } else if (savedInstanceState == null) { dataSource = new SnapAndSaveDataSource(this); dataSource.open(); Log.v(LOGTAG, "in filter"); Intent intent = getIntent(); String result = intent.getStringExtra("result"); billID = intent.getLongExtra("id", 0); FilterAlgo fa = new FilterAlgo(); Log.v(LOGTAG, "filter algo"); results = fa.filter(result); Log.v(LOGTAG, "String came"); init(results); } }
public void cancel(View view) { dataSource.open(); Log.v(LOGTAG, "retry"); boolean delete = dataSource.deleteBill(billID); Log.v(LOGTAG, "Before if " + String.valueOf(delete)); if (delete == true) { Log.v(LOGTAG, "Bill Deleted"); CharSequence text = "Bill Deleted"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(getApplicationContext(), text, duration); toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); Intent intent = new Intent(getApplicationContext(), MainMenuActivity.class); startActivity(intent); finish(); } }
public void updateBill() { dataSource.open(); boolean update = dataSource.updateBill( billID, results[1][0], results[2][0], results[3][0], Double.parseDouble(results[4][0])); if (update == true) { CharSequence text = "Bill details updated"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(this, text, duration); toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); } else { CharSequence text = "Bill details not updated"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(this, text, duration); toast.setGravity(Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); } }