Ejemplo n.º 1
0
        private static UserInfo MapToModel(User u)
        {
            var info = new UserInfo();

            var profile = UserProfileHelper.GetUserProfile(u.LoginName);

            info.Id  = u.Id;
            info.Upn = u.LoginName;

            var form = GetUserForm(u.LoginName);

            info.CurrentFormId     = form == null ? 0 : form.Id;
            info.CurrentFormStatus = form == null ? "Not Available" : form.FormStatus;
            info.Groups            = u.Groups.Select(x => x.Title).ToList();
            info.IsReviewer        = info.IsInGroup(SharePointHelper.ReviewerGroup);
            info.IsAdmin           = info.IsInGroup(SharePointHelper.AdminGroup);

            info.DisplayName    = profile.DisplayName;
            info.UserProfileUrl = profile.UserUrl;
            info.Email          = profile.Email;

            info.PhoneNumber = profile.IsPropertyAvailable("UserProfileProperties") && profile.UserProfileProperties.ContainsKey("WorkPhone") ? profile.UserProfileProperties["WorkPhone"] : string.Empty;
            info.Branch      = profile.IsPropertyAvailable("UserProfileProperties") && profile.UserProfileProperties.ContainsKey("Office") ? profile.UserProfileProperties["Office"] : string.Empty;

            return(info);
        }
Ejemplo n.º 2
0
        private static UserInfo MapToModel(User u)
        {
            var info = new UserInfo();

            info.Id  = u.Id;
            info.Upn = u.LoginName;

            OGEForm450 form = null;

            form = GetUserForm(u.LoginName);

            if (form != null)
            {
                info.CurrentFormId     = form.Id;
                info.CurrentFormStatus = form.FormStatus;
            }
            else
            {
                info.CurrentFormId     = 0;
                info.CurrentFormStatus = "Not Available";
            }

            var profile = UserProfileHelper.GetUserProfile(u.LoginName);

            if (profile != null)
            {
                info.DisplayName    = profile.IsPropertyAvailable("DisplayName") ? profile.DisplayName : u.LoginName;
                info.UserProfileUrl = profile.IsPropertyAvailable("UserUrl") ? profile.UserUrl : "";
                info.Email          = profile.IsPropertyAvailable("Email") ? profile.Email : "";
                //info.Manager = (profile.IsPropertyAvailable("UserProfileProperties") && profile.UserProfileProperties.ContainsKey("Manager")) ? profile.UserProfileProperties["Manager"] : string.Empty;
                info.PhoneNumber = (profile.IsPropertyAvailable("UserProfileProperties") && profile.UserProfileProperties.ContainsKey("WorkPhone")) ? profile.UserProfileProperties["WorkPhone"] : string.Empty;
                info.Branch      = (profile.IsPropertyAvailable("UserProfileProperties") && profile.UserProfileProperties.ContainsKey("Office")) ? profile.UserProfileProperties["Office"] : string.Empty;
            }

            try
            {
                info.Groups            = u.Groups.Select(x => x.Title).ToList();
                info.IsReviewer        = info.IsInGroup(SharePointHelper.ReviewerGroup);
                info.IsAdmin           = info.IsInGroup(SharePointHelper.AdminGroup);
                info.IsRestrictedAdmin = info.IsInGroup(SharePointHelper.RestrictedAdmin);
            }
            catch (Exception ex)
            {
                // ignore
            }

            info.InMaintMode = Settings.IN_MAINTENANCE_MODE;

            return(info);
        }
Ejemplo n.º 3
0
        public IActionResult Index()
        {
            if (!_signInManager.IsSignedIn(User))
            {
                return(RedirectToAction("Index", "Home"));
            }

            var userProfile = UserProfileHelper.GetUserProfile(_database, _userManager.GetUserId(User));

            if (userProfile == null)
            {
                return(RedirectToAction("Setup"));
            }

            return(View());
        }
Ejemplo n.º 4
0
        public static void GetEmployeeUserProfileInfo(Employee emp)
        {
            var userProfile = UserProfileHelper.GetUserProfile(emp.AccountName);

            if (userProfile != null)
            {
                emp.Title        = userProfile.IsPropertyAvailable("DisplayName") ? userProfile.DisplayName : string.Empty;
                emp.DisplayName  = userProfile.IsPropertyAvailable("DisplayName") ? userProfile.DisplayName : string.Empty;
                emp.EmailAddress = userProfile.IsPropertyAvailable("Email") ? userProfile.Email : string.Empty;
                emp.Position     = userProfile.IsPropertyAvailable("Title") ? userProfile.Title : string.Empty;
                emp.WorkPhone    = userProfile.IsPropertyAvailable("UserProfileProperties") && userProfile.UserProfileProperties.ContainsKey("WorkPhone") ? userProfile.UserProfileProperties["WorkPhone"] : string.Empty;
                emp.Agency       = userProfile.IsPropertyAvailable("UserProfileProperties") && userProfile.UserProfileProperties.ContainsKey("Department") ? userProfile.UserProfileProperties["Department"] : string.Empty;
                emp.Branch       = userProfile.IsPropertyAvailable("UserProfileProperties") && userProfile.UserProfileProperties.ContainsKey("Office") ? userProfile.UserProfileProperties["Office"] : string.Empty;
                emp.ProfileUrl   = userProfile.IsPropertyAvailable("UserUrl") ? userProfile.UserUrl : string.Empty;
                emp.PictureUrl   = userProfile.IsPropertyAvailable("PictureUrl") ? userProfile.PictureUrl : string.Empty;
            }
        }
Ejemplo n.º 5
0
        public override void MapToList(ListItem dest)
        {
            var userProfile = UserProfileHelper.GetUserProfile(this.Employee);

            if (Id == 0)
            {
                dest["Employee"] = SharePointHelper.GetFieldUser(this.Employee);
            }

            base.MapToList(dest);

            dest["EmployeesName"]  = userProfile != null ? userProfile.DisplayName  : "";
            dest["DateAndTime"]    = SharePointHelper.ToDateTimeNullIfMin(DateAndTime);
            dest["Location"]       = Location;
            dest["EthicsOfficial"] = EthicsOfficial;
            dest["Year"]           = Year;
            dest["TrainingType"]   = TrainingType;
            dest["Division"]       = Division;
        }
Ejemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            s_Mutex = new Mutex(true, "BioSeqDB");

            if (!s_Mutex.WaitOne(0, false))
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            Logger.Initialize(logger);

            UserProfileHelper.GetUserProfile(); // From C:\Temp\Remember.json.

            Properties.Settings.Default.ModelServer = UserProfileHelper.userProfile.ServerIPAddress;
            //MessageBox.Show("ServerIPAddress: " + Properties.Settings.Default.ModelServer, "ERROR", MessageBoxButtons.OK);
            Properties.Settings.Default.Save();

            // Check if BioSeqService is listening.
            string IsClientOnServer = string.Empty;

            try
            {
                IsClientOnServer = ServiceCallHelper.HelloBioSeqDBService();
            }
            catch (Exception ex)
            {
                MessageBox.Show("It appears that the BioSeqDB service is not running on the '" + Properties.Settings.Default.ModelServer +
                                "' server.  Check VPN if running remotely?", "ERROR", MessageBoxButtons.OK);
                return;
            }

            // Check if WSLProxy is listening.
            try
            {
                string message = BioSeqDBModel.Instance.WSLVersion();
            }
            catch (Exception ex)
            {
                MessageBox.Show("It appears that the WSLProxy service is not running on the '" + Properties.Settings.Default.ModelServer +
                                "' server.", "ERROR", MessageBoxButtons.OK);
                Logger.Log.Debug("It appears that the WSLProxy service is not running on the server. Exception\n" + ex.ToString());
                return;
            }

            try
            {
                BioSeqDBLogin frmLogin = new BioSeqDBLogin(IsClientOnServer);
                if (frmLogin.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(new BioSeqUI());
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Debug("Fatal error: " + ex.ToString());
                MessageBox.Show(ex.ToString(), "ERROR", MessageBoxButtons.OK);
            }
        }