// GET: Student
        public async Task<ActionResult> Index(string sort = "id", int? page = 1, string fields = "id,name,address")
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:53506/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                HttpResponseMessage response = await client.GetAsync("api/student?sort=" + sort + "&page=" + page + "&fields=" + fields);
                if (response.IsSuccessStatusCode)
                {
                    List<Student> students = await response.Content.ReadAsAsync<List<Student>>();

                    List<StudentViewModel> model = new List<StudentViewModel>();
                    StudentDTO dto = new StudentDTO();
                    model = dto.ConvertToStudentViewModel(students);

                    int pageSize = 3;
                    int pageNumber = (page ?? 1);
                    return View(model.ToPagedList(pageNumber, pageSize));
                }

                var re = response.Content.ReadAsStringAsync().Result;

            }            

            return View("Error");
        }
        public async Task<ActionResult> Details(int id)
        {
            if(id == 0)
            {
                return View("Error");
            }

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:53506/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                HttpResponseMessage response = await client.GetAsync("api/student/" + id);
                if (response.IsSuccessStatusCode)
                {
                    Student student = await response.Content.ReadAsAsync<Student>();

                    StudentViewModel model = new StudentViewModel();
                    StudentDTO dto = new StudentDTO();
                    model = dto.ConvertToStudentViewModel(student);

                    return View(model);
                }
            }

            return View("Error");
        }
        public static Student GetStudent(DTO.StudentDTO StudentDTO)
        {
            Student Student = new Student();

            Student.IdGrade   = StudentDTO.IdGrade;
            Student.StudentId = StudentDTO.StudentId;
            Student.Level     = StudentDTO.Level;

            return(Student);
        }
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (DataInvalid() == true)
            {
                StudentDTO st = new StudentDTO();
                st.Password = txtbOldPass.Text;
                st.StudentID = GlobalVarian.StudentID;

                StudentBUS sb = new StudentBUS(st);
                if (sb.ChangePass(txtbNewPass.Text) == true)
                {
                    MessageBox.Show("Bạn đã thay đổi Password thành công.");
                    this.Close();
                }

            }
        }
Example #5
0
        public static Student Convert(StudentDTO studentDTO)
        {
            Student student = new Student();

            if (studentDTO.Id != default)
            {
                student.Id = studentDTO.Id;
            }
            student.FirstName       = studentDTO.FirstName;
            student.LastName        = studentDTO.LastName;
            student.IdentityNumber  = studentDTO.IdentityNumber;
            student.PhoneNumber     = studentDTO.PhoneNumber;
            student.Pignicher       = studentDTO.Pignicher;
            student.StudentKind     = studentDTO.StudentKind;
            student.Balance         = studentDTO.Balance;
            student.CreditDetailsId = studentDTO.CreditDetailsId;

            return(student);
        }
Example #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (DataInvalid() != false)
            {
                    StudentDTO sd = new StudentDTO();
                    sd.StudentID = int.Parse(txtbUser.Text);
                    sd.Password = txtbPass.Text;
                    StudentBUS ub = new StudentBUS(sd);
                    int kq = ub.isAtuthencation();
                    GlobalVarian.StudentID = kq;
                    if (kq >0)
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                        MessageBox.Show("Lỗi đăng nhập, mời bạn kiểm tra lại tài khoản!", "Error");

            }
        }
Example #7
0
        public static StudentDTO Convert(Student student)
        {
            StudentDTO studentDTO = new StudentDTO();

            studentDTO.Id                    = student.Id;
            studentDTO.FirstName             = student.FirstName;
            studentDTO.LastName              = student.LastName;
            studentDTO.IdentityNumber        = student.IdentityNumber;
            studentDTO.PhoneNumber           = student.PhoneNumber;
            studentDTO.Pignicher             = student.Pignicher;
            studentDTO.StudentKind           = student.StudentKind;
            studentDTO.Balance               = student.Balance;
            studentDTO.Addrees               = student.Addrees;
            studentDTO.BirthDay              = student.BirthDay;
            studentDTO.HMO                   = student.HMO;
            studentDTO.Comments              = student.Comments;
            studentDTO.StartDate             = student.StartDate;
            studentDTO.CreditDetailsId       = student.CreditDetailsId;
            studentDTO.CreditCardBackDigitis = student.CreditDetail?.BackDigits;
            studentDTO.CreditCardValidity    = student.CreditDetail?.Validity;
            studentDTO.CreditCardNumber      = student.CreditDetail?.CreditNumber;
            return(studentDTO);
        }
Example #8
0
 public StudentBUS(StudentDTO s)
 {
     sdDTO = s;
 }
 public SudentInStudyGroupDTO(int studentInStudyGroupId, int studyGroupId, int studentId, bool studentStatus, StudentDTO student, StudyGroupDTO studyGroup)
 {
     this.studentInStudyGroupId = studentInStudyGroupId;
     this.studyGroupId          = studyGroupId;
     this.studentId             = studentId;
     this.studentStatus         = studentStatus;
     Student    = student;
     StudyGroup = studyGroup;
 }
Example #10
0
 public ReportToStudentOnDateDTO(int reportToStudentOnDate_Id, int hwToStydyClassOnDate_id, int studentId, bool statusOfPreparation, DateTime reportingTime, HwToStydyClassOnDateDTO hwToStydyClassOnDate, StudentDTO student)
 {
     this.reportToStudentOnDate_Id = reportToStudentOnDate_Id;
     this.hwToStydyClassOnDate_id  = hwToStydyClassOnDate_id;
     this.studentId           = studentId;
     this.statusOfPreparation = statusOfPreparation;
     this.reportingTime       = reportingTime;
     HwToStydyClassOnDate     = hwToStydyClassOnDate;
     Student = student;
 }
Example #11
0
 public StudentDAO(StudentDTO _stdao)
 {
     sd = _stdao;
 }