コード例 #1
0
        public List<DirectoryMember> GetMembersWithNoLdap()
        {
            ExternalDataContext exData = new ExternalDataContext();

            List<DirectoryMember> mm = new List<DirectoryMember>();

            foreach(LdapStaffCandidate c in exData.LdapStaffCandidates.OrderBy(x => x.Surname).ThenBy(x => x.GivenName).ThenBy( x=> x.MiddleName))
            {
                DirectoryMember m = new DirectoryMember(c);
                m.Id = c.Id;
                mm.Add(m);
            }

            return mm;
        }
コード例 #2
0
        // GET: Manage/DirectoryMembers
        public ActionResult Index(int? page, long? filter, string search, string theme)
        {
            ViewBag.Error = null;

            

            long f = (filter == null) ? 0 : filter.Value;

            ContextManager cm = new ContextManager();

            List<DirectoryMember> members = cm.DirectoryContext.DirectoryMembers.GetByFilter(f, search);

            ViewBag.Filter = f;

            if (theme != null)
                Session["Theme"] = theme;

            List<DirectoryMember> dd = new List<DirectoryMember>();

            foreach (DirectoryMember d in members)
            {
                DirectoryMember m = new DirectoryMember(d);
                m.Id = d.Id;
                dd.Add(m);
            }

            Session[DirMemberSessionVar] = dd;

            page = (page == null) ? 1 : page;

            ViewBag.Page = page.Value;
            ViewBag.Action = "Index";
            ViewBag.Header = "Directory Members";
            ViewBag.Total = dd.Count();

            PagedList<DirectoryMember> pg = new PagedList<DirectoryMember>(dd, page.Value, 12);

            return View(pg);
        }
コード例 #3
0
        public ActionResult CreateStudentAsp()
        {
            string result = "ok";

            try
            {
                List<StudentCandidate> users = context.GetStudentsWithNoAsp()
                        .OrderBy(x => x.Surname).ThenBy(x => x.GivenName).ThenBy(x => x.MiddleName)
                        .ToList();

                foreach(IDirectoryMember i in users)
                {
                    DirectoryMember m = new DirectoryMember(i);
                    m.ConfirmPassword = m.InitialPassword;
                    cm.MemberContext.Insert(m);
                }
            }
            catch(Exception ex)
            {
                ExceptionCollector ec = new ExceptionCollector(ex);
                result = ec.ToUL();
            }

            return Content(result);
        }
コード例 #4
0
        public ActionResult CreateNewStaffMember(string id)
        {
            DirectoryMemberRepository mbrCntxt = new DirectoryMemberRepository();

            ExternalDataContext context = new ExternalDataContext();

            StaffCandidate candidate = context.StaffCandidates.First(x => x.InternalId.ToLower().Equals(id.ToLower()));

            DirectoryMember m = new DirectoryMember(candidate);
            m.ConfirmPassword = m.InitialPassword;
            mbrCntxt.Insert(m);

            return RedirectToAction("StaffCandidates");

        }
コード例 #5
0
        public ActionResult CreateNewStaff()
        {
            DirectoryMemberRepository mbrCntxt = new DirectoryMemberRepository();

            ExternalDataContext context = new ExternalDataContext();
            List<StaffCandidate> staff = context.GetSatffCandidatesWithNoAsp().ToList();

            List<DirectoryMember> members = new List<DirectoryMember>();
            foreach (StaffCandidate s in staff)
            {
                DirectoryMember m = new DirectoryMember(s);
                m.ConfirmPassword = m.InitialPassword;
                mbrCntxt.Insert(m);
            }

            return RedirectToAction("StaffCandidates");
        }
コード例 #6
0
        public ActionResult StaffCandidates(int? page, long? filter, string search, string theme)
        {
            ViewBag.Error = null;

            long f = (filter == null) ? 0 : filter.Value;

            ExternalDataContext context = new ExternalDataContext();
            List<StaffCandidate> staff = context.GetSatffCandidatesWithNoAsp().ToList();

            List<DirectoryMember> members = new List<DirectoryMember>();
            foreach(StaffCandidate s in staff)
            {
                DirectoryMember m = new DirectoryMember(s);
                members.Add(m);
            }


            ViewBag.Filter = f;

            if (theme != null)
                Session["Theme"] = theme;

            List<DirectoryMember> dd = new List<DirectoryMember>();

            foreach (DirectoryMember d in members)
            {
                dd.Add(new DirectoryMember(d));
            }

            Session[DirMemberSessionVar] = dd;

            page = (page == null) ? 1 : page;

            ViewBag.Page = page.Value;
            ViewBag.Action = "StaffCandidates";
            ViewBag.Header = "New Staff";
            ViewBag.Total = dd.Count();

            PagedList<DirectoryMember> pg = new PagedList<DirectoryMember>(dd, page.Value, 12);

            return View("Index", pg);
        }
コード例 #7
0
        public DirectoryMember AddToDirectory()
        {
            try
            {
                DivisionDirectoryContext context = new DivisionDirectoryContext();

                DirectoryMember m = new DirectoryMember(this);
                context.DirectoryMembers.Insert(m);
                return m;
            }
            catch(Exception ex)
            {
                throw new Exception("Could not add canidate tp directory", ex);
            }
        }