コード例 #1
0
  private long savePSImage() {

    String latitude = new LocationService(this).getLatitude() + "";
    String longitude = new LocationService(this).getLongitude() + "";

    // -----save image------
    Image image = new Image();

    String filePath = mUriImage.getPath();
    image.setFileName(FileUtil.getFileName(filePath));
    image.setFilePath(filePath);
    image.setLatitude(latitude);
    image.setLongitude(longitude);

    image.setSessionCode(DatabaseUtil.getCodeGenerationByTime());
    image.setCreateBy(UserPref.getUserPrefId(this));
    image.setCreateAt(Calendar.getInstance());
    image.setUploadStatus(UploadStatus.WAITING_UPLOAD);

    // -----save Attendance image------
    ProductShownImg psi = new ProductShownImg();

    psi.setProductShownId(mProductShown.get_id());

    psi.setSessionCode(DatabaseUtil.getCodeGenerationByTime());
    psi.setCreateBy(UserPref.getUserPrefId(this));
    psi.setCreateAt(Calendar.getInstance());
    psi.setUploadStatus(UploadStatus.WAITING_UPLOAD);

    return ProductShownImgData.add(this, image, psi);
  }
コード例 #2
0
  private long addProductShown() {
    // lấy giá trị
    Product product = (Product) mSpinner_Product.getSelectedItem();
    long productId = product.get_id();
    int number = Integer.valueOf(mInputLayout_Number.getEditText().getText() + "");
    long retailPrice = Long.valueOf(mInputLayout_RetailPrice.getEditText().getText() + "");

    // gán giá trị
    mProductShown = new ProductShown();

    mProductShown.setAssignId(mAssignId);
    mProductShown.setProductId(productId);
    mProductShown.setNumber(number);
    mProductShown.setRetailPrice(retailPrice);

    mProductShown.setSessionCode(DatabaseUtil.getCodeGenerationByTime());
    mProductShown.setCreateBy(UserPref.getUserPrefId(this));
    mProductShown.setCreateAt(Calendar.getInstance());
    mProductShown.setUploadStatus(UploadStatus.WAITING_UPLOAD);

    long id = ProductShownData.add(this, mProductShown);
    mProductShown.set_id(id);

    return id;
  }