public String addNewMail(String mailaddress) { String returnkey = ""; try { FreepeopleMailListMongoDao dao = new FreepeopleMailListMongoDao(); FreepeopleMailList amaildb = dao.find(mailaddress); if (amaildb != null) { returnkey = "exist"; } else { FreepeopleMailList afMailList = new FreepeopleMailList(); afMailList.mailaddress = mailaddress; afMailList.userType = "tryer"; Calendar rightNow = Calendar.getInstance(); rightNow.setTime(new Date()); rightNow.add(Calendar.DAY_OF_YEAR, FreepeopleConstant.tryerLicenseDay); // 日期加7天 afMailList.valideTime = rightNow.getTime(); afMailList.warningWomen = true; afMailList.womencheckingSaleDiscount = FreepeopleConstant.warningdiscount; dao.save(afMailList); returnkey = "success"; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return returnkey; }
public FreepeopleMailList loadMail(String mailaddress) { try { FreepeopleMailListMongoDao dao = new FreepeopleMailListMongoDao(); return dao.find(mailaddress); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
public String updateMail( String mailaddress, boolean warningWoMen, String womencheckingSaleDiscount) { String ErrMsg = ""; try { FreepeopleMailListMongoDao dao = new FreepeopleMailListMongoDao(); FreepeopleMailList afMailList = dao.find(mailaddress); if (afMailList == null) { ErrMsg = "notexist"; } else { afMailList.warningWomen = warningWoMen; afMailList.womencheckingSaleDiscount = Float.parseFloat(womencheckingSaleDiscount); dao.update(afMailList); ErrMsg = "success"; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return ErrMsg; }