static void Main() { ISessionFactory _sessionFactory = NhibernateService.OpenSessionFactory(); IWindowFormsFactory formsFactory = new WindowFormsFactory(); PlayerRepository playerRepository = new PlayerRepository(); TrainerRepository trainerRepository = new TrainerRepository(); AdminRepository adminRepository = new AdminRepository(); TrainingRepository trainingRepository = new TrainingRepository(); TeamRepository teamRepository = new TeamRepository(); TransactionRepository transactionRepository = new TransactionRepository(); MainController mainController = new MainController( formsFactory, playerRepository, trainerRepository, adminRepository, trainingRepository, teamRepository, transactionRepository, new AdminController(), new PlayerController(), new TrainerController(), new AuthController()); mainController.LoadDefaultModel(); Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormLogIn(mainController)); }
public ActionResult ShowTrainersPerCourse() { TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); return(View(trainers)); }
// GET: Stats public ActionResult Index() { StatsViewModel vm = new StatsViewModel(); CourseRepository courseRepository = new CourseRepository(); var courses = courseRepository.GetAll(); int courseCount = courses.Count(); vm.CoursesCount = courseCount; TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); int trainerCount = trainers.Count(); vm.TrainersCount = trainerCount; AssignmentRepository assignmentRepository = new AssignmentRepository(); var assignments = assignmentRepository.GetAll(); int assignmentCount = assignments.Count(); vm.AssignmentsCount = assignmentCount; StudentRepository studentRepository = new StudentRepository(); var students = studentRepository.GetAll(); int studentCount = students.Count(); vm.StudentsCount = studentCount; vm.CourseTable = courses; return(View(vm)); }
public ActionResult <Trainer> GetByName(string name) { var repo = new TrainerRepository(); var trainer = repo.Get(name); return(trainer); }
// GET: Courses/Create public ActionResult Create() { AssignemntRepository assignemntRepository = new AssignemntRepository(); ViewBag.SelectedAssignmentsId = assignemntRepository.GetAll().Select(x => new SelectListItem() { Value = x.AssignmentId.ToString(), Text = x.Title }); TrainerRepository trainerRepository = new TrainerRepository(); ViewBag.SelectedTrainersId = trainerRepository.GetAll().Select(x => new SelectListItem() { Value = x.TrainerId.ToString(), Text = x.LastName }); StudentRepository studentRepository = new StudentRepository(); ViewBag.SelectedStudentsId = studentRepository.GetAll().Select(x => new SelectListItem() { Value = x.StudentId.ToString(), Text = x.LastName }); return(View()); }
public static void TrainerById(int?id) { TrainerRepository trainerRepository = new TrainerRepository(); var trainer = trainerRepository.GetById(id); Console.WriteLine("{0, -5}{1, -10}", trainer.TrainerId, trainer.FirstName); }
public IActionResult DeleteTrainer(string name) { var repo = new TrainerRepository(); repo.Remove(name); return(Ok()); }
// GET: Stats public ActionResult Index() { StatsViewModel statsView = new StatsViewModel(); StudentRepository studentRepository = new StudentRepository(); var students = studentRepository.GetAll(); TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); CourseRepository courseRepository = new CourseRepository(); var courses = courseRepository.GetAll(); AssignmentRepository assignmentRepository = new AssignmentRepository(); var assignments = assignmentRepository.GetAll(); statsView.StudentsCount = students.Count(); statsView.TrainersCount = trainers.Count(); statsView.CoursesCount = courses.Count(); statsView.AssignmentsCount = assignments.Count(); //Grouping Students Per Course statsView.StudentsPerCourse = from student in students group student by student.Course into x orderby x.Key select x; //Grouping Trainers Per Course statsView.TrainersPerCourse = trainers .SelectMany(x => x.Courses.Select(y => new { Key = y, Value = x })).GroupBy(y => y.Key, x => x.Value); //Grouping Assignments Per Course statsView.AssignmentPerCourse = assignments .SelectMany(x => x.Courses.Select(y => new { Key = y, Value = x })).GroupBy(y => y.Key, x => x.Value); //Grouping Assignments Per Student statsView.AssignmentPerStudent = assignments .SelectMany(x => x.MarkAssignments.Select(y => new { Key = x, Value = y })).GroupBy(x => x.Key, y => y.Value); statsView.Students = students; statsView.Courses = courses; statsView.Assignments = assignments; return(View(statsView)); }
// GET: Stats public ActionResult Index() { StatsViewModel vm = new StatsViewModel(); StudentRepository studentRepository = new StudentRepository(); var students = studentRepository.GetAll(); CourseRepository courseRepository = new CourseRepository(); var courses = courseRepository.GetAll(); TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); AssignmentRepository assignmentRepository = new AssignmentRepository(); var assignments = assignmentRepository.GetAll(); vm.StudentsCount = students.Count(); vm.CoursesCount = courses.Count(); vm.TrainersCount = trainers.Count(); vm.AssignmentsCount = assignments.Count(); //Grouping Course Student vm.StudentsPerCourse = students .SelectMany(x => x.Courses.Select(y => new { Key = y, Value = x })) .GroupBy(y => y.Key, x => x.Value); //Grouping Course Trainer vm.TrainersPerCourse = trainers .SelectMany(x => x.Courses.Select(y => new { Key = y, Value = x })) .GroupBy(y => y.Key, x => x.Value); //Grouping Course Assignment vm.AssignmentPerCourse = courses .SelectMany(x => x.Assignments.Select(y => new { Key = x, Value = y })) .GroupBy(y => y.Key, x => x.Value); vm.Students = students; vm.Courses = courses; vm.Assignments = assignments; return(View(vm)); }
public static void AllTrainers() { TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); foreach (var trainer in trainers) { Console.WriteLine("{0, -5}{1, -10}", trainer.TrainerId, trainer.FirstName); } }
public StudentCourseTrainerAssignment() { StudentRepository studentRepository = new StudentRepository(); CourseRepository courseRepository = new CourseRepository(); TrainerRepository trainerRepository = new TrainerRepository(); AssignmentRepository assignmentRepository = new AssignmentRepository(); Students = studentRepository.GetAll(); Courses = courseRepository.GetAll(); Trainers = trainerRepository.GetAll(); Assignments = assignmentRepository.GetAll(); }
// GET: Trainers public ActionResult TrainerTable(string sortOrder, string searchfirstname, string searchlastname, string searchsubject, int?page) { ViewBag.CurrentFirstName = searchfirstname; ViewBag.CurrentLastName = searchlastname; ViewBag.CurrentSubject = searchsubject; ViewBag.CurrentSortOrder = sortOrder; ViewBag.FirstNameSortParam = String.IsNullOrEmpty(sortOrder) ? "FirstNameDesc" : ""; ViewBag.LastNameSortParam = sortOrder == "LastNameAsc" ? "LastNameDesc" : "LastNameAsc"; ViewBag.SubjectSortParam = sortOrder == "SubjectAsc" ? "SubjectDesc" : "SubjectAsc"; ViewBag.FNView = "badge badge-primary"; ViewBag.LNView = "badge badge-primary"; TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); //======================FILTERS=============================== //Filtering FirstName if (!string.IsNullOrWhiteSpace(searchfirstname)) { trainers = trainers.Where(x => x.FirstName.ToUpper().Contains(searchfirstname.ToUpper())); } //Filtering LastName if (!string.IsNullOrWhiteSpace(searchlastname)) { trainers = trainers.Where(x => x.LastName.ToUpper().Contains(searchlastname.ToUpper())); } switch (sortOrder) { case "FirstNameDesc": trainers = trainers.OrderByDescending(x => x.FirstName); ViewBag.FNView = "badge badge-danger"; break; case "LastNameAsc": trainers = trainers.OrderBy(x => x.LastName); ViewBag.LNView = "badge badge-success"; break; case "LastNameDesc": trainers = trainers.OrderByDescending(x => x.LastName); ViewBag.LNView = "badge badge-danger"; break; case "SubjectAsc": trainers = trainers.OrderBy(x => x.Subject); ViewBag.LNView = "badge badge-success"; break; case "SubjectDesc": trainers = trainers.OrderByDescending(x => x.Subject); ViewBag.LNView = "badge badge-danger"; break; default: trainers = trainers.OrderBy(x => x.FirstName); ViewBag.FNView = "badge badge-success"; break; } int pageSize = 10; int pageNumber = page ?? 1; //nullable coehelesing operator return(View(trainers.ToPagedList(pageNumber, pageSize))); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, int id) { var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExperience = updatedTrainerCommand.YearsOfExperience, Specialty = updatedTrainerCommand.Specialty, }; var trainer = repo.Update(updatedTrainer, id); return(Ok(trainer)); }
public ActionResult <Trainer> GetBySpecialty(string specialty) { try { var repo = new TrainerRepository(); return(repo.GetSpecialty(specialty)); } catch (Exception e) { // do some stuff to handle the error return(StatusCode(500, e)); } }
public IActionResult CreateTrainer(AddTrainerCommand newTrainerCommand) { var newTrainer = new Trainer() { Name = newTrainerCommand.Name, YearsOfExperience = newTrainerCommand.YearsOfExperience, Speciality = newTrainerCommand.Speciality }; var repo = new TrainerRepository(); var trainerThatGotCreated = repo.Add(newTrainer); return(Created($"api/trainers/{trainerThatGotCreated.Name}", trainerThatGotCreated)); }
protected void GridviewSiniflar_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Classroom k = (Classroom)e.Row.DataItem; if (k.IsActive == true) { (e.Row.FindControl("LinkbuttonAktif") as LinkButton).ToolTip = "Pasif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).Text = "Pasif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).CssClass = "btn btn-danger btn-mini"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Kullanıcı Pasif Edilecek');"; } else { (e.Row.FindControl("LinkbuttonAktif") as LinkButton).ToolTip = "Aktif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).Text = "Aktif Et"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).CssClass = "btn btn-success btn-mini"; (e.Row.FindControl("LinkbuttonAktif") as LinkButton).OnClientClick = "return confirm('Kullanıcı Aktif Edilecek');"; } int id; Label lblgelenid = (Label)e.Row.FindControl("lblID"); Label lblsecid = (Label)e.Row.FindControl("Label1"); Label lbltrgelenid = (Label)e.Row.FindControl("lbltr"); DropDownList ddl1 = (DropDownList)e.Row.FindControl("dropdownBolum"); DropDownList ddl2 = (DropDownList)e.Row.FindControl("dropdownEgitmen"); Label lbldurum = (Label)e.Row.FindControl("lbldurum"); SectionsRepository bolum = new SectionsRepository(); TrainerRepository egitmen = new TrainerRepository(); int sectionid = Convert.ToInt32(lblsecid.Text); Section sec = new Section(); sec = bolum.TekGetir(sectionid); ddl1.DataSource = bolum.HepsiniGetir(); ddl1.DataTextField = "Name"; ddl1.DataValueField = "Id"; ddl1.SelectedValue = sec.Id.ToString(); ddl1.DataBind(); int traineridd = Convert.ToInt32(lbltrgelenid.Text); Trainer tid = new Trainer(); tid = egitmen.TekGetir(traineridd); ddl2.SelectedValue = tid.Id.ToString(); ddl2.DataSource = egitmen.HepsiniGetir(); ddl2.DataTextField = "FullName"; ddl2.DataValueField = "Id"; ddl2.DataBind(); } }
public IActionResult CreateTrainer(AddTrainerCommand newTrainerCommand) { var newTrainer = new Trainer() { //Id = Guid.NewGuid(), Name = newTrainerCommand.Name, YearsOfExperience = newTrainerCommand.YearsOfExperience, Specialty = newTrainerCommand.Specialty, }; var repo = new TrainerRepository(); var craetedTrainer = repo.Add(newTrainer); return(Created(uri: $"api/trainers/{craetedTrainer.Name}", craetedTrainer)); }
// GET: Statistics public ActionResult ShowAllStatistics() { StatisticsViewModel vm = new StatisticsViewModel(); CourseRepository courseRepository = new CourseRepository(); var courses = courseRepository.GetAll(); StudentRepository studentRepository = new StudentRepository(); var students = studentRepository.GetAll(); TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); AssignmentRepository assignmentRepository = new AssignmentRepository(); var assignments = assignmentRepository.GetAll(); vm.NoOfCourses = courses.Count(); vm.NoOfStudents = students.Count(); vm.NoOfTrainers = trainers.Count(); vm.NoOfAssignments = assignments.Count(); vm.Courses = courses; vm.Trainers = trainers; vm.Students = students; vm.Assignments = assignments; //------------------------------------ Μεση βαθμολογία ανά Course (Στην κονσολα τρέχει...Στο browser δεν περνάει σωστά το vm ) List <double> avgGradPerCourse = new List <double>(); double[] avg = new double[6]; foreach (var co in courses) { Console.WriteLine(co.Title); double sum = 0; int count = 0; foreach (var item in co.StudentAssignments) { Console.WriteLine("\t\t" + item.Assignment.Title); Console.WriteLine("\t\t\t" + item.Grade); sum = sum + item.Grade; count += 1; } avgGradPerCourse.Add((sum / count)); } vm.AvgGradePerCourse = avgGradPerCourse; return(View(vm)); }
public ActionResult Details(int?id) { TrainerRepository trainerRepository = new TrainerRepository(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var trainer = trainerRepository.GetById(id); if (trainer == null) { return(HttpNotFound()); } return(View(trainer)); }
public IActionResult CreateTrainer(AddTrainerCommand newTrainerCommand) { var newTrainer = new Trainer { Id = Guid.NewGuid(), Name = newTrainerCommand.Name, YearsOfExp = newTrainerCommand.YearsOfExp, Specialty = newTrainerCommand.Specialty, }; var repo = new TrainerRepository(); var trainerThatGotCreated = repo.Add(newTrainer); return(Created($"api/trainers/{trainerThatGotCreated.Name}", trainerThatGotCreated)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, Guid id) { //mapping/transforming var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExp = updatedTrainerCommand.YearsOfExp, Specialty = updatedTrainerCommand.Specialty, }; var trainerThatGotUpdated = repo.Update(updatedTrainer, id); return(Ok(trainerThatGotUpdated)); }
protected void dtVeri_ItemDataBound(object sender, RepeaterItemEventArgs e) { int ID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "TrainerID").ToString()); int ID2 = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "Subject").ToString()); string url = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FileUrl").ToString()); SubjectRepository konuislem = new SubjectRepository(); Subject konu = konuislem.TekGetir(ID2); Label lblB = (Label)e.Item.FindControl("lblSubject"); lblB.Text = konu.Name; TrainerRepository gelentrainer = new TrainerRepository(); Trainer gelen = new Trainer(); gelen = gelentrainer.TekGetir(ID); Label lblA = (Label)e.Item.FindControl("lblTrainer"); lblA.Text = gelen.FullName; }
// GET: Courses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Course course = courseRepository.GetById(id); if (course == null) { return(HttpNotFound()); } TrainerRepository trainerRepository = new TrainerRepository(); ViewBag.SelectedTrainersId = trainerRepository.GetAll().Select(x => new SelectListItem() { Value = x.TrainerId.ToString(), Text = x.LastName, Selected = course.Trainers.Any(y => y.TrainerId == x.TrainerId) }); StudentRepository studentRepository = new StudentRepository(); ViewBag.SelectedStudentsId = studentRepository.GetAll().Select(x => new SelectListItem() { Value = x.StudentId.ToString(), Text = x.LastName, Selected = course.Students.Any(y => y.StudentId == x.StudentId) }); AssignemntRepository assignemntRepository = new AssignemntRepository(); ViewBag.SelectedAssignmentsId = assignemntRepository.GetAll().Select(x => new SelectListItem() { Value = x.AssignmentId.ToString(), Text = x.Title, Selected = course.Assignments.Any(y => y.AssignmentId == x.AssignmentId) }); return(View(course)); }
public IActionResult UpdateTrainer(UpdateTrainerCommand updatedTrainerCommand, int id) { var repo = new TrainerRepository(); var updatedTrainer = new Trainer { Name = updatedTrainerCommand.Name, YearsOfExperience = updatedTrainerCommand.YearsOfExperience, Specialty = updatedTrainerCommand.Specialty }; var trainerThatGotUpdated = repo.Update(updatedTrainer, id); if (trainerThatGotUpdated == null) { return(NotFound("Could not update trainer.")); } return(Ok(trainerThatGotUpdated)); }
// GET: Trainer public ActionResult TrainerTable(string sortOrder, string searchlastname, string searchfirstname, int?page) { ViewBag.CurrentFirstName = searchfirstname; ViewBag.CurrentLastName = searchlastname; ViewBag.FirstNameShort = String.IsNullOrEmpty(sortOrder) ? "FirstNameDesc" : ""; ViewBag.LastNameSort = sortOrder == "LastNameAsc" ? "LastNameDesc" : "LastNameAsc"; TrainerRepository trainerRepository = new TrainerRepository(); var trainers = trainerRepository.GetAll(); // FILTERING if (!string.IsNullOrWhiteSpace(searchlastname)) { trainers = trainers.Where(x => x.LastName.ToUpper().Contains(searchlastname.ToUpper())); } // SORTING switch (sortOrder) { case "FirstNameDesc": trainers = trainers.OrderByDescending(x => x.FirstName); break; case "LastNameAsc": trainers = trainers.OrderBy(x => x.LastName); break; case "LastNameDesc": trainers = trainers.OrderByDescending(x => x.LastName); break; default: trainers = trainers.OrderBy(x => x.FirstName); break; } // PAGINATION int pageSize = 4; int pageNuber = page ?? 1; return(View(trainers.ToPagedList(pageNuber, pageSize))); }
public static void InsertTrainer(Trainer t) { TrainerRepository trainerRepository = new TrainerRepository(); trainerRepository.Insert(t); }
public ActionResult <IEnumerable <Trainer> > GetAllTrainers() { var repo = new TrainerRepository(); return(repo.GetAll()); }
public TrainersController(TrainerRepository repo) { _repo = repo; }
public static void UpdateTrainer(Trainer t) { TrainerRepository trainerRepository = new TrainerRepository(); trainerRepository.Update(t); }
public static void DeleteTrainer(Trainer t) { TrainerRepository trainerRepository = new TrainerRepository(); trainerRepository.Delete(t); }