protected static void Copy(DataAccess.Course obj, Course newObj)
 {
     newObj.ID         = obj.ID;
     newObj.SemesterID = obj.SemesterID;
     newObj.TeacherID  = obj.TeacherID;
     newObj.Number     = obj.Number;
     newObj.Name       = obj.Name;
     newObj.Status     = obj.Status;
 }
 private void cboSubjectName_SelectedIndexChanged(object sender, EventArgs e)
 {
     //根据选择不同的课程名称显示相应的数据
     DataAccess.Course objCourse = DataAccess.Course.CreateInstance(_className, this.cboSubjectName.SelectedItem.ToString());
     BusinessRuler.Teacher.FillCboByAllTeacherName(this.cboTeacher, objCourse.Teacher);
     this.dtpStartDate.Value  = objCourse.BeginDate;
     this.dtpFinishDate.Value = objCourse.FinishDate;
     this.txtRemark.Text      = objCourse.Remark;
 }
        public static Course FromDataAccessObject(DataAccess.Course obj)
        {
            if (obj == null)
            {
                return(null);
            }

            Course newObj = new Course();

            ServiceObjects.Course.Copy(obj, newObj);

            return(newObj);
        }
 //修改课程
 public void Update(string subjectName, string teacher, DateTime beginDate, DateTime finishDate, string remark)
 {
     DataAccess.Course objCourse = new DataAccess.Course(_className, subjectName);
     objCourse.Teacher    = teacher;
     objCourse.BeginDate  = beginDate;
     objCourse.FinishDate = finishDate;
     objCourse.Remark     = remark;
     if (objCourse.Update() > 0)
     {
         UpdateDataGrid();
         MessageBox.Show("修改课程成功!", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("更新操作失败!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #5
0
        public static Course FromDataAccessObject(DataAccess.Course obj)
        {
            if (obj == null)
            {
                return(null);
            }

            Course newObj = new Course();

            ServiceObjects.Course.Copy(obj, newObj);

            newObj.Links.Add(new Link("Semester", LinkType.Semester, RESTUrlUtil.Service.RESTSvc.GetSemesterByID(newObj.SemesterID)));
            newObj.Links.Add(new Link("Teacher", LinkType.Teacher, RESTUrlUtil.Service.RESTSvc.GetTeacherByID(newObj.TeacherID)));
            newObj.Links.Add(new Link("Enrollments", LinkType.Enrollments, RESTUrlUtil.Service.RESTSvc.GetEnrollmentsByCourseID(newObj.ID, 1)));

            return(newObj);
        }
        //删除课程
        public void Delete()
        {
            string subjectName = this._dgvCourse.CurrentRow.Cells["SubjectName"].Value.ToString();

            if (DialogResult.Yes == MessageBox.Show("真的要删除课程' " + subjectName + " '吗?\n删除课程,将同时删除与该课程相关的所有成绩信息,要继续吗?", "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                DataAccess.Course objCourse = new DataAccess.Course(_className, subjectName);
                if (objCourse.Delete() > 0)
                {
                    UpdateDataGrid();
                    MessageBox.Show("成功删除课程" + subjectName + " '!", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("删除操作失败 " + subjectName + " '!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #7
0
        //修改课程
        public void Update(string studentName, string subjectName, double scoreCount)
        {
            int studentNo = DataAccess.Student.GetStudentNo(_className, studentName);

            DataAccess.Course objCourse = new DataAccess.Course(_className, subjectName);
            int courseID = objCourse.GetCourseID();

            DataAccess.Score objScore = new DataAccess.Score(studentNo, courseID);
            objScore.ScoreCount = scoreCount;
            if (objScore.Update() > 0)
            {
                UpdateDataGrid();
                MessageBox.Show("修改成绩成功!", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("更新成绩失败!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #8
0
        //删除课程
        public void Delete()
        {
            int    studentNo   = Int32.Parse(this._dgvScore.CurrentRow.Cells["StudentNo"].Value.ToString());
            string subjectName = this._dgvScore.CurrentRow.Cells["SubjectName"].Value.ToString();

            DataAccess.Course objCourse = new DataAccess.Course(_className, subjectName);
            int          courseID       = objCourse.GetCourseID();
            DialogResult result         = MessageBox.Show("真的要删除吗?", "删除确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                DataAccess.Score objScore = new DataAccess.Score(studentNo, courseID);
                if (objScore.Delete() > 0)
                {
                    UpdateDataGrid();
                    MessageBox.Show("成功删除成绩!", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("删除操作失败!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #9
0
        //添加课程
        public void Add(string studentName, string subjectName, double scoreCount)
        {
            int studentNo = DataAccess.Student.GetStudentNo(_className, studentName);

            DataAccess.Course objCourse = new DataAccess.Course(_className, subjectName);
            int courseID = objCourse.GetCourseID();

            if (DataAccess.Score.GetReader(studentNo, courseID).HasRows)
            {
                MessageBox.Show("该生 " + subjectName + " 课成绩已存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (DataAccess.Score.Add(studentNo, courseID, scoreCount) > 0)
                {
                    UpdateDataGrid();
                    MessageBox.Show("成功添加成绩!", "操作成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加成绩失败!", "操作失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }