Example #1
0
    public static void updateUserCLI(UserCLI obj)
    {
        if (obj == null)
        {
            throw new ArgumentException("El objeto no debe ser nul");
        }

        UserCLITableAdapter adapter = new UserCLITableAdapter();

        adapter.Update(obj.Nombre, obj.Apellido, obj.Email, obj.UserId);
    }
Example #2
0
    public static int insertUserCLI(UserCLI obj)
    {
        if (obj == null)
        {
            throw new ArgumentException("El objeto no debe ser nul");
        }

        int?userCLI_ID = null;
        UserCLITableAdapter adapter = new UserCLITableAdapter();

        adapter.Insert(obj.Nombre, obj.Apellido, obj.Email, obj.Password, ref userCLI_ID);

        if (userCLI_ID == null || userCLI_ID.Value <= 0)
        {
            throw new ArgumentException("La llave primaria no se generĂ³ correctamente");
        }

        return(userCLI_ID.Value);
    }
Example #3
0
    public static UserCLI getUserByEmail(string email)
    {
        UserCLITableAdapter adapter = new UserCLITableAdapter();

        UserCLI_DS.UserCLIDataTable table = adapter.GetUserCLIByEmail(email);

        if (table.Rows.Count == 0)
        {
            return(null);
        }

        UserCLI_DS.UserCLIRow row = table[0];
        UserCLI obj = new UserCLI()
        {
            UserId   = row.UserId,
            Nombre   = row.nombre,
            Apellido = row.apellido,
            Email    = row.email,
            Password = row.password
        };

        return(obj);
    }