Пример #1
0
        public CourseAssignToTeacherModel GetSingleCourseAssignToTeacherModel(int courseAssignId)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT * FROM courseAssignToTeacher_tbl WHERE id='" + courseAssignId + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            // command.Parameters.AddWithValue("@deptId", DeptId);
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            CourseAssignToTeacherModel aCourseAssignToTeacherModel = new CourseAssignToTeacherModel();

            while (reader.Read())
            {
                aCourseAssignToTeacherModel.CourseAssignToTeacherId = Convert.ToInt32(reader["id"].ToString());
                aCourseAssignToTeacherModel.DepartmentId            = int.Parse(reader["departmentId"].ToString());
                aCourseAssignToTeacherModel.CourseId  = Convert.ToInt32(reader["courseId"].ToString());
                aCourseAssignToTeacherModel.TeacherId = int.Parse(reader["teacherId"].ToString());
            }
            aCourseAssignToTeacherModel.Department = aCourseAssignManager.GetSingleDepartmentByDeptId(aCourseAssignToTeacherModel.DepartmentId);
            aCourseAssignToTeacherModel.Teacher    = aCourseAssignManager.GetSingleTeacherByTeacherId(aCourseAssignToTeacherModel.TeacherId);
            aCourseAssignToTeacherModel.Course     = aCourseAssignManager.GetSingleCourseByCourseId(aCourseAssignToTeacherModel.CourseId);


            connection.Close();
            return(aCourseAssignToTeacherModel);
        }