Example #1
0
        private SinhVien GetInputForm()
        {
            if (txtMaSinhVien.Text == "")
            {
                txtMaSinhVien.Focus();
                throw new Exception("Nhập Mã Sinh Viên");
            }
            if (txtTenSinhVien.Text == "")
            {
                txtMaSinhVien.Focus();
                throw new Exception("Nhập Tên Sinh Viên");
            }

            if (txtDiaChi.Text == "")
            {
                txtMaSinhVien.Focus();
                throw new Exception("Nhập Địa Chỉ");
            }
            GioiTinh gt = (GioiTinh)cbbGioiTinh.SelectedItem;

            return(new SinhVien(
                       txtMaSinhVien.Text
                       , txtTenSinhVien.Text
                       , txtSDT.Text
                       , txtDiaChi.Text
                       , gt.Id
                       , dtpNgaySinh.Value
                       ));
        }
Example #2
0
        private void FormThemSinhVien_Load(object sender, EventArgs e)
        {
            // khoi tao danh sach goi tinh
            List <GioiTinh> lgt = GioiTinh.Get();

            cbbGioiTinh.DataSource    = lgt;
            cbbGioiTinh.DisplayMember = "Name";
            cbbGioiTinh.ValueMember   = "Id";
            // gan gia tri mac dinh
            cbbGioiTinh.SelectedIndex = 0;
        }
Example #3
0
        public formSuaSinhVien()
        {
            // khoi tao các doi tuong form
            InitializeComponent();

            List <GioiTinh> lgt = GioiTinh.Get();

            cbbGioiTinh.DataSource    = lgt;
            cbbGioiTinh.DisplayMember = "Name";
            cbbGioiTinh.ValueMember   = "Id";


            SetInputForm(SinhVien.GetSinhVienSua());
        }
Example #4
0
        public static List <GioiTinh> Get()
        {
            List <GioiTinh> lgt   = new List <GioiTinh>();
            GioiTinh        gtNam = new GioiTinh();

            gtNam.Id   = Nam;
            gtNam.Name = "Nam";
            lgt.Add(gtNam);
            GioiTinh gtNu = new GioiTinh();

            gtNu.Id   = Nu;
            gtNu.Name = "Nữ";
            lgt.Add(gtNu);
            return(lgt);
        }