Пример #1
0
        public int DeleteCourse(string courseCode)
        {
            int i = 0;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(CourseStringsInner.DeleteCourse(courseCode));
            }

            return(i);
        }
Пример #2
0
        public CourseModel UpdateCourse(CourseModel courseModel)
        {
            int i = -1;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(CourseStringsInner.UpdateCourse(courseModel));
            }

            return(GetOneCourseByCode(courseModel.courseCode));
        }
Пример #3
0
        public List <CourseModel> GetAllCourses()
        {
            DataTable dt = new DataTable();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(CourseStringsInner.GetAllCourses());
            }

            List <CourseModel> arrCourse = new List <CourseModel>();

            foreach (DataRow ms in dt.Rows)
            {
                arrCourse.Add(CourseModel.ToObject(ms));
            }

            return(arrCourse);
        }
Пример #4
0
        public CourseModel GetOneCourseByCode(string courseCode)
        {
            DataTable dt = new DataTable();

            if (courseCode.Equals(string.Empty) || courseCode.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            CourseModel courseModel = new CourseModel();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(CourseStringsInner.GetOneCourseByCode(courseCode));
            }

            foreach (DataRow ms in dt.Rows)
            {
                courseModel = CourseModel.ToObject(ms);
            }

            return(courseModel);
        }