Exemplo n.º 1
0
 public int login(UserEnt user)
 {
     SqlConnection sqlConnection = new SqlConnection(ConnectionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.Text;
     sqlCommand.CommandText = "Select ISNULL(MAX([Id]), 0) As Id From [User] Where [Condition] = 'ACTIVE' And [Username] = @Username "
         + "And [Password] = @Password";
     sqlCommand.Parameters.AddWithValue("@Username", user.USERNAME);
     sqlCommand.Parameters.AddWithValue("@Password", user.PASSWORD);
     sqlConnection.Open();
     int id = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return id;
 }
Exemplo n.º 2
0
 public int add(UserEnt user)
 {
     SqlConnection sqlConnection = new SqlConnection(ConnectionDal.connectionString);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     sqlCommand.CommandType = CommandType.StoredProcedure;
     sqlCommand.CommandText = "addUser";
     sqlCommand.Parameters.AddWithValue("@Name", user.NAME);
     sqlCommand.Parameters.AddWithValue("@Last_Name", user.LAST_NAME);
     if (user.MATERNAL_SURNAME != "")
     {
         sqlCommand.Parameters.AddWithValue("@Maternal_Surname", user.MATERNAL_SURNAME);
     }
     else
     {
         sqlCommand.Parameters.AddWithValue("@Maternal_Surname", DBNull.Value);
     }
     sqlCommand.Parameters.AddWithValue("@Username", user.USERNAME);
     sqlCommand.Parameters.AddWithValue("@Password", user.PASSWORD);
     sqlCommand.Parameters.AddWithValue("@Condition", user.CONDITION);
     sqlConnection.Open();
     int id = Convert.ToInt32(sqlCommand.ExecuteScalar());
     sqlConnection.Close();
     return id;
 }
Exemplo n.º 3
0
 public int login(UserEnt user)
 {
     return userObject.login(user);
 }
Exemplo n.º 4
0
 public int add(UserEnt user)
 {
     return userObject.add(user);
 }