示例#1
0
        public int AssignCourseToStudent(CourseAssignStudent courseAssignStudent)
        {
            Query = "INSERT INTO CourseAssignStudent(StudentId,DepartmentName,DepartmentId,CourseId,Date) VALUES(@StudentId,@DepartmentName,@DepartmentId,@CourseId,@Date)";
            Command.CommandText = Query;
            Command.Connection  = Connection;
            Command.Parameters.Clear();
            Command.Parameters.Add("StudentId", SqlDbType.Int);
            Command.Parameters["StudentId"].Value = courseAssignStudent.StudentId;
            Command.Parameters.Add("DepartmentName", SqlDbType.VarChar);
            Command.Parameters["DepartmentName"].Value = courseAssignStudent.DepartmentName;
            Command.Parameters.Add("DepartmentId", SqlDbType.Int);
            Command.Parameters["DepartmentId"].Value = courseAssignStudent.DepartmentId;
            Command.Parameters.Add("CourseId", SqlDbType.Int);
            Command.Parameters["CourseId"].Value = courseAssignStudent.CourseId;
            Command.Parameters.Add("Date", SqlDbType.Date);
            Command.Parameters["Date"].Value = courseAssignStudent.Date;
            Connection.Open();
            int rowsAffected = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowsAffected);
        }
示例#2
0
 public void AssignCourseToStudent(CourseAssignStudent courseAssignStudent)
 {
     studentManager.AssignCourseToStudent(courseAssignStudent);
 }
示例#3
0
 public bool AssignCourseToStudent(CourseAssignStudent courseAssignStudent)
 {
     return(studentGateway.AssignCourseToStudent(courseAssignStudent) > 0);
 }