-2
OrderListModel lOrderListModel = new OrderListModel();
lOrderListModel.productNumber = lModel.ProductNumber;
lOrderListModel.productImage = lModel.productImage;
lOrderListModel.productName = lModel.productName;
lOrderListModel.productPrice = lModel.productPrice;
lOrderListModel.productCategory = lModel.productCategory;
lOrderListModel.userName = username;
lOrderListModel.productQuantity = mEdQuanity.getText().toString();
//をトーストしますNULLまたは空白の場合は、コードを実装します。これはトーストや入力値にエラーメッセージが表示されます// [Add]をクリックしてボタンを私は製品リストを更新しながら、アイテムのproductQuantityが、それは私がproductQuantity場合は空白またはNULLでトーストを追加したいメッセージ
double totalPrice = Double.parseDouble(lModel.productPrice) * Double.parseDouble(mEdQuanity.getText().toString());
lOrderListModel.productTotalPrice = "" + totalPrice;
String orderId = UUID.randomUUID().toString();
String userId = SharePref.getInstance(QuantityScreen.this).getLoginUserId();
updateItemCount();
datasource.addOrder(orderId, userId, lOrderListModel);
Toast.makeText(QuantityScreen.this, R.string.order_added_suc, Toast.LENGTH_LONG).show();
finish();
}
private void updateItemCount() {
String oldOrderCount = SharePref.getInstance(QuantityScreen.this).getOrderCount();
if (!oldOrderCount.equals("")) {
SharePref.getInstance(QuantityScreen.this).saveOrderCount("" + (Integer.parseInt(oldOrderCount) + Integer.parseInt(mEdQuanity.getText().toString())));
} else {
SharePref.getInstance(QuantityScreen.this).saveOrderCount("" + Integer.parseInt(mEdQuanity.getText().toString()));
}
}