Exemple #1
0
 public static bool chooseCourse(string studentID, string courseID, out string error)
 {
     error = "";
     if (students.Retrieve(studentID) == null)
     {
         error = "该学生不存在";
         return(false);
     }
     else
     {
         if (termCourses.RetrieveTermCourse(courseID) == null)
         {
             error = "不存在该课程";
             return(false);
         }
         else
         {
             if (termCourses.RetrieveTermCourse(courseID).JustifyStudent(studentID))
             {
                 error = "该课程已选";
                 return(false);
             }
             else
             {
                 Model.TermCourse termcourse = termCourses.RetrieveTermCourse(courseID);
                 termcourse.AddStudent(studentID);
                 ((Model.Student)students.Retrieve(studentID)).AddCourse(new Model.ChoosedCourses(courseID));
                 error = "选课成功";
                 return(true);
             }
         }
     }
 }
Exemple #2
0
 public static bool DeleteCourse(string courseid, out string error)
 {
     error = "";
     if (courses.RetrieveCourse(courseid) == null)
     {
         error = "没有该课程";
         return(false);
     }
     else
     {
         Model.TermCourse[] course = termCourses.RetrieveAll();
         for (int i = 0; i < course.Length; i++)
         {
             Model.TermCourse tc = course[i];
             if (tc.CourseID == courseid)
             {
                 error = "该课程无法删除";
                 return(false);
             }
         }
         courses.RemoveCourse(courseid);
         error = "删除课程记录成功";
         return(true);
     }
 }
Exemple #3
0
        private static void QueryTermCourse()
        {
            string error;

            Console.WriteLine();
            Console.WriteLine("请选择操作(1--查询学期课程  2--查询所有学期课程");
            char c = char.Parse(Console.ReadLine());

            if (c == '1')
            {
                Console.Write("请输入该学期课程的ID:");
                string           id         = Console.ReadLine();
                Model.TermCourse termCourse = BLL.AdminBLL.RetrieveTermCourse(id, out error);
                Console.WriteLine("学期课程信息:");
                Console.WriteLine("学期课程ID\t  课程名\t  任课教师");
                Console.WriteLine("-------------------------");
                Console.WriteLine("{0}\t  {1}\t  {2}", termCourse.ID, (BLL.AdminBLL.RetrieveCourse(termCourse.CourseID, out error)).Name, BLL.AdminBLL.RetrieveTeacher(termCourse.TeacherID, out error).Name);
            }
            else if (c == '2')
            {
                Model.TermCourse[] termCourses = BLL.AdminBLL.RetrieveAllTermCourse();
                Console.WriteLine("课程信息");
                Console.WriteLine("学期课程ID\t  课程名\t  任课教师");
                Console.WriteLine("---------------");
                for (int i = 0; i < termCourses.Length; i++)
                {
                    Console.WriteLine("{0}\t  {1}\t  {2}", termCourses[i].ID, (BLL.AdminBLL.RetrieveCourse(termCourses[i].CourseID, out error)).Name, (BLL.AdminBLL.RetrieveTeacher(termCourses[i].TeacherID, out error)).Name);
                }
            }
            else
            {
                Console.WriteLine("无效的操作");
            }
        }
Exemple #4
0
 public static void MarkingAStudent(string termcourseid, string studentid, double grade)
 {
     if (students.Retrieve(studentid) == null)
     {
         return;
     }
     Model.TermCourse termcourse = termCourses.RetrieveTermCourse(termcourseid);
     ((Model.Student)students.Retrieve(studentid)).BeMarked(termcourseid, grade);
 }
Exemple #5
0
 public static void Marking(string termcourseid, Model.HasStudents[] stu)
 {
     Model.TermCourse termcourse = termCourses.RetrieveTermCourse(termcourseid);
     string[]         studentID  = termcourse.GetAllStudent();
     for (int i = 0; i < studentID.Length; i++)
     {
         ((Model.Student)students.Retrieve(studentID[i])).BeMarked(termcourseid, stu[i].Grade);
     }
 }
Exemple #6
0
 /// <summary>
 /// 增加学期新课程
 /// </summary>
 /// <param name="newTermCourse"></param>
 /// <returns></returns>
 public bool AddNewTermCourse(Model.TermCourse newTermCourse)
 {
     for (int i = 0; i < termCourses.Count; i++)
     {
         if (newTermCourse.ID == ((Model.TermCourse)termCourses[i]).ID)
         {
             return(false);
         }
     }
     termCourses.Add(newTermCourse);
     return(true);
 }
Exemple #7
0
        private static void DeleteTermCourse()
        {
            Console.WriteLine();
            Console.WriteLine("删除学期课程");
            Console.Write("请输入要删除的学期课程ID: ");
            string id = Console.ReadLine();
            string error;

            Model.TermCourse termCourse = BLL.AdminBLL.RetrieveTermCourse(id, out error);
            if (termCourse == null)
            {
                Console.WriteLine("错误:" + error);
            }
            else
            {
                Console.WriteLine("学期课程信息: {0}", termCourse.ID);
                Console.Write("确认要删除该学期课程吗?(Y/N)");
                char c = char.Parse(Console.ReadLine());
                if (c == 'y' || c == 'Y')
                {
                    bool result = BLL.AdminBLL.DeleteTermCourse(id, out error);
                    if (result)
                    {
                        Console.WriteLine("删除成功");
                    }
                    else
                    {
                        Console.WriteLine("错误:" + error);
                    }
                }
                else if (c == 'n' || c == 'N')
                {
                    Console.WriteLine("操作被取消!");
                }
                else
                {
                    Console.WriteLine("无效的操作");
                }
            }
            Console.WriteLine();
        }
Exemple #8
0
 public static bool DeleteStudent(string studentid, out string error)
 {
     error = "";
     Model.Person student = students.Retrieve(studentid);
     if (student == null)
     {
         error = "没有该学生";
         return(false);
     }
     else
     {
         Model.TermCourse[] termcourse = termCourses.BeStudiedByCourses(studentid);
         for (int i = 0; i < termcourse.Length; i++)
         {
             Model.TermCourse course = termcourse[i];
             course.RemoveStudent(studentid);
         }
         students.Remove(studentid);
         error = "删除学生记录成功";
         return(true);
     }
 }
Exemple #9
0
        private static void Mark()
        {
            string error = "";

            Console.Write("请输入要登记成绩的课程ID:");
            string courseid = Console.ReadLine();

            Model.TermCourse termcourse = BLL.AdminBLL.RetrieveTermCourse(courseid, out error);
            Console.Write("请选择(1--登记某个学生的成绩  2--等级所有学生的成绩");
            char c = char.Parse(Console.ReadLine());

            if (c == '1')
            {
                Console.Write("请输入该学生的学号:");
                string studentid = Console.ReadLine();
                Console.Write("{0}的成绩:");
                double grade = double.Parse(Console.ReadLine());
                BLL.TeacherBLL.MarkingAStudent(courseid, studentid, grade);
                Console.WriteLine("登记成功");
            }
            else if (c == '2')
            {
                List <Model.HasStudents> hasstudents = new List <Model.HasStudents>();
                for (int i = 0; i < termcourse.GetAllStudent().Length; i++)
                {
                    Console.Write("{0}的分数:", termcourse.GetAllStudent()[i]);
                    double grade = double.Parse(Console.ReadLine());
                    hasstudents.Add(new Model.HasStudents(termcourse.GetAllStudent()[i], grade));
                }
                BLL.TeacherBLL.Marking(courseid, hasstudents.ToArray());
                Console.WriteLine("登记成功");
            }
            else
            {
                Console.WriteLine("无效操作");
            }
        }