Пример #1
0
        public EnumSession()
        {
            var systemUser = System.DirectoryServices.AccountManagement.UserPrincipal.Current;

            using (var conn = new SqlConnection(Properties.Settings.Default.ConnString))
            {
                Enumerations = new ObservableCollection <EnumerationModel>(conn.Query <EnumerationModel>($@"
SELECT *
FROM [EMS].[dbo].[Enumerations]
WHERE (
Category = 'EMS_Version'
)
"));
                conn.Query($@"
Insert into [EMS].[dbo].[logging] 
(
--[ProjectID]
--      ,[ProjectName]
      [LoggedBy]
      ,[Message]
      ,[Category1]
      ,[Category2]
      ,[EMS_Version]
      ,[Time]
)
values('{systemUser.EmailAddress}', 'User Login', 'Log', 'system', -1 ,'{DateTime.Now.Date}')");
            }
            new VersionSelector(Enumerations).ShowDialog();
            EMSVersion = VersionSelector.SelectedVersionEnum;
            if (EMSVersion == null)
            {
                Environment.Exit(0);

                return;
            }
            Initialize(VersionSelector.SelectedVersionEnum.EMS_Version);

            CurrentUser = Enumerations.FirstOrDefault(x => x.Name != null && x.Name.Equals(systemUser.Name, StringComparison.InvariantCultureIgnoreCase));
            if (CurrentUser == null)
            {
                CurrentUser = new EnumerationModel("User", systemUser.GivenName, EMSVersion.ID, systemUser.EmailAddress);
            }
        }
Пример #2
0
 public void Add(EnumerationModel model)
 {
 }