示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            int number = int.Parse(m_region.Settings.Where(p => p.Key == "PositionsStartIndex").Single().Value);

            Guid guid = Guid.NewGuid();

            if (m_region.Positions.Count() > 0)
            {
                var max = (from p in m_region.Positions
                           select(p.PositionNumber)).Max();

                if (max.HasValue)
                {
                    number = max.Value + 1;
                }
            }

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

            PositionEditForm frm = new PositionEditForm(m_region, position);

            frm.Show();
        }
示例#2
0
 private void dg_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (dg.SelectedRows.Count > 0)
     {
         Position         item = dg.SelectedRows[0].DataBoundItem as Position;
         PositionEditForm form = new PositionEditForm(m_region, item);
         form.Show(this);
     }
 }
        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();
        }