Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.s1_product_update);

    Intent intent = getIntent();
    mProduct = (SIMPLE_PRODUCT) intent.getSerializableExtra("product");
    init(mProduct);
    mShared = getSharedPreferences(MemberAppConst.USERINFO, 0);
    mAlertView =
        new AlertView(
                "信息提示",
                "确定删除该条记录!",
                "取消",
                new String[] {"确定"},
                null,
                this,
                AlertView.Style.Alert,
                this)
            .setCancelable(true)
            .setOnDismissListener(this);

    mProductModel = new ProductModel(this);
    mProductModel.addResponseListener(this);

    EventBus.getDefault().register(this);
  }
Exemplo n.º 2
0
 @Override
 public void onItemClick(Object o, int position) {
   if (position != AlertView.CANCELPOSITION) {
     mProductModel.del(mProduct.id);
   }
 }
Exemplo n.º 3
0
  @Override
  public void onClick(View v) {
    Intent intent;
    switch (v.getId()) {
      case R.id.top_view_back:
        finish();
        break;
      case R.id.top_member_upate:
        String name = product_name.getText().toString();
        String type_id = product_typeid.getText().toString();
        String type_name = product_type.getText().toString();
        String price = product_price.getText().toString();
        String sprice = product_sprice.getText().toString();
        String nShopid = mShared.getString("shopid", "0");
        String nShopname = mShared.getString("shopname", "");
        String special, discount, credit;
        if (rb_special_true.isChecked()) {
          special = "1";
        } else {
          special = "0";
        }

        if (rb_discount_true.isChecked()) {
          discount = "1";
        } else {
          discount = "0";
        }

        if (rb_credit_true.isChecked()) {
          credit = "1";
        } else {
          credit = "0";
        }

        if ("".equals(name)) {
          ToastShow("项目名称不能为空");
          product_name.setText("");
          product_name.requestFocus();
        } else if ("".equals(type_id)) {
          ToastShow("项目分类不能为空");
          product_type.requestFocus();

        } else {
          SIMPLE_PRODUCT product = new SIMPLE_PRODUCT();
          product.name = name;
          product.price = price;
          product.type_id = Integer.parseInt(type_id);
          product.type_name = type_name;
          product.specia_price = sprice;
          product.special = special;
          product.special_discount = discount;
          product.special_credit = credit;
          product.id = mProduct.id;
          product.shopid = nShopid;
          product.shopname = nShopname;
          mProductModel.update(product);
        }
        break;

      case R.id.c0_del_button:
        {
          mAlertView.show();
          break;
        }
    }
  }