I need the OWA web part to automatically login the current user. How to do so using C#
This really isn't something you can develop a solution for unless you are looking to build your own Single Sign-On solution (not recommended). Take a look at this other thread that outlines two options (Kerberos delegation or ADFS).
Please check out this post and my answer.
If the user accessing SharePoint is the same account for the OWA access it is all a matter of configuration for the client and the servers (Exchange and SharePoint).
If you have the need to do it via code this will be a pretty big effort you will have to take with deep knowledge of kerberos and ad in general.