| | |
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | | import cn.com.basic.face.base.BaseFragment;
|
| | | import cn.com.basic.face.discern.entity.Register;
|
| | | import cn.com.basic.face.discern.query.item.CheckInQueryItem;
|
| | | import cn.com.basic.face.service.DictionaryMng;
|
| | | import cn.com.basic.face.service.RegisterMng;
|
| | |
| | | import java.util.Date;
|
| | |
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.entity.Person;
|
| | | import cn.com.basic.face.discern.entity.VisitPersonType;
|
| | |
|
| | | public class RegisterFragment extends BaseFragment implements View.OnClickListener{
|
| | |
|
| | |
| | | @ViewInject(R.id.register_visitor_class)
|
| | | private RegisterRightFieldLabelView register_visitor_class;
|
| | | @ViewInject(R.id.register_phone)
|
| | | private RegisterRightFieldLabelView register_phone;
|
| | | private RegisterRightFieldTextView register_phone;
|
| | | @ViewInject(R.id.register_id_class)
|
| | | private RegisterRightFieldLabelView register_id_class;
|
| | | @ViewInject(R.id.register_id_num)
|
| | | private RegisterRightFieldLabelView register_id_num;
|
| | | private RegisterRightFieldTextView register_id_num;
|
| | | @ViewInject(R.id.register_company)
|
| | | private RegisterRightFieldLabelView register_company;
|
| | | private RegisterRightFieldTextView register_company;
|
| | | @ViewInject(R.id.register_remark)
|
| | | private RegisterRightFieldLabelView register_remark;
|
| | | private RegisterRightFieldTextView register_remark;
|
| | | @ViewInject(R.id.fragment_register_choose_photo)
|
| | | private SimpleDraweeView fragment_register_choose_photo;
|
| | | @ViewInject(R.id.fragment_register_update__photo)
|
| | | private ImageView fragment_register_update__photo;
|
| | | @ViewInject(R.id.fragment_register_linear_layout)
|
| | | private LinearLayout fragment_register_linear_layout;
|
| | |
|
| | | private static final int PICK_IMAGE_REQUEST = 1;
|
| | | private LinearLayout fragment_register_linear_layout;
|
| | |
|
| | | private static RegisterFragment instance = new RegisterFragment();
|
| | |
|
| | |
| | | return R.layout.fragment_register;
|
| | | }
|
| | |
|
| | | @Override
|
| | | protected void initViews(View view, Bundle savedInstanceState) {
|
| | | fragment_register_linear_layout = (LinearLayout) view.findViewById(R.id.fragment_register_linear_layout);
|
| | | ViewUtils.inject(this, fragment_register_linear_layout);
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_register_save)
|
| | | public void fragment_register_save_click(View view) { }
|
| | |
|
| | |
| | | public void fragment_register_add_click(View v) {
|
| | | RequestParams params = new RequestParams();
|
| | |
|
| | | params.addBodyParameter(Person.FieldNames.name, register_name.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.phone, register_phone.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.gender, DictionaryMng.getInstance().getId(register_gender.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.identityType, DictionaryMng.getInstance().getId(register_id_class.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.country, DictionaryMng.getInstance().getId(register_country.getValue()));
|
| | | params.addBodyParameter(Person.FieldNames.identify, register_id_num.getValue());
|
| | | params.addBodyParameter(Person.FieldNames.birthday, register_birthday.getValue());
|
| | | String name = register_name.getValue();
|
| | | if (name.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "姓名不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_name.requestFocus();
|
| | | return;
|
| | | }
|
| | | String phone = register_phone.getValue();
|
| | | if (phone.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "电话不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_phone.requestFocus();
|
| | | return;
|
| | | }
|
| | | String gender = register_gender.getValue();
|
| | | if (gender.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "性别不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_gender.callOnClick();
|
| | | return;
|
| | | }
|
| | | String id_class = register_id_class.getValue();
|
| | | if (id_class.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "证件类型不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_id_class.callOnClick();
|
| | | return;
|
| | | }
|
| | | String country = register_country.getValue();
|
| | | if (country.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "国籍不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_country.callOnClick();
|
| | | return;
|
| | | }
|
| | | String id_num = register_id_num.getValue();
|
| | | if (id_num.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "证件编号不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_id_num.requestFocus();
|
| | | return;
|
| | | }
|
| | | String birthday = register_birthday.getValue();
|
| | | if (birthday.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "出生日期不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_birthday.callOnClick();
|
| | | return;
|
| | | }
|
| | | String company = register_company.getValue();
|
| | | if (company.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "公司名称不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_company.requestFocus();
|
| | | return;
|
| | | }
|
| | | String remark = register_remark.getValue();
|
| | | if (remark.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "备注不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_remark.requestFocus();
|
| | | return;
|
| | | }
|
| | | String visitor_class = register_visitor_class.getValue();
|
| | | if (visitor_class.trim().length() <= 0) {
|
| | | Toast.makeText(MainActivity.getInstance(), "访客类型不能为空", Toast.LENGTH_SHORT).show();
|
| | | register_visitor_class.callOnClick();
|
| | | return;
|
| | | }
|
| | | params.addBodyParameter(Register.FieldNames.username, name);
|
| | | params.addBodyParameter(Register.FieldNames.mobilePhone, phone);
|
| | | params.addBodyParameter(Register.FieldNames.genderId, DictionaryMng.getInstance().getId(gender));
|
| | | params.addBodyParameter(Register.FieldNames.identityTypeId, DictionaryMng.getInstance().getId(id_class));
|
| | | params.addBodyParameter(Register.FieldNames.countryId, DictionaryMng.getInstance().getId(country));
|
| | | params.addBodyParameter(Register.FieldNames.identifyNum, id_num);
|
| | | params.addBodyParameter(Register.FieldNames.companyId, company);
|
| | | params.addBodyParameter(Register.FieldNames.birthday, birthday);
|
| | | params.addBodyParameter("companyName", register_company.getValue());
|
| | |
|
| | | params.addBodyParameter(VisitPersonType.FieldNames.registerCompanyId, "0");
|
| | |
|
| | | RegisterMng.getInstance().add(params);
|
| | | }
|
| | |
|
| | | public void resetForm() {
|
| | | register_name.setValue("");
|
| | | register_phone.setValue("");
|
| | | register_gender.setValue("");
|
| | | register_id_class.setValue("");
|
| | | register_country.setValue("");
|
| | | register_id_num.setValue("");
|
| | | register_birthday.setValue("");
|
| | | register_company.setValue("");
|
| | | register_remark.setValue("");
|
| | | register_visitor_class.setValue("");
|
| | | }
|
| | |
|
| | | @OnClick(R.id.register_country)
|
| | |
| | | public void onClick(View v) {}
|
| | |
|
| | | public void setRegisterInfo(CheckInQueryItem item) {
|
| | | fragment_register_choose_photo.setImageURI(Uri.parse(AppApi.IMAGEURL_BASE + item.getImagePath()));
|
| | | fragment_register_choose_photo.setImageURI(Uri.parse(AppApi.IMAGE_URL_BASE + item.getImagePath()));
|
| | | }
|
| | |
|
| | | }
|