Package net.virtuemart.www.VM_Users

Examples of net.virtuemart.www.VM_Users.User


                Date now = new Date();
          if (notToSync.contains(localCustomer.getTaxid())) {
            continue;
          }
                cpt++;
                    User userAdd = new User();
                    userAdd.setLogin(localCustomer.getTaxid());
                    userAdd.setId(localCustomer.getTaxid());
                    userAdd.setFirstname(" ");

                    String tmpName = localCustomer.getName().trim();
                    tmpName = tmpName.replace("'", "");
                   
                    while (tmpName.charAt(0)==' ') {
                        tmpName = tmpName.substring(1);
                    }

                    userAdd.setLastname(tmpName);

                    char[] pw = new char[8];
                    int c  = 'A';
                    int  r1 = 0;
                    for (int i=0; i < 8; i++)
                    {
                      r1 = (int)(Math.random() * 3);
                      switch(r1) {
                        case 0: c = '0' (int)(Math.random() * 10); break;
                        case 1: c = 'a' (int)(Math.random() * 26); break;
                        case 2: c = 'A' (int)(Math.random() * 26); break;
                      }
                      pw[i] = (char)c;
                    }
                    String clave=new String(pw);
                    byte[] password = {00};
                    try {
                            MessageDigest md5 = MessageDigest.getInstance("MD5");
                            md5.update(clave.getBytes());
                            password = md5.digest();

                            userAdd.setPassword(password.toString());
                    } catch (NoSuchAlgorithmException ex) {
                        Logger.getLogger(UsersSync.class.getName()).log(Level.SEVERE, null, ex);
                        userAdd.setPassword(clave);
                    }
                    userAdd.setTitle("M");

                    if (localCustomer.getEmail()==null || localCustomer.getEmail().trim().equals("") || localCustomer.getEmail().indexOf('@')<=0)
                            userAdd.setEmail(localCustomer.getTaxid()+defaultEmail);
                    else
                            userAdd.setEmail(localCustomer.getEmail());

                    userAdd.setDescription(localCustomer.getNotes()+"");
                    userAdd.setAddress(localCustomer.getAddress()+"");
                    userAdd.setAddress2(localCustomer.getAddress2()+"");
                    userAdd.setState_region(localCustomer.getRegion()+"");
                    userAdd.setCity(localCustomer.getCity()+"");
                    userAdd.setCountry(localCustomer.getCountry()+"");
                    userAdd.setZipcode(localCustomer.getPostal()+"");
                    userAdd.setPhone(localCustomer.getPhone()+"");
                    userAdd.setMobile(localCustomer.getPhone2()+"");
                    userAdd.setFax(" ");
                    try {
                            userAdd.setCdate(df.format(localCustomer.getCurdate()));
                    } catch (NullPointerException nu) {
                            userAdd.setCdate(df.format(now));
                    }
                    userAdd.setPerms("shopper");
                    userAdd.setBank_account_nr("");
                    userAdd.setBank_account_holder("");
                    userAdd.setBank_account_type("");
                    userAdd.setBank_iban("");
                    userAdd.setBank_name("");
                    userAdd.setBank_sort_code("");
                    userAdd.setMdate(df.format(now));
                    userAdd.setShopper_group_id("1");

                  

                    externalsales.addUser(userAdd);
    }
View Full Code Here


            Date now = new Date();
          if (notToSync.contains(localCustomer.getTaxid())) {
            continue;
          }
                cpt++;
                    User userAdd = new User();
                    userAdd.setLogin(localCustomer.getTaxid());
                    userAdd.setId(localCustomer.getTaxid());
                    userAdd.setFirstname(" ");

                    String tmpName = localCustomer.getName().trim();
                    tmpName = tmpName.replace("'", "");
                   
                    while (tmpName.charAt(0)==' ') {
                        tmpName = tmpName.substring(1);
                    }

                    userAdd.setLastname(tmpName);

                    char[] pw = new char[8];
                    int c  = 'A';
                    int  r1 = 0;
                    for (int i=0; i < 8; i++)
                    {
                      r1 = (int)(Math.random() * 3);
                      switch(r1) {
                        case 0: c = '0' (int)(Math.random() * 10); break;
                        case 1: c = 'a' (int)(Math.random() * 26); break;
                        case 2: c = 'A' (int)(Math.random() * 26); break;
                      }
                      pw[i] = (char)c;
                    }
                    String clave=new String(pw);
                    byte[] password = {00};
                    try {
                            MessageDigest md5 = MessageDigest.getInstance("MD5");
                            md5.update(clave.getBytes());
                            password = md5.digest();

                            userAdd.setPassword(password.toString());
                    } catch (NoSuchAlgorithmException ex) {
                        Logger.getLogger(UsersSync.class.getName()).log(Level.SEVERE, null, ex);
                        userAdd.setPassword(clave);
                    }
                    userAdd.setTitle("M");

                    if (localCustomer.getEmail()==null || localCustomer.getEmail().trim().equals("") || localCustomer.getEmail().indexOf('@')<=0)
                            userAdd.setEmail(localCustomer.getTaxid()+defaultEmail);
                    else
                            userAdd.setEmail(localCustomer.getEmail());

                    userAdd.setDescription(localCustomer.getNotes()+"");
                    userAdd.setAddress(localCustomer.getAddress()+"");
                    userAdd.setAddress2(localCustomer.getAddress2()+"");
                    userAdd.setState_region(localCustomer.getRegion()+"");
                    userAdd.setCity(localCustomer.getCity()+"");
                    userAdd.setCountry(localCustomer.getCountry()+"");
                    userAdd.setZipcode(localCustomer.getPostal()+"");
                    userAdd.setPhone(localCustomer.getPhone()+"");
                    userAdd.setMobile(localCustomer.getPhone2()+"");
                    userAdd.setFax(" ");
                    try {
                            userAdd.setCdate(df.format(localCustomer.getCurdate()));
                    } catch (NullPointerException nu) {
                            userAdd.setCdate(df.format(now));
                    }
                    userAdd.setPerms("shopper");
                    userAdd.setBank_account_nr("");
                    userAdd.setBank_account_holder("");
                    userAdd.setBank_account_type("");
                    userAdd.setBank_iban("");
                    userAdd.setBank_name("");
                    userAdd.setBank_sort_code("");
                    userAdd.setMdate(df.format(now));
                    userAdd.setShopper_group_id("1");

                    externalsales.addUser(userAdd);
    }
            return cpt;
  }
View Full Code Here

TOP

Related Classes of net.virtuemart.www.VM_Users.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.