private void button3_Click(object sender, RibbonControlEventArgs e)
        {
            WindowFormRegionCollection formRegions =
                Globals.FormRegions
                [Globals.ThisAddIn.Application.ActiveExplorer()];

            if (!ServiceHelper.IsLoggedIn)
            {
                using (LoginForm frmLogin = new LoginForm())
                {
                    frmLogin.ShowDialog();
                    return;
                }
            }

            if (formRegions.MainRegion.IsRoleWorkerBusy || formRegions.MainRegion.IsCandidatesWorkerBusy)
            {
                return;
            }

            if (formRegions.MainRegion.Roles != null)
            {
                ManageRolesForm frm = new ManageRolesForm(formRegions.MainRegion);
                frm.ShowDialog();
            }
        }
        private void button4_Click_1(object sender, RibbonControlEventArgs e)
        {
            WindowFormRegionCollection formRegions =
                Globals.FormRegions
                [Globals.ThisAddIn.Application.ActiveExplorer()];

            if (!ServiceHelper.IsLoggedIn)
            {
                using (LoginForm frmLogin = new LoginForm())
                {
                    frmLogin.ShowDialog();
                    return;
                }
            }

            if (formRegions.MainRegion.IsRoleWorkerBusy || formRegions.MainRegion.IsCandidatesWorkerBusy)
            {
                return;
            }

            Guid guid = Guid.NewGuid();

            Candidate newCandidate = new Candidate();

            newCandidate.Username           = ServiceHelper.LastLogin.Username;
            newCandidate.RegistrationDate   = DateTime.Today;
            newCandidate.CandidateID        = guid;
            newCandidate.CandidatePositions = new List <CandidatePosition>();

            newCandidate.Status = "Classification";

            CandidateEditForm form = new CandidateEditForm(true, formRegions.MainRegion, newCandidate);

            form.Show();
        }
        private void button8_Click(object sender, RibbonControlEventArgs e)
        {
            WindowFormRegionCollection formRegions =
                Globals.FormRegions
                [Globals.ThisAddIn.Application.ActiveExplorer()];

            if (!ServiceHelper.IsLoggedIn)
            {
                using (LoginForm frmLogin = new LoginForm())
                {
                    frmLogin.ShowDialog();
                    return;
                }
            }

            if (formRegions.MainRegion.IsRoleWorkerBusy || formRegions.MainRegion.IsCandidatesWorkerBusy)
            {
                return;
            }

            int number = int.Parse(formRegions.MainRegion.Settings.Where(p => p.Key == "PositionsStartIndex").Single().Value);

            Guid guid = Guid.NewGuid();

            if (formRegions.MainRegion.Positions.Count() > 0)
            {
                while (formRegions.MainRegion.Positions.Any(p => p.PositionNumber == number))
                {
                    number++;
                }
            }

            var position = new Position
            {
                PositionNumber = number,
                PositionID     = guid,
                Username       = ServiceHelper.LastLogin.Username,
                IsNew          = true,
                PublishedAt    = DateTime.Today,
                Status         = "Open"
            };

            PositionEditForm frm = new PositionEditForm(formRegions.MainRegion, position);

            frm.Show();
        }
        private void toggleButton2_Click(object sender, RibbonControlEventArgs e)
        {
            WindowFormRegionCollection formRegions =
                Globals.FormRegions
                [Globals.ThisAddIn.Application.ActiveExplorer()];

            if (!ServiceHelper.IsLoggedIn)
            {
                using (LoginForm frmLogin = new LoginForm())
                {
                    frmLogin.ShowDialog();
                    return;
                }
            }

            if (formRegions.MainRegion.IsRoleWorkerBusy || formRegions.MainRegion.IsCandidatesWorkerBusy)
            {
                toggleButton2.Checked = !toggleButton2.Checked;
                return;
            }

            MainRegion.FilterFavorites["Red"] = toggleButton2.Checked;
            formRegions.MainRegion.DoSearch(-1);
        }