Could you please revise the following sentences? Thank you.

Shall I consider both sentences as correct?
1) I was having dinner / I had been having dinner when the telephone rang.
2)He told me he had lost his car keys and that he wanted me to go and pick him up (it "to go" necessary?)
3) He had been cleaning everything (not "all"?) by 9 o'clock.
4) It was two weeks since I had spoken with my parents.
5) I hadn't spoken with them for two weeks.
You should check your test better/more carefully/further (which are possible?)
6) You have to dress better/more smartly/more elegantly (which are possible?)
We arrived later/earlier than we expected.
7) If she hadd had a lot of money, she would not have been (is the position of "not") correct?

1. Both are correct, yes.

2. I'd delete "go and" and keep the rest.

3. Yes, use "everything" but not "all."

4. It has been two weeks since I last spoke with my parents. <~~Better. The verb tenses in the original sentence are grammatically correct (sequence of tenses), but they sound awkward.

5. ... more carefully.

6. All variations are possible.

7. ... had had ...
Yes, you have "not" in the right place.

Sure, I'd be happy to revise the sentences for you:

1) I was having dinner when the telephone rang.
I had been having dinner when the telephone rang.

2) He told me he had lost his car keys and wanted me to go pick him up.
He told me he had lost his car keys and that he wanted me to go pick him up. (The "to go" is not necessary but can be included for clarity.)

3) He had been cleaning everything by 9 o'clock.
He had been cleaning everything all by 9 o'clock.

4) It had been two weeks since I had spoken with my parents.
It was two weeks since I had spoken with my parents.

5) I hadn't spoken with them in two weeks.

Regarding the next set of sentences:

6) You should check your test more carefully. (Using "better" is also possible, but "more carefully" is more precise.)

7) You have to dress more elegantly. (Using "better" or "more smartly" is also possible, but "more elegantly" implies a higher level of sophistication.)

Regarding the last sentence:

8) If she had had a lot of money, she would not have been (position of "not" is correct).
If she had had a lot of money, she would not have been.