private void InitFilter() { ComplexFilterParams = new CardFilterParams(); var staffRepository = new StaffRepository(); var filterDepartmentList = staffRepository.GetDepartments(); var filterStaffList = staffRepository.GetAll(staff => staff.Name.DisplayName); _filterStaffCheckList = new ObservableCollection <CheckBoxItem <Staff> >(); foreach (var staff in filterStaffList) { FilterStaffCheckList.Add(new CheckBoxItem <Staff> { Item = staff }); } OnPropertyChanged("FilterStaffCheckList"); _filterDepartmentCheckList = new ObservableCollection <CheckBoxItem <string> >(); foreach (var department in filterDepartmentList) { FilterDepartmentCheckList.Add(new CheckBoxItem <string> { Item = department }); } OnPropertyChanged("FilterDepartmentCheckList"); }
public dynamic GetAllStaff() { StaffRepository repo = new StaffRepository(); var listStaff = repo.GetAll(); return(listStaff); }
public MemoryStream GenerateCSV() { MemoryStream outStream = new MemoryStream(); StreamWriter writer = new StreamWriter(outStream); // Headings writer.Write("tenantId" + delimiter); writer.Write("proprietaryId" + delimiter); writer.Write("localId" + delimiter); writer.Write("primaryLocation" + delimiter); writer.Write("lastName" + delimiter); writer.Write("firstName" + delimiter); writer.Write("middleName" + delimiter); writer.Write("commonName" + delimiter); writer.Write("birthdate" + delimiter); writer.Write("status" + delimiter); writer.Write("email" + delimiter); writer.Write("gender" + delimiter); writer.Write("role" + delimiter); writer.Write("username" + delimiter); writer.Write("password" + delimiter); writer.Write(Environment.NewLine); StaffRepository _staffRepo = new StaffRepository(_dbConnectionString); List <StaffMember> allStaff = _staffRepo.GetAll(); foreach (StaffMember staff in allStaff.Where(s => s.IsEnabled)) { writer.Write(_clevrTenantID + "" + delimiter); writer.Write(stringContainer + staff.iStaffId + stringContainer + delimiter); writer.Write(stringContainer + staff.iStaffId + stringContainer + delimiter); writer.Write(stringContainer + staff.School.DAN + stringContainer + delimiter); writer.Write(stringContainer + staff.LastName + stringContainer + delimiter); writer.Write(stringContainer + staff.FirstName + stringContainer + delimiter); writer.Write(stringContainer + "" + stringContainer + delimiter); writer.Write(stringContainer + staff.FirstName + stringContainer + delimiter); writer.Write(stringContainer + "" + stringContainer + delimiter); writer.Write((staff.IsEnabled ? 1 : 0) + "" + delimiter); // status 1=active 0=inactive writer.Write(stringContainer + staff.EmailAddress + stringContainer + delimiter); writer.Write(stringContainer + "" + stringContainer + delimiter); writer.Write(stringContainer + staff.Role + stringContainer + delimiter); writer.Write(stringContainer + staff.LDAPUserName + stringContainer + delimiter); writer.Write(stringContainer + "" + stringContainer + delimiter); writer.Write(Environment.NewLine); } writer.Flush(); outStream.Flush(); return(outStream); }
public BaseListResponse <Staff> GetAllStaff() { var response = new BaseListResponse <Staff>(); try { response.IsSuccess = true; response.Data = _staffRepository.GetAll().ToList(); } catch (Exception ex) { response.IsSuccess = false; response.Message = "Error: " + ex.Message + " StackTrace: " + ex.StackTrace; } return(response); }
static void Main(string[] args) { StaffRepository staffRepository = new StaffRepository(); var test = staffRepository.GetAll().ToList(); if (test == null) { Console.WriteLine("not found"); } else { Console.WriteLine($"found {test.Count} staff!"); } Console.WriteLine(); Console.ReadKey(); }
public MemoryStream GenerateCSV() { MemoryStream outStream = new MemoryStream(); StreamWriter writer = new StreamWriter(outStream); // Headings writer.Write("School_id" + delimiter); writer.Write("Staff_id" + delimiter); writer.Write("Staff_email" + delimiter); writer.Write("First_name" + delimiter); writer.Write("Last_name" + delimiter); writer.Write("Department" + delimiter); writer.Write("Title" + delimiter); writer.Write("Username" + delimiter); writer.Write("Password" + delimiter); writer.Write(Environment.NewLine); StaffRepository _staffRepo = new StaffRepository(_dbConnectionString); List <StaffMember> allStaff = _staffRepo.GetAll(); List <string> seenTeacherCertNumbers = new List <string>(); // Get all sections SchoolClassRepository screpo = new SchoolClassRepository(_dbConnectionString); List <SchoolClass> sections = screpo.GetAll(); // Get all teacher assignments TeacherAssignmentRepository teacherAssignmentRepo = new TeacherAssignmentRepository(_dbConnectionString); List <TeacherAssignment> allTeachingAssignments = teacherAssignmentRepo.GetAll(); // Sort teacher assignments into a dictionary for easier consumption // Only send up classes that have teachers assigned Dictionary <int, List <TeacherAssignment> > assignmentsByClassID = new Dictionary <int, List <TeacherAssignment> >(); foreach (TeacherAssignment ta in allTeachingAssignments) { if (ta.Class != null) { if (!assignmentsByClassID.ContainsKey(ta.Class.iClassID)) { assignmentsByClassID.Add(ta.Class.iClassID, new List <TeacherAssignment>()); } if (ta.Teacher.TeachingCertificateNumber.Length > 0) { assignmentsByClassID[ta.Class.iClassID].Add(ta); } } } // Now make a list of teachers we need Dictionary <int, StaffMember> activeTeachers = new Dictionary <int, StaffMember>(); foreach (int classID in assignmentsByClassID.Keys) { foreach (TeacherAssignment ta in assignmentsByClassID[classID]) { if (ta.Teacher != null) { if (!activeTeachers.ContainsKey(ta.Teacher.iStaffId)) { activeTeachers.Add(ta.Teacher.iStaffId, ta.Teacher); } } } } // Now find all the teachers who aren't on the above list List <StaffMember> activeStaffWithoutClasses = new List <StaffMember>(); foreach (StaffMember teacher in allStaff) { if ((!activeTeachers.ContainsKey(teacher.iStaffId)) && teacher.IsEnabled) { activeStaffWithoutClasses.Add(teacher); } } // Now make the CSV foreach (StaffMember staff in activeStaffWithoutClasses) { if (!string.IsNullOrEmpty(staff.EmailAddress)) { string schoolID = staff.School.DAN; if (staff.School.isFake) { schoolID = "DEFAULT_DISTRICT_OFFICE"; } writer.Write(stringContainer + schoolID + stringContainer + delimiter); // School id writer.Write(stringContainer + staff.EmailAddress + stringContainer + delimiter); // Staff id writer.Write(stringContainer + staff.EmailAddress + stringContainer + delimiter); // staff email writer.Write(stringContainer + staff.FirstName + stringContainer + delimiter); // firstname writer.Write(stringContainer + staff.LastName + stringContainer + delimiter); // lastname writer.Write(stringContainer + "" + stringContainer + delimiter); // department writer.Write(stringContainer + "" + stringContainer + delimiter); // title writer.Write(stringContainer + staff.EmailAddress + stringContainer + delimiter); // username writer.Write(stringContainer + "" + stringContainer + delimiter); // password writer.Write(Environment.NewLine); } } writer.Flush(); outStream.Flush(); return(outStream); }
//GET api/staff public IEnumerable <Person> GetAll() { return(db.GetAll()); }
public List <Staff> GetAll() { return(staffRepository.GetAll()); }
public JsonResult GetStaffs() { var staffData = _staffRepository.GetAll(); return(Json(new { data = staffData }, JsonRequestBehavior.AllowGet)); }
public MemoryStream GenerateCSV() { MemoryStream outStream = new MemoryStream(); StreamWriter writer = new StreamWriter(outStream); // Headings writer.Write("School_id" + delimiter); writer.Write("Teacher_id" + delimiter); writer.Write("Teacher_number" + delimiter); writer.Write("State_teacher_id" + delimiter); writer.Write("Teacher_email" + delimiter); writer.Write("First_name" + delimiter); writer.Write("Middle_name" + delimiter); writer.Write("Last_name" + delimiter); writer.Write("Title" + delimiter); writer.Write("Username" + delimiter); writer.Write("Password" + delimiter); writer.Write(Environment.NewLine); StaffRepository _staffRepo = new StaffRepository(_dbConnectionString); List <StaffMember> staff = _staffRepo.GetAll(); List <string> seenTeacherCertNumbers = new List <string>(); // Get all sections SchoolClassRepository screpo = new SchoolClassRepository(_dbConnectionString); List <SchoolClass> sections = screpo.GetAll(); // Get all teacher assignments TeacherAssignmentRepository teacherAssignmentRepo = new TeacherAssignmentRepository(_dbConnectionString); List <TeacherAssignment> allTeachingAssignments = teacherAssignmentRepo.GetAll(); // Sort teacher assignments into a dictionary for easier consumption // Only send up classes that have teachers assigned Dictionary <int, List <TeacherAssignment> > assignmentsByClassID = new Dictionary <int, List <TeacherAssignment> >(); foreach (TeacherAssignment ta in allTeachingAssignments) { if (ta.Class != null) { if (!assignmentsByClassID.ContainsKey(ta.Class.iClassID)) { assignmentsByClassID.Add(ta.Class.iClassID, new List <TeacherAssignment>()); } if (ta.Teacher.TeachingCertificateNumber.Length > 0) { assignmentsByClassID[ta.Class.iClassID].Add(ta); } } } // Now make a list of teachers we need Dictionary <int, StaffMember> activeTeachers = new Dictionary <int, StaffMember>(); foreach (int classID in assignmentsByClassID.Keys) { foreach (TeacherAssignment ta in assignmentsByClassID[classID]) { if (ta.Teacher != null) { if (!activeTeachers.ContainsKey(ta.Teacher.iStaffId)) { activeTeachers.Add(ta.Teacher.iStaffId, ta.Teacher); } } } } // Now make the CSV foreach (StaffMember teacher in activeTeachers.Values) { if ((teacher.School.DAN != "0") && (teacher.School.DAN.Length > 1) && (!string.IsNullOrEmpty(teacher.TeachingCertificateNumber) && (!seenTeacherCertNumbers.Contains(teacher.TeachingCertificateNumber)))) { seenTeacherCertNumbers.Add(teacher.TeachingCertificateNumber); writer.Write(stringContainer + teacher.School.DAN + stringContainer + delimiter); // School id writer.Write(stringContainer + teacher.TeachingCertificateNumber + stringContainer + delimiter); // Teacher id writer.Write(stringContainer + teacher.TeachingCertificateNumber + stringContainer + delimiter); // Teacher number writer.Write(stringContainer + "" + stringContainer + delimiter); // State teacher id writer.Write(stringContainer + teacher.EmailAddress + stringContainer + delimiter); // teacher email writer.Write(stringContainer + teacher.FirstName + stringContainer + delimiter); // firstname writer.Write(stringContainer + "" + stringContainer + delimiter); // middlename writer.Write(stringContainer + teacher.LastName + stringContainer + delimiter); // lastname writer.Write(stringContainer + "" + stringContainer + delimiter); // title writer.Write(stringContainer + teacher.EmailAddress + stringContainer + delimiter); // username writer.Write(stringContainer + "" + stringContainer + delimiter); // password writer.Write(Environment.NewLine); } } writer.Flush(); outStream.Flush(); return(outStream); }
public IEnumerable <Staff> GetAll() { return(repo.GetAll()); }