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; }
// 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); }
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); }
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"); }
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"); }
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); }
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); } }