Android Open Source - ArrecebaAndroid System D A O






From Project

Back to project page ArrecebaAndroid.

License

The source code is released under:

GNU General Public License

If you think the Android project ArrecebaAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package br.com.projetointegrador.DAO;
//from www  . j ava  2 s  . c  o  m
import java.util.Hashtable;
import org.ksoap2.serialization.SoapObject;
import br.com.projetointegrador.TO.User;

public class SystemDAO extends WebService {
  private static final String URL = "http://192.168.43.5/ArrecebaWS/Services/UserWS.asmx";
  
  public static boolean CreateUser(User user) {
    String MethodName = "Create";
    
    Hashtable<String , Object> parameters = new Hashtable<String , Object>();
    parameters.put("name" , user.Name);
    parameters.put("login" , user.Login);
    parameters.put("password" , user.Password);
    parameters.put("email" , user.Email);
    parameters.put("sexo" , String.valueOf(user.Sexo));
    parameters.put("apptoken" , APPTOKEN);
    
    Object response = InvokeMethod(URL , MethodName , parameters);
    return RetrieveBooleanFromSoap(response);
  }
  
  public static User Login(User user) {
    String MethodName = "Login";
    
    Hashtable<String , Object> parameters = new Hashtable<String , Object>();
    parameters.put("login" , user.Login);
    parameters.put("password" , user.Password);
    
    Object response = InvokeMethod(URL , MethodName , parameters);
    
    return RetrieveUserFromSoap(response);
  }
  
  private static boolean RetrieveBooleanFromSoap(Object response) {
    return Boolean.parseBoolean(response.toString());
  }
  
  private static User RetrieveUserFromSoap(Object response) {
    SoapObject soap = (SoapObject) response;
    
    User user = new User();
    user.UserId = Integer.parseInt(soap.getProperty(0).toString());
    user.Name = soap.getProperty(1).toString();
    user.Login = soap.getProperty(2).toString();
    user.Password = soap.getProperty(3).toString();
    user.Email = soap.getProperty(4).toString();
    user.Sexo = soap.getProperty(5).toString().charAt(0);
    
    return user;
  }
  
}




Java Source Code List

br.com.projetointegrador.ArrecebaAndroidActivity.java
br.com.projetointegrador.SplashActivity.java
br.com.projetointegrador.DAO.CrudDAO.java
br.com.projetointegrador.DAO.InteresseDAO.java
br.com.projetointegrador.DAO.ProdutoDAO.java
br.com.projetointegrador.DAO.SQLite.java
br.com.projetointegrador.DAO.SystemDAO.java
br.com.projetointegrador.DAO.UserDAO.java
br.com.projetointegrador.DAO.WebService.java
br.com.projetointegrador.Frm.FrmCrudList.java
br.com.projetointegrador.Frm.FrmInteresse.java
br.com.projetointegrador.Frm.FrmLogadoBase.java
br.com.projetointegrador.Frm.FrmLogin.java
br.com.projetointegrador.Frm.FrmProdutos.java
br.com.projetointegrador.Frm.FrmRegistrarse.java
br.com.projetointegrador.TO.Categoria.java
br.com.projetointegrador.TO.Crud.java
br.com.projetointegrador.TO.Interesse.java
br.com.projetointegrador.TO.Produto.java
br.com.projetointegrador.TO.User.java
br.com.projetointegrador.View.InteresseViewHolder.java
br.com.projetointegrador.View.ProdutoViewHolder.java
br.com.projetointegrador.table.TbUser.java