コード例 #1
0
        public void loadViewQTHT()
        {
            bdsQTHT.DataSource          = null;
            dtgQTHT.AutoGenerateColumns = false;
            var lsQTHT = QTHTService.getQTHT(qthtPathFile);

            if (lsQTHT != null)
            {
                bdsQTHT.DataSource = lsQTHT;
            }
            else
            {
                throw new Exception("QTHT không tồn tại!");
            }
            dtgQTHT.DataSource = bdsQTHT;
            //lblContact.Text = string.Format("Tổng contact: {0} mục", lsContactSort.Count());
        }
コード例 #2
0
        public frmThongTinSinhVien(string idStudent)
        {
            InitializeComponent();
            picAnhDaiDien.AllowDrop = true;
            anhDaiDienPathDirectory = Application.StartupPath + @"\AnhDaiDien";
            anhDaiDienPathFile      = anhDaiDienPathDirectory + @"\avatar.png";
            studentPathFile         = Application.StartupPath + @"\Data\student_data.txt";
            qthtPathFile            = Application.StartupPath + @"\Data\quatrinhhoctap.txt";
            loadViewQTHT();
            if (File.Exists(anhDaiDienPathFile))
            {
                FileStream fileStream = new FileStream(anhDaiDienPathFile, FileMode.Open, FileAccess.Read);
                picAnhDaiDien.Image = Image.FromStream(fileStream);
            }
            //var student = StudentService.getStudent(idStudent);
            var student = StudentService.getStudent(studentPathFile, idStudent);

            if (student == null)
            {
                throw new Exception("Lỗi rồi!");
            }
            else
            {
                txtMaSV.Text        = student.ID;
                txtHoTen.Text       = student.FullName;
                txtNgaySinh.Value   = student.DateOfBirth;
                txtNoiSinh.Text     = student.PlaceOfBirth;
                txtGioiTinh.Checked = student.Gender == Model.GENDER.Male;

                //student.qtht1 = QTHTService.getQTHT(idStudent);
                student.qtht1 = QTHTService.getQTHT(qthtPathFile, idStudent);

                bdsQTHT.DataSource = student.qtht1;
                //không cho tự tạo colum
                dtgQTHT.AutoGenerateColumns = false;
                dtgQTHT.DataSource          = bdsQTHT;
                lblMuc.Text = string.Format("{0} mục", student.qtht1.Count());
            }
        }