(d) An action under subdivision (a) or (b) may be commenced in the county in which the person against whom it is brought resides, has his or her principal place of business, or is doing business, or in the county where the transaction or any substantial portion thereof occurred. .
In any action subject to this section, concurrently with the filing of the complaint, the plaintiff shall file an affidavit stating facts showing that the action has been commenced in a county described in this section as a proper place for the trial of the action. If a plaintiff fails to file the affidavit required by this section, the court shall, upon its own motion or upon motion of any party, dismiss the action without prejudice.