Author Topic: Get name of project and logged in user  (Read 6179 times)

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Get name of project and logged in user
« on: February 22, 2016, 11:59:00 pm »
Hi

How can I get the name of the project and the logged in user using c# and interop.EA?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get name of project and logged in user
« Reply #1 on: February 23, 2016, 12:34:55 am »
User:
Repository.GetCurrentLoginUser (boolean GetGuid)

"Name of the project" is ambiguous. You might find what you looking for in Repository.ConnectionString or Repository.Models

Geert
« Last Edit: February 27, 2016, 12:59:52 am by Geert Bellekens »

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Get name of project and logged in user
« Reply #2 on: February 27, 2016, 12:50:42 am »
Hej Stenvang!


To Geert's comments (and he means "name of the project", not "name of the report"; he was probably on a break from setting up some fiendishly intricate document generation) I'll just add that EA projects do not, in fact, have names at all. In other words, there's no project name to be found in any table in the EA database.

If you're using a file-based repository (.eap or .feap), you can use the file name as a sort-of project name. If you're using a DBMS repository, you can use the database name. But if people are using EA shortcuts (File -- Save Shortcut) to connect, then the name that you see in EA's main window title is stored inside the shortcut file -- which may be different for different users. And if people are using shortcuts, they might not recognize the database name.

If you need a unique identifier, you'll find it in Repository.ProjectGUID. But there is no Repository.ProjectName.

Hope this complicates matters further.

I mean, helps.


/Uffe
My theories are always correct, just apply them to the right reality.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get name of project and logged in user
« Reply #3 on: February 27, 2016, 01:03:48 am »
To Geert's comments (and he means "name of the project", not "name of the report"; he was probably on a break from setting up some fiendishly intricate document generation)
Thanks Uffe, I corrected it in the meantime.

"project" and "report" have mostly the same letters, and I've been doing a lot of reporting projects lately :-[

Geert

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Get name of project and logged in user
« Reply #4 on: July 05, 2019, 12:29:08 am »
Can anyone give me a hint, how I can get the first- and surname of the logged in user?

By calling
Code: [Select]
string logInUserGuid = Repository.GetCurrentLoginUser(false);
I only get the login-name. Do I have to search the name via GUID from the database, or is there any method to get that info?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get name of project and logged in user
« Reply #5 on: July 05, 2019, 02:03:01 am »
Do I have to search the name via GUID from the database?
Yes

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8063
  • Karma: +118/-20
    • View Profile

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13282
  • Karma: +556/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Get name of project and logged in user
« Reply #8 on: July 05, 2019, 07:34:26 pm »
Great, one more reason to use V15  :)