public float GetCourseRating(int course_id, ref List<string> errors) { var courseRating = 0; List<CapeReview> capeReviewList = new List<CapeReview>(); var reviewCount = 0; //// can never fail default to == 0 for all service layers if (string.IsNullOrEmpty(course_id.ToString())) { errors.Add("Invalid course id"); throw new ArgumentException(); } capeReviewList = this.repository.FindCapeReviewsByCourseId(course_id, ref errors); foreach (CapeReview cr in capeReviewList) { if (cr.CourseRating > 0) { reviewCount++; courseRating += cr.CourseRating; } } return courseRating / reviewCount; }
public List<Admin> GetAdminList() { var service = new AdminService(new AdminRepository(this.entities)); var errors = new List<string>(); return service.GetAdminList(ref errors); }
public void InsertTa(Ta ta, ref List<string> errors) { if (ta == null) { errors.Add("Ta cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(ta.FirstName)) { errors.Add("Ta first name cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(ta.LastName)) { errors.Add("Ta last name cannot be null"); throw new ArgumentException(); } if (this.repository.IsNotDuplicateTa(ta, ref errors)) { this.repository.AddTa(ta, ref errors); } else { errors.Add("Duplicate Ta"); } }
public List<Ta> GetTaList() { var errors = new List<string>(); var repository = new TaRepository(this.entities); var service = new TaService(repository); return service.GetTaList(ref errors); }
public Course GetCourse(int id) { var errors = new List<string>(); var repository = new CourseRepository(this.entities); var service = new CourseService(repository); return service.GetCourse(id, ref errors); }
public Student GetStudent(string id) { var errors = new List<string>(); var repository = new StudentRepository(); var service = new StudentService(repository); return service.GetStudent(id, ref errors); }
public ShippingRate[] GetShippingRatesSyncParallel(decimal weight, string originZipCode, string destinationZipCode) { // create object that will store results List<ShippingRate> rates = new List<ShippingRate>(); // launch asynchronous requests, which will complete in parallel WebRequest fedExRequest = CreateFedExRequest(weight, originZipCode, destinationZipCode); IAsyncResult fedExResult = fedExRequest.BeginGetResponse(null, null); WebRequest upsRequest = CreateUpsRequest(weight, originZipCode, destinationZipCode); IAsyncResult upsResult = upsRequest.BeginGetResponse(null, null); WebRequest uspsRequest = CreateUspsRequest(weight, originZipCode, destinationZipCode); IAsyncResult uspsResult = uspsRequest.BeginGetResponse(null, null); // wait for all requests; each EndGetResponse will block if the request hasn't completed using (WebResponse response = fedExRequest.EndGetResponse(fedExResult)) rates.AddRange(GetFedExRates(response)); using (WebResponse response = upsRequest.EndGetResponse(upsResult)) rates.AddRange(GetUpsRates(response)); using (WebResponse response = uspsRequest.EndGetResponse(uspsResult)) rates.AddRange(GetUspsRates(response)); return rates.ToArray(); }
public GradeChange FindGradeChangeByCourseId(int course_id) { var errors = new List<string>(); var repository = new GradeChangeRepository(this.entities); var service = new GradeChangeService(repository); return service.FindGradeChangeByCourseId(course_id, ref errors); }
public GradeChange FindGradeChangeByStudentId(string student_id) { var errors = new List<string>(); var repository = new GradeChangeRepository(this.entities); var service = new GradeChangeService(repository); return service.FindGradeChangeByStudentId(student_id, ref errors); }
public List<Waitlist> GetWaitList() { var errors = new List<string>(); var repository = new WaitlistRepository(); var service = new WaitlistService(repository); return service.GetWaitlist(ref errors); }
public List<t_flightmatching> addList(string flightDepartureSelectionne, string flightArrivalSelectionne, t_flightmatching flight) { /* flight flt = unitOfWork.FlightRepository.GetById(idFlight); flt.idStaff = stf.id; unitOfWork.FlightRepository.Update(flt); unitOfWork.Commit();*/ // string dep = flightDepartureSelectionne.departure; // string arr = flightArrivalSelectionne.arrival; string dateDep = flight.dateFlightMatchingDep; string dateArr = flight.dateFlightMatchingArr; List<t_flightmatching> listeAmaj = new List<t_flightmatching>(); List<t_flightmatching> listeTsLesFlights = utwk.FlightMatchingRepository.GetAll().ToList(); foreach (t_flightmatching f in listeTsLesFlights) { // if (f.departure == dep && f.arrival == arr && f.dateFlightMatchingDep == dateDep && f.dateFlightMatchingArr == dateArr) if (f.departure == flightDepartureSelectionne && f.arrival == flightArrivalSelectionne) { listeAmaj.Add(f); } } return listeAmaj; //return utwk.FlightMatchingRepository.GetAll().ToList(); }
public float GetInstructorRating(int instructorId) { var errors = new List<string>(); var repository = new CapeReviewRepository(this.entities); var service = new CapeReviewService(repository); return service.GetInstructorRating(instructorId, ref errors); }
public List<CapeReview> FindCapeReviewByCourseId(int cid) { var errors = new List<string>(); var repository = new CapeReviewRepository(this.entities); var service = new CapeReviewService(repository); return service.GetCapeReview(cid, ref errors); }
public void UpdateAdmin(Admin admin, ref List<string> errors) { if (admin == null) { errors.Add("Instructor cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(admin.FirstName)) { errors.Add("Admin requires a first name."); throw new ArgumentException(); } if (string.IsNullOrEmpty(admin.LastName)) { errors.Add("Admin requires a last name."); throw new ArgumentException(); } if (string.IsNullOrEmpty(admin.Email)) { errors.Add("Admin requires an email."); throw new ArgumentException(); } if (string.IsNullOrEmpty(admin.Password)) { errors.Add("Admin requires a password."); throw new ArgumentException(); } this.repository.UpdateAdmin(admin, ref errors); }
public List<TA> GetTAList() { var errors = new List<string>(); var repository = new TARepository(); var service = new TaService(repository); return service.GetTAList(ref errors); }
public void InsertInstructor(Instructor instructor, ref List<string> errors) { if (instructor == null) { errors.Add("Instructor cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(instructor.InstructorId)) { errors.Add("Invalid Instructor id"); throw new ArgumentException(); } if(string.IsNullOrEmpty(instructor.FirstName)) { errors.Add("Instructor requires a first name."); throw new ArgumentException(); } if (string.IsNullOrEmpty(instructor.LastName)) { errors.Add("Instructor requires a last name."); throw new ArgumentException(); } this.repository.InsertInstructor(instructor, ref errors); }
public List<Enrollment> GetEnrollments(string id) { var errors = new List<string>(); var repository = new StudentRepository(); var service = new StudentService(repository); return service.GetEnrollments(id, ref errors); }
public Ta GetTa(int id) { var errors = new List<string>(); var repository = new TaRepository(this.entities); var service = new TaService(repository); return service.GetTaById(id, ref errors); }
public List<Student> GetStudentList() { var errors = new List<string>(); var repository = new StudentRepository(); var service = new StudentService(repository); return service.GetStudentList(ref errors); }
public override List<Recipe> GetRecipes() { var recipes = new List<Recipe> { new Recipe { Id = Guid.NewGuid(), Title = "Recipe 01", Directions = new List<string> { "Un", "deux", "trois" } }, new Recipe() { Id = Guid.NewGuid(), Title="Recipe 02", Directions = new List<string> { "Un", "deux", "trois", "quatre" } }, new Recipe() { Id = Guid.NewGuid(), Title="Recipe 03", Directions = new List<string> { "Un", "deux", "trois", "quatre", "cinq" } } }; return recipes; }
public float CalculateGpa(string studentId, List<Enrollment> enrollments, ref List<string> errors) { if (string.IsNullOrEmpty(studentId)) { errors.Add("Invalid student id"); throw new ArgumentException(); } if (enrollments == null) { errors.Add("Invalid student id"); throw new ArgumentException(); } if (enrollments.Count == 0) { return 0.0f; } var sum = 0.0f; foreach (var enrollment in enrollments) { sum += enrollment.GradeValue; } return sum / enrollments.Count; }
public string Benchmark(int myIterations = 1000) { if (_toBeBenchenVertices == null) { return "No vertices available"; } List<VertexModel> vertices = _toBeBenchenVertices; var tps = new List<double> (); long edgeCount = 0; var sb = new StringBuilder (); Int32 range = ((vertices.Count / Environment.ProcessorCount) * 3) / 2; for (var i = 0; i < myIterations; i++) { var sw = Stopwatch.StartNew (); edgeCount = CountAllEdgesParallelPartitioner (vertices, range); sw.Stop (); tps.Add (edgeCount / sw.Elapsed.TotalSeconds); } sb.AppendLine (String.Format ("Traversed {0} edges ({1} in all iterations). Average: {2}TPS Median: {3}TPS StandardDeviation {4}TPS ", edgeCount, (long)edgeCount * (long)myIterations, Statistics.Average (tps), Statistics.Median (tps), Statistics.StandardDeviation (tps))); return sb.ToString (); }
public override List<Recipe> GetRecipes() { var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Model"].ToString()); connection.Open(); var command = new SqlCommand { Connection = connection, CommandText = "select * from recipedbs" }; var reader = command.ExecuteReader(); var recipes = new List<Recipe>(); while (reader.Read()) { recipes.Add( new Recipe { Id = Guid.Parse(reader["id"].ToString()), Title = (string)reader["name"] } ); } return recipes; }
public Instructor GetInstructorInfo(string id) { var errors = new List<string>(); var repository = new InstructorRepository(); var service = new InstructorService(repository); return service.GetInstructorInfo(id, ref errors); }
public static Dto.Ticket PostTicket( Dmn.Priority prio, string devnotes, string name, string email, string phoneNumber, string message, string twitterHandle, string facebookName, string contactMethod, string url, string website, string webpage, List<Dto.Developer> devs, string teamName, int teamId, bool isBroken, string featureName) { List<Dmn.Developer> dmnDevs = new List<Domain.Developer>(); foreach (Dto.Developer dev in devs) { dmnDevs.Add(new Dmn.Developer(dev.Name, dev.PhoneNumber, dev.Email)); } Dmn.WebLocation location = new Dmn.WebLocation(url, website, webpage); Dmn.DeveloperTeam team = new Dmn.DeveloperTeam(teamId, dmnDevs, teamName); Dmn.TicketInformation info = new Dmn.TicketInformation(prio, devnotes); Dmn.Customer customer = new Dmn.Customer(name, email, phoneNumber, message, twitterHandle, facebookName, contactMethod); Dmn.Feature feature = new Dmn.Feature(location, team, isBroken, featureName); Dmn.Ticket ticket = new Dmn.Ticket(info, customer, feature); Dmn.DummyDatabase.Tickets.Add(ticket); return TicketConverter.ToDto(ticket); }
public void UpdateAdmin(Admin adminPoco, ref List<string> errors) { if (adminPoco == null) { errors.Add("Admin cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(adminPoco.FirstName)) { errors.Add("Admin first name cannot be null"); throw new ArgumentException(); } if (string.IsNullOrEmpty(adminPoco.LastName)) { errors.Add("Admin last name cannot be null"); throw new ArgumentException(); } if (adminPoco.Id <= 0) { errors.Add("Admin Id cannot be null"); throw new ArgumentException(); } this.repository.UpdateAdmin(adminPoco, ref errors); }
public List<Enrollment> GetStudentEnrolledSchedulesByQuarter(string studentId, string year, string quarter) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetStudentEnrolledSchedulesByQuarter(studentId, year, quarter, ref errors); }
public Enrollment GetEnrollmentDetail(string studentId, int scheduleId) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetEnrollmentDetail(studentId, scheduleId, ref errors); }
public List<Enrollment> GetAllStudentEnrolledSchedules(string studentId) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetAllStudentEnrolledSchedules(studentId, ref errors); }
public List<Course> GetCourseList() { var service = new CourseService(new CourseRepository()); var errors = new List<string>(); //// we could log the errors here if there are any... return service.GetCourseList(ref errors); }