コード例 #1
0
 public bool NewStudent(Student _student)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@User_Id", _student.User_Id),
         new SqlParameter("@StudentNumber", _student.StudentNumber),
         new SqlParameter("@Name",_student.Name),
         new SqlParameter("@Surname", _student.Surname),
         new SqlParameter("@QualificationCode", _student.QualificationCode)
     };
     return DataAccess.ExecuteNonQuery("sp_InsertStudent", CommandType.StoredProcedure,
         Params);
 }
コード例 #2
0
        public Student GetStudent(string Id)
        {
            Student _student = null;

            SqlParameter[] Params = { new SqlParameter("@User_Id", Id) };
            using (DataTable table = DataAccess.ExecuteParamatizedSelectCommand("sp_GetStudents",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    _student = new Student();
                    _student.StudentNumber = row["StudentNumber"].ToString();
                    _student.Name = row["Name"].ToString();
                    _student.Surname = row["Surname"].ToString();
                }
            }
            return _student;
        }
コード例 #3
0
 public List<Student> GetStudentsForQualification(int QualificationCode)
 {
     List<Student> _studentList = null;
     SqlParameter[] Params = { new SqlParameter("@QualificationCode", QualificationCode) };
     using (DataTable table = DataAccess.ExecuteParamatizedSelectCommand("", CommandType.StoredProcedure, Params))
     {
         if (table.Rows.Count > 0)
         {
             _studentList = new List<Student>();
             foreach (DataRow row in table.Rows)
             {
                 Student _student = new Student();
                 _student.StudentNumber = row["StudentNumber"].ToString();
                 _student.Name = row["Name"].ToString();
                 _student.Surname = row["Surname"].ToString();
                 _student.User_Id = row["Id"].ToString();
                 _studentList.Add(_student);
             }
         }
     }
     return _studentList;
 }
コード例 #4
0
        public List<Student> GetAllStudents()
        {
            List<Student> _studentList = null;

            using (DataTable table = DataAccess.ExecuteSelectCommand("",
                CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    _studentList = new List<Student>();
                    foreach (DataRow row in table.Rows)
                    {
                        Student _student = new Student();
                        _student.User_Id = row["Id"].ToString();
                        _student.Name = row["Name"].ToString();
                        _student.Surname = row["Surname"].ToString();
                        _student.StudentNumber = row["StudentNumber"].ToString();
                        _student.QualificationCode = Convert.ToInt32(row["QualificationCode"]);
                        _studentList.Add(_student);
                    }
                }
            }
            return _studentList;
        }
コード例 #5
0
        public ActionResult ViewAttendees()
        {
            #region Declaring the variables

            BusinessLogicHandler _gateWay = new BusinessLogicHandler();
            List<Student> _studList = new List<Student>();
            Student _student = new Student();
            Lecturer _lecturer = new Lecturer();
            Lecture _lecture = new Lecture();
            CloserViewModel _closer = new CloserViewModel();

            #endregion

            Bridge _bridge = (Bridge)Session["Data"];
            //_lecture = _gateWay.GetLecture(_bridge.Lecture_Id);

            #region Getting The students

            foreach (var item in _bridge.User_Id)
            {
                string[] exString = item.Split('.');
                _student = _gateWay.GetStudent(exString[0]);
                _student.User_Id = item.ToString();
                _studList.Add(_student);
            }
            _closer.Students = _studList;

            #endregion

            #region Getting the lecture details

            _lecture = _gateWay.GetLecture(_bridge.Lecture_Id);
            _closer.Lecture = _lecture;

            #endregion

            #region Setting the date

            _closer.Date = "";
            for (int x = 0; x < 4; x++)
            {
                _closer.Date += _bridge.dateSlice[x] + " ";
            }

            #endregion

            #region Getting Lecturer details

            _lecturer = _gateWay.GetLecturer_StuffNumber(_lecture.StaffNumber);
            _closer.Lecturer = new Lecturer();
            _closer.Lecturer = _lecturer;
            #endregion

            #region Assigning images
            if (_bridge.filePath != null)
                _closer.files = _bridge.filePath;
            #endregion

            return View(_closer);
        }
コード例 #6
0
 public bool InsertStudent(Student _student)
 {
     StudentHandler myHandler = new StudentHandler(); return myHandler.NewStudent(_student);
 }