public async Task <IActionResult> OnGetAsync(string selected)
        {
            Selected = selected;
            var indices = selected.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();

            if (selected.Length < 2)
            {
                return(NotFound());
            }

            var institutionalId = Context.Users.Single(u => u.Email.Equals(User.Identity.Name)).InstitutionId;

            var assignments = (await Context.GetAssignmentsAsync()).Where(a => a.InstitutionId.Equals(institutionalId)).ToList();

            foreach (var index in indices)
            {
                if (index >= 0 && index < assignments.Count)
                {
                    Assignments.Add(assignments[index]);
                }
            }

            if (assignments.Count < 2)
            {
                return(NotFound());
            }

            Instructors = Assignments.First().Instructors.ToList().Select(a => a.Instructor.Id).ToList();

            Chart = GetChart();

            return(Page());
        }
Example #2
0
        private async void InitializeGameDTO(GameDTO game)
        {
            _targetGame = game;

            await game.Assignments.ForEachAsync(async (assignment) => {
                AssignmentViewModel assignmentViewModel = ViewModelLocator.Resolve <AssignmentViewModel>();
                await assignmentViewModel.InitializeAsync(_targetTeamMember);
                await assignmentViewModel.InitializeAsync(assignment);

                Assignments.Add(assignmentViewModel);
            });

            Duration.Value            = game.DurationInMinutes.ToString();
            IsGameCanceled            = game.IsCanceled;
            TimeTBD                   = game.IsTimeTbd;
            LocationDetails.Value     = game.LocationDetails;
            SelectedLocation.Value    = Locations.FirstOrDefault(lDTO => lDTO.Id == game.Location.Id);
            Arrival.Value             = game.MinutesToArriveEarly.ToString();
            Notes.Value               = game.Notes;
            IsTowardStandings         = game.NotForStandings;
            SelectedOpponent.Value    = Opponents.FirstOrDefault(oDTO => oDTO.Id == game.Opponent.Id);
            Date.Value                = game.StartDate;
            Time.Value                = game.StartDate.TimeOfDay;
            SelectedActionVenue.Value = ActionVenues.FirstOrDefault(aVDI => aVDI.ActionVenue == game.Type);
            UniformDescription.Value  = game.Uniform;
        }
Example #3
0
        public Assignments GetAssignments()
        {
            //  テーブル列名の指定がない場合は、空のAssignmentsを返す
            if (this.Columns == null || this.Columns.Count == 0)
            {
                return(new Assignments());
            }

            // テーブル列名とVALUES句の要素数が異なる場合はエラーとする
            if (this.Columns.Count != this.Values.Count)
            {
                throw new InvalidASTStructureError("テーブル列名とVALUES句の要素数が異なります");
            }

            var ret = new Assignments();

            for (var i = 0; i < this.Columns.Count; ++i)
            {
                var column     = new Column(this.Columns[i].Name);
                var assignment = new Assignment(column, this.Values[i]);
                ret.Add(assignment);
            }

            return(ret);
        }
Example #4
0
 /// <summary>
 /// Adds a assignment to the test.
 /// </summary>
 public void AddAssignment(Assignment assignment)
 {
     if (assignment == null)
     {
         throw new ArgumentNullException(nameof(assignment));
     }
     Assignments.Add(assignment);
 }
Example #5
0
        public void AddAssignments(string title, string desc, DateTime sub_date)
        {
            int current_id = Assignments.Count + 1;
            var assignment = new Assignment(current_id, title, desc, sub_date);

            Assignments.Add(assignment);
            PrivateSchool.OutputAssignments(assignment);
        }
        void RegisterEmployee(EmployeeComponent employee)
        {
            this.Log($"Assignment registering {employee}");

            if (!Assignments.ContainsKey(employee))
            {
                Assignments.Add(employee, null);
            }
        }
Example #7
0
 // This method is populating the ListView with WeightedItem objects
 // that have been entered by the user
 private void PopulateAssignments(WeightedItem item)
 {
     RetrieveAssignments();
     if (item != null)
     {
         Assignments.Add(item);
     }
     AssignmentsList.DataSource = Assignments;
     AssignmentsList.DataBind();
 }
        public void CreateRandomAssignment(List <string> assignmentDescriptions, Random random)
        {
            var assignmentTitle                 = $"Assignment{Assignments.Count + 1}";
            var assignmentDescription           = assignmentDescriptions[random.Next(assignmentDescriptions.Count)];
            var assignmentSubmissionDateAndTime = Randomizer.GenerateDateExcludingWeekends(StartDate, (EndDate - StartDate).Days, random);
            var courseAssignment                = new Assignment(assignmentTitle, assignmentDescription, assignmentSubmissionDateAndTime, this);

            Assignments.Add(courseAssignment);
            CreatePersonalAssignmentsForAllStudentsAppliedToCourse(courseAssignment);
        }
Example #9
0
 public bool Add(IAssignment assignment)
 {
     if (Assignments.Contains(assignment))
     {
         return(false);
     }
     else
     {
         Assignments.Add(assignment);
         return(true);
     }
 }
Example #10
0
        private async void GetAssignmentsForCourseAsync(int courseId, string authToken)
        {
            var   task = AsyncServiceClient.GetAssignmentsForCourse(courseId, authToken);
            await task;
            var   assignments = task.Result;

            Assignments.Clear();
            foreach (var assignment in assignments)
            {
                Assignments.Add(assignment);
            }

            IsLoading = false;
        }
Example #11
0
        public void InputAssignmentPerCourse()
        {
            Console.WriteLine("Enter a Course: ");
            Course.InputCourse();
            Console.WriteLine("How many assignments has this course?");
            int a = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please enter the assignments: ");
            for (int i = 0; i < a; i++)
            {
                Assignment k = new Assignment();
                k.InputAssignment();
                Assignments.Add(k);
            }
        }
Example #12
0
 //will populate the assignment dropdown
 void _client_GetAssignmentsForCourseCompleted(object sender, GetAssignmentsForCourseCompletedEventArgs e)
 {
     IsLoading = false;
     Assignments.Clear();
     try
     {
         foreach (Assignment a in e.Result)
         {
             Assignments.Add(a);
         }
     }
     catch (Exception)
     {
     }
 }
        private void AddAssignment()
        {
            AddAssignment assignment = new AddAssignment();

            assignment.ShowDialog();

            Assignments.Add(new Assignment(
                                assignment.CName,
                                assignment.StartDate,
                                assignment.NumberDaysNeeded,
                                assignment.Location,
                                assignment.NumberModelsNeeded,
                                assignment.Comment));

            Assignments.SaveAssignments();
        }
Example #14
0
        public void AddAssignment(Assignment assignment)
        {
            if (Assignments.Count > 0)
            {
                assignment.route.StartTime = Assignments[Assignments.Count - 1].EndTime;
                assignment.route.Duration  = Math.Abs(assignment.Location - Assignments[Assignments.Count - 1].Location);
            }
            else
            {
                assignment.route.StartTime = 0;
                assignment.route.Duration  = assignment.Location;
            }

            Assignments.Add(assignment);
            assignment.EmployeeSchedule = this;
            RaiseAssignmentsChanged();
        }
Example #15
0
        /*
         * public int AssignFirstFittingVirtualTable(Booking booking)
         * {
         *  int result = -1;
         *
         *  List<VirtualTable> largeEnoughVTs = Restaurant.VirtualTables.Where(vt => vt.Capacity >= booking.Guests).ToList();
         *  int vtIndex = 0;
         *  while (result == -1 && vtIndex < largeEnoughVTs.Count())
         *  {
         *      VirtualTable vt = largeEnoughVTs[vtIndex];
         *      bool canFit = true;
         *      foreach(int tableIndex in vt.TableIds)
         *      {
         *          Table Table = Restaurant.Tables[tableIndex];
         *          if (!Table.CanFitBooking(booking))
         *              canFit = false;
         *      }
         *      if (canFit)
         *          result = vtIndex;
         *
         *      vtIndex += 1;
         *  }
         *
         *  if (result > -1)
         *  {
         *      // assign this vt to booking
         *      Assignments.Add(new BookingAssignment() { BookingId = booking.Id, TableId = vtIndex });
         *  }
         *
         *  return result;
         * }
         */
        public int GetFirstTableWithFreeSlot(Booking booking)
        {
            int tableIndex = 0;
            int foundTable = -1;

            while (tableIndex < Restaurant.NrTables && foundTable == -1)
            {
                int   placesLeftToFill = booking.Guests;
                Table table            = Restaurant.Tables[tableIndex];
                int   groupIndex       = tableIndex;
                List <BookingAssignment> AssignedBookings = Assignments.Where(a => a.TableId == tableIndex).ToList();
                while (placesLeftToFill > 0 && table.CanFitBooking(booking, this, AssignedBookings) && groupIndex < Restaurant.NrTables)
                {
                    placesLeftToFill -= table.Size;
                    groupIndex       += 1;
                    if (groupIndex < Restaurant.NrTables)
                    {
                        table            = Restaurant.Tables[groupIndex];
                        AssignedBookings = Assignments.Where(a => a.TableId == table.Id).ToList();
                    }
                }

                if (placesLeftToFill < 1)
                {
                    // a place hsa been found for the booking
                    foundTable = tableIndex;
                    // grab the tables
                    for (int i = foundTable; i < groupIndex; i++)
                    {
                        //Restaurant.Tables[i].Bookings.Add(booking);
                        Assignments.Add(new BookingAssignment()
                        {
                            BookingId = booking.Id, TableId = i
                        });
                    }
                }

                tableIndex++;
            }
            return(foundTable);
        }
Example #16
0
        private void RetrieveAssignments()
        {
            // Loop through all the items in the ListView, and add them back to
            // our List<WeightedItem> field.
            foreach (ListViewDataItem item in AssignmentsList.Items)
            {
                // Use the item to find the control that has the data we want
                var nameLabel   = item.FindControl("AssignmentTitle") as Label;
                var weightLabel = item.FindControl("Weight") as Label;

                if (nameLabel != null && weightLabel != null)
                {
                    var existing = new WeightedItem
                    {
                        AssignmentName = nameLabel.Text,
                        Weight         = int.Parse(weightLabel.Text)
                    };
                    Assignments.Add(existing);
                }
            }
        }
        public ActionResult Assign(Assignment model)
        {
            if (!Request.IsAuthorized())
            {
                return(Unauthorized());
            }
            if (!Films.Exists(model.FilmId))
            {
                return(NotFound($"Film with {model.FilmId} not found"));
            }
            if (!Films.Exists(model.EmployeeId))
            {
                return(NotFound($"Employee with {model.EmployeeId} not found"));
            }
            if (Assignments.Exists(model))
            {
                return(Conflict("Assignment already exists"));
            }

            Assignments.Add(model);

            return(Ok("Ok"));
        }
Example #18
0
        private async void InitializeEventDTO(EventDTO eventAction)
        {
            _targetEvent = eventAction;

            await eventAction.Assignments.ForEachAsync <AssignmentDTO>(async (assignment) => {
                AssignmentViewModel assignmentViewModel = ViewModelLocator.Resolve <AssignmentViewModel>();
                await assignmentViewModel.InitializeAsync(_targetTeamMember);
                await assignmentViewModel.InitializeAsync(assignment);

                Assignments.Add(assignmentViewModel);
            });

            ShortLabel.Value        = eventAction.ShortLabel;
            RepeatUntil.Value       = eventAction.RepeatsUntil;
            SelectedRepeating.Value = Repeatings.FirstOrDefault(r => r.Value == eventAction.RepeatingType);
            Duration.Value          = eventAction.DurationInMinutes.ToString();
            NameOfEvent.Value       = eventAction.Name;
            TimeTBD = eventAction.IsTimeTbd;
            LocationDetails.Value  = eventAction.LocationDetails;
            SelectedLocation.Value = Locations.FirstOrDefault <LocationDTO>(lDTO => lDTO.Id == eventAction.Location.Id);
            Notes.Value            = eventAction.Notes;
            Date.Value             = eventAction.StartDate;
        }
        public void ContinueAddingAsOrNot()
        {
            string answer = CheckContinueOrNot();

            while (answer.ToUpper() == "C")
            {
                Console.Clear();
                Welcome();
                Assignment a = new Assignment();
                a.InitializeAssignment();
                Assignments.Add(a);
                a.PrintTheAssignmentEntry();
                Console.WriteLine("\n\tPress C to Continue Adding : ");
                Console.WriteLine("\tPress B to go Back to Menu : ");
                Console.Write("\t                           : ");
                answer = StringAnswer();
            }
            if (answer.ToUpper() == "B")
            {
                Console.Clear();
                Welcome();
                InsertMenu();
            }
        }
Example #20
0
 public void AddAssignment(Assignment assignment)
 {
     Assignments.Add(assignment);
 }
        public async Task <FileStreamResult> OnPostDownloadAsync(string selected)
        {
            var indices = selected.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();

            if (selected.Length < 2)
            {
                return(null);
            }

            var institutionalId = Context.Users.Single(u => u.Email.Equals(User.Identity.Name)).InstitutionId;

            var assignments = (await Context.GetAssignmentsAsync()).Where(a => a.InstitutionId.Equals(institutionalId)).ToList();

            foreach (var index in indices)
            {
                if (index >= 0 && index < assignments.Count)
                {
                    Assignments.Add(assignments[index]);
                }
            }

            if (assignments.Count < 2)
            {
                return(null);
            }
            Instructors = Assignments.First().Instructors.ToList().Select(a => a.Instructor.Id).ToList();


            var fileText = $"Assignment,Course,Alias Id,Line,Branch,Conditional,Redundant,# of Valid Feedback\n";

            Assignments.ToList().ForEach(asg =>
            {
                var submissions     = GetSubmissions(Instructors, asg);
                var studentAverages = submissions.GroupBy(
                    x => x.SubmitterId,
                    x => x.Feedback,
                    (key, g) => new
                {
                    Id        = key,
                    Feedbacks = g.ToList()
                }).Select(x =>
                          new
                {
                    x.Id,
                    Averages = new List <double>()
                    {
                        CalculateAverageLineCoveragePercentage(x.Feedbacks),
                        CalculateAverageBranchCoveragePercentage(x.Feedbacks),
                        CalculateAverageConditionalCoveragePercentage(x.Feedbacks),
                        CalculateAverageRedundantCoverage(x.Feedbacks),
                    },
                    Amount = x.Feedbacks.Count,
                })
                                      .ToList();
                studentAverages.ForEach(sa =>
                                        fileText += $"{asg.Name}," +
                                                    $"{asg.Course.CourseName}," +
                                                    $"S{sa.Id}," +
                                                    $"{sa.Averages[0]}," +
                                                    $"{sa.Averages[1]}," +
                                                    $"{sa.Averages[2]}," +
                                                    $"{sa.Averages[3]}," +
                                                    $"{sa.Amount}\n"
                                        );
            });

            var bytes = Encoding.ASCII.GetBytes(fileText);

            return(new FileStreamResult(new MemoryStream(bytes), "text/csv")
            {
                FileDownloadName = "analysis.csv",
            });
        }
        public void AddDefaultAssignment(IStyleValueAssignment exampleAssignment)
        {
            var applied = GetDefaultAssignment(exampleAssignment);

            Assignments.Add(applied);
        }
Example #23
0
        public async Task OnGetAsync()
        {
            var userId = HttpContext.Session.GetInt32(SD.UserSessionId);

            if (userId == null)
            {
                userId = 0;
            }
            User = _context.User.Where(x => x.ID == userId).FirstOrDefault();
            var isInstructor = await _context.User.Where(x => x.ID == userId).Where(x => x.UserType == 'I').AnyAsync();

            courseHelper = new CourseHelper();

            if (isInstructor)
            {
                Course = await _context.Course.Where(x => x.InstructorID == userId).ToListAsync();
            }
            else
            {
                var courseIds = await _context.Registration.Where(x => x.StudentID == userId).Select(x => x.CourseID).ToListAsync();

                Course      = new List <Models.Course>();
                Assignments = new List <Models.Assignment>();
                Submissions = new List <Models.Submission>();


                foreach (int id in courseIds)
                {
                    var createdAssignments = await _context.Assignment.Where(x => x.CourseID == id).Select(x => x.ID).ToListAsync();

                    foreach (int assignmentid in createdAssignments)
                    {
                        Assignments.Add(await _context.Assignment.Where(x => x.ID == assignmentid).FirstOrDefaultAsync());

                        var gradedAssignments = await _context.Submission.Where(x => x.AssignmentId == assignmentid).Select(x => x.ID).ToListAsync();

                        foreach (int graddedId in gradedAssignments)
                        {
                            Submissions.Add(await _context.Submission.Where(x => x.ID == graddedId).FirstOrDefaultAsync());
                        }
                    }

                    Course.Add(await _context.Course.Where(x => x.ID == id).FirstOrDefaultAsync());
                }
            }


            Notifications = new List <Models.Notification>();

            foreach (Models.Assignment assign in Assignments)
            {
                var notifID = await _context.Notification.Where(x => x.sourceID == assign.ID).Select(x => x.ID).ToListAsync();

                foreach (int id in notifID)
                {
                    Notifications.Add(await _context.Notification.Where(x => x.ID == id).FirstOrDefaultAsync());
                }
            }

            foreach (Models.Submission sub in Submissions)
            {
                var notifID = await _context.Notification.Where(x => x.sourceID == sub.ID).Select(x => x.ID).ToListAsync();

                foreach (int id in notifID)
                {
                    Notifications.Add(await _context.Notification.Where(x => x.ID == id).FirstOrDefaultAsync());
                }
            }


            foreach (Models.Course course in Course)
            {
                var assignmentIds = await _context.Assignment.Where(x => x.CourseID == course.ID).Where(x => x.DueDate >= DateTime.Today).Select(x => x.ID).ToListAsync();

                foreach (int id in assignmentIds)
                {
                    Assignments.Add(await _context.Assignment.Where(x => x.ID == id).FirstOrDefaultAsync());
                }
            }
        }
        public Data()
        {
            //creating students
            Student s1 = new Student("Panagiotis", "Grigoriou", new DateTime(1987, 3, 4), 3000);
            Student s2 = new Student("Konstantinos", "Pantelidis", new DateTime(1991, 6, 2), 4000);
            Student s3 = new Student("Spiros", "Aggelatos", new DateTime(1996, 4, 7), 3500);
            Student s4 = new Student("Dimitris", "Pantelopoulos", new DateTime(2000, 5, 2), 6200);
            Student s5 = new Student("Antonis", "Mixelakakis", new DateTime(1989, 10, 3), 5800);

            Students.Add(s1);
            Students.Add(s2);
            Students.Add(s3);
            Students.Add(s4);
            Students.Add(s5);

            //creating courses
            Course c1 = new Course("Javascript", "Web Development", "Practical Subject", new DateTime(2020, 1, 10), new DateTime(2020, 3, 11));
            Course c2 = new Course("C++", "Object-Oriented Programming", "Practical Subject", new DateTime(2020, 1, 18), new DateTime(2020, 4, 2));
            Course c3 = new Course("Pascal", "Procedural Programming", "Theoretical Subject", new DateTime(2020, 2, 15), new DateTime(2020, 5, 20));
            Course c4 = new Course("Visual Basic", "Windows Application Development", "Practical Subject", new DateTime(2020, 3, 20), new DateTime(2020, 6, 1));

            Courses.Add(c1);
            Courses.Add(c2);
            Courses.Add(c3);
            Courses.Add(c4);

            //creating trainers
            Trainer t1 = new Trainer("Giannis", "Aggelopoulos", "Object-Oriented Programming");
            Trainer t2 = new Trainer("Manolis", "Daskalakis", "Procedural Programming");
            Trainer t3 = new Trainer("Giorgos", "Mpatzoglou", "Procedural Programming");
            Trainer t4 = new Trainer("Thanassis", "Giorgakopoulos", "Object-Oriented Programming");

            Trainers.Add(t1);
            Trainers.Add(t2);
            Trainers.Add(t3);
            Trainers.Add(t4);

            //creating assignments
            Assignment a1 = new Assignment("Project Bank", "Banking application for android phones", new DateTime(2020, 4, 24), 40, 200);
            Assignment a2 = new Assignment("Project E-shop", "Shopping website", new DateTime(2020, 6, 11), 20, 100);
            Assignment a3 = new Assignment("Project Library", "Book rental service", new DateTime(2020, 4, 15), 35, 200);
            Assignment a4 = new Assignment("Project Cinema", "Movie distribution to cinemas", new DateTime(2020, 1, 2), 73, 100);
            Assignment a5 = new Assignment("Project Stocks", "Stock change notifications", new DateTime(2020, 3, 27), 110, 200);
            Assignment a6 = new Assignment("Project Architecture", "Blueprint making software", new DateTime(2020, 3, 24), 40, 150);

            Assignments.Add(a1);
            Assignments.Add(a2);
            Assignments.Add(a3);
            Assignments.Add(a4);
            Assignments.Add(a5);
            Assignments.Add(a6);

            //putting students in mini-lists (students per Course)
            List <Student> C1Stu = new List <Student>();
            List <Student> C2Stu = new List <Student>();
            List <Student> C3Stu = new List <Student>();

            C1Stu.Add(s2);
            C1Stu.Add(s3);

            C2Stu.Add(s1);
            C2Stu.Add(s2);
            C2Stu.Add(s3);

            C3Stu.Add(s1);

            //putting mini-lists in big lists (students per Course)
            StudentPerCourse stuPerCour1 = new StudentPerCourse(c1, C1Stu);
            StudentPerCourse stuPerCour2 = new StudentPerCourse(c2, C2Stu);
            StudentPerCourse stuPerCour3 = new StudentPerCourse(c3, C3Stu);

            StudentsPerCourse.Add(stuPerCour1);
            StudentsPerCourse.Add(stuPerCour2);
            StudentsPerCourse.Add(stuPerCour3);

            //putting trainers in mini-lists (trainers per Course)
            List <Trainer> C1Train = new List <Trainer>();
            List <Trainer> C2Train = new List <Trainer>();
            List <Trainer> C3Train = new List <Trainer>();

            C1Train.Add(t1);
            C1Train.Add(t2);

            C2Train.Add(t1);
            C2Train.Add(t3);

            C3Train.Add(t4);
            C3Train.Add(t1);

            //putting mini-lists in big lists (trainers per Course)
            TrainerPerCourse trainPerCour1 = new TrainerPerCourse(c1, C1Train);
            TrainerPerCourse trainPerCour2 = new TrainerPerCourse(c2, C2Train);
            TrainerPerCourse trainPerCour3 = new TrainerPerCourse(c3, C3Train);

            TrainersPerCourse.Add(trainPerCour1);
            TrainersPerCourse.Add(trainPerCour2);
            TrainersPerCourse.Add(trainPerCour3);

            //putting assignments in mini-lists (assignments per Course)
            List <Assignment> C1Assign = new List <Assignment>();
            List <Assignment> C2Assign = new List <Assignment>();
            List <Assignment> C3Assign = new List <Assignment>();

            C1Assign.Add(a1);
            C1Assign.Add(a2);

            C2Assign.Add(a3);

            C3Assign.Add(a5);
            C3Assign.Add(a4);

            //putting mini-lists in big lists (assignments per Course)
            AssignmentPerCourse assignPerCour1 = new AssignmentPerCourse(c1, C1Assign);
            AssignmentPerCourse assignPerCour2 = new AssignmentPerCourse(c2, C2Assign);
            AssignmentPerCourse assignPerCour3 = new AssignmentPerCourse(c3, C2Assign);

            AssignmentsPerCourse.Add(assignPerCour1);
            AssignmentsPerCourse.Add(assignPerCour2);
            AssignmentsPerCourse.Add(assignPerCour3);

            //putting assignments in mini-lists (assignments per Student)
            List <Assignment> S1Assign = new List <Assignment>();
            List <Assignment> S2Assign = new List <Assignment>();
            List <Assignment> S3Assign = new List <Assignment>();

            S1Assign.Add(a1);
            S1Assign.Add(a2);

            S2Assign.Add(a3);
            S2Assign.Add(a4);
            S2Assign.Add(a5);

            S3Assign.Add(a6);

            //putting mini-lists in big lists (assignments per Student)
            AssignmentPerStudent assignPerStu1 = new AssignmentPerStudent(s1, S1Assign);
            AssignmentPerStudent assignPerStu2 = new AssignmentPerStudent(s2, S2Assign);
            AssignmentPerStudent assignPerStu3 = new AssignmentPerStudent(s3, S3Assign);

            AssignmentsPerStudent.Add(assignPerStu1);
            AssignmentsPerStudent.Add(assignPerStu2);
            AssignmentsPerStudent.Add(assignPerStu3);

            //putting courses in mini-lists (courses per Student)
            List <Course> S1Cour = new List <Course>();
            List <Course> S2Cour = new List <Course>();
            List <Course> S3Cour = new List <Course>();

            S1Cour.Add(c2);
            S1Cour.Add(c3);


            S2Cour.Add(c1);
            S2Cour.Add(c2);

            S3Cour.Add(c1);
            S3Cour.Add(c2);

            //putting mini-lists in big lists (courses per Student)
            CoursePerStudent courPerStu1 = new CoursePerStudent(s1, S1Cour);
            CoursePerStudent courPerStu2 = new CoursePerStudent(s2, S2Cour);
            CoursePerStudent courPerStu3 = new CoursePerStudent(s3, S3Cour);


            CoursesPerStudent.Add(courPerStu1);
            CoursesPerStudent.Add(courPerStu2);
            CoursesPerStudent.Add(courPerStu3);

            //-------------------------------------------------------

            //AssignmentCourseStudent ACS1 = new AssignmentCourseStudent(s1, c2, a3);
            //AssignmentCourseStudent ACS2 = new AssignmentCourseStudent(s1, c3, a6);
            //AssignmentCourseStudent ACS3 = new AssignmentCourseStudent(s2, c1, a1);
            //AssignmentCourseStudent ACS4 = new AssignmentCourseStudent(s2, c2, a4);
            //AssignmentCourseStudent ACS5 = new AssignmentCourseStudent(s3, c1, a2);
            //AssignmentCourseStudent ACS6 = new AssignmentCourseStudent(s3, c2, a5);

            //ACSList.Add(ACS1);
            //ACSList.Add(ACS2);
            //ACSList.Add(ACS3);
            //ACSList.Add(ACS4);
            //ACSList.Add(ACS5);
            //ACSList.Add(ACS6);
        }
        // Menu Insert Data

        public void InsertMenu()
        {
            string answer = string.Empty;

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\tMENU\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\t1. Add new Course\n");
            Console.WriteLine("\t2. Add new Trainer\n");
            Console.WriteLine("\t3. Add new Assignment\n");
            Console.WriteLine("\t4. Add new Student\n");
            Console.Write("\t5. ");
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Return to Main Menu\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\t0. ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("LogOut\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\tChoice : ");
            answer = StringAnswer();
            while (!(answer == "1" || answer == "2" || answer == "3" || answer == "4" || answer == "5" || answer == "0"))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\tChoose Between (1,2,3,4,5,0)");
                Console.Beep();
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write("\tChoice : ");
                answer = StringAnswer();
            }
            switch (answer)
            {
            case "1":
                Console.Clear();
                Welcome();
                Course c = new Course();
                c.InitializeCourse();
                Courses.Add(c);
                c.PrintTheCourseEntry();
                ContinueAddingCourseOrNot();
                break;

            case "2":
                Console.Clear();
                Welcome();
                Trainer t = new Trainer();
                t.Initrainer();
                Trainers.Add(t);
                t.PrintTheTrainerEntry();
                ContinueAddingTrainerOrNot();
                break;

            case "3":
                Console.Clear();
                Welcome();
                Assignment a = new Assignment();
                a.InitializeAssignment();
                Assignments.Add(a);
                a.PrintTheAssignmentEntry();
                ContinueAddingAsOrNot();
                break;

            case "4":
                Console.Clear();
                Welcome();
                Student s = new Student();
                s.InitStudent();
                Students.Add(s);
                s.PrintTheStudentEntry();
                ContinueAddingStudOrNot();
                break;

            case "5":
                GobackStartmenu();
                break;

            case "0":
                LogOut();
                break;
            }
        }
        public void MakeAssignment()
        {
            Assignment newAssign = new Assignment();

            Assignments.Add(newAssign);

            Console.WriteLine("Enter assignment's title: ");
            newAssign.Title = Console.ReadLine();

            if (newAssign.Title.Length < 1)
            {
                Console.WriteLine("Title was left empty");
                Console.WriteLine("Will put synthetic data");
                newAssign.Title = "Project Chat";
            }

            Console.WriteLine("Enter assignment's description: ");
            newAssign.Description = Console.ReadLine();

            if (newAssign.Description.Length < 1)
            {
                Console.WriteLine("Description was left empty");
                Console.WriteLine("Will put synthetic data");
                newAssign.Description = "Online messaging system";
            }

            try
            {
                Console.WriteLine("Enter assignment's sub date time: ");
                newAssign.SubDateTime = Convert.ToDateTime(Console.ReadLine());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Will put synthetic data");
                newAssign.SubDateTime = new DateTime(2020, 10, 4);
            }

            try
            {
                Console.WriteLine("Enter assignment's oral mark: ");
                newAssign.OralMark = Convert.ToDouble(Console.ReadLine());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Will put synthetic data");
                newAssign.OralMark = 10;
            }

            try
            {
                Console.WriteLine("Enter assignment's total mark: ");
                newAssign.TotalMark = Convert.ToDouble(Console.ReadLine());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Will put synthetic data");
                newAssign.TotalMark = 100;
            }
        }
Example #27
0
 /// <summary>Adds a variable to set to the clause. </summary>
 /// <param name="expression">expression providing the new variable value</param>
 /// <returns>clause</returns>
 public OnUpdateClause AddAssignment(Expression expression)
 {
     Assignments.Add(new Assignment(expression));
     return(this);
 }
Example #28
0
        public override Assignments GetAssignments(int index)
        {
            //  テーブル列名の指定がない場合は、空のAssignmentsを返す
            if (this.Columns == null || this.Columns.Count == 0)
            {
                return(new Assignments());
            }

            // Compound Queryの場合は空のAssignmentsを返す
            SingleQueryClause singleQuery = null;

            if (this.Query.Type == QueryType.Compound)
            {
                return(new Assignments());
            }
            else if (this.Query.Type == QueryType.Bracketed)
            {
                IQueryClause query = ((BracketedQuery)this.Query).Operand;
                // 括弧を剥ぐ
                while (query.Type == QueryType.Bracketed)
                {
                    query = ((BracketedQueryClause)query).Operand;
                }
                if (query.Type != QueryType.Single)
                {
                    return(new Assignments());
                }
                singleQuery = (SingleQueryClause)query;
            }
            else
            {
                singleQuery = (SingleQuery)this.Query;
            }

            // SELECT *の場合は空のAssignmentsを返す
            if (singleQuery.HasWildcard)
            {
                return(new Assignments());
            }

            // テーブル列名とSELECT句の要素数が異なる場合はエラーとする
            if (this.Columns.Count != singleQuery.Results.Count)
            {
                throw new InvalidASTStructureError("テーブル列名とSELECT句の要素数が異なります");
            }

            var ret = new Assignments();

            for (var i = 0; i < Columns.Count; ++i)
            {
                var column = new Column(this.Columns[i].Name);
                var result = singleQuery.Results[i];
                // SELECT句にTable WildCardが含まれる場合は、空のAssignmentsを返す
                if (result.IsTableWildcard)
                {
                    return(new Assignments());
                }
                var value      = ((ResultExpr)result).Value;
                var assignment = new Assignment(column, value);
                ret.Add(assignment);
            }

            return(ret);
        }