Exemple #1
0
        private void FormSuaSinhVien_Load(object sender, EventArgs e)
        {
            List <GioiTinh> lgt = GioiTinh.Get();

            cbbgioitinh.DataSource    = lgt;
            cbbgioitinh.DisplayMember = "Name";
            cbbgioitinh.ValueMember   = "Id";
            cbbgioitinh.SelectedIndex = 0;
        }
Exemple #2
0
 private void SetInputForm(Sinhvien sv)
 {
     txtmasinhvien.Text        = sv.MaSV;
     txttensinhvien.Text       = sv.TenSV;
     txtdiachi.Text            = sv.DiaChi;
     txtsodienthoai.Text       = sv.SDT;
     dtbngaysinh.Value         = sv.NgaySinh;
     cbbgioitinh.SelectedValue = sv.GioiTinh;
     GioiTinh gt = (GioiTinh)
                   cbbgioitinh.SelectedItem;
 }
Exemple #3
0
        public FormSuaSinhVien()
        {
            InitializeComponent();
            List <GioiTinh> lgt = GioiTinh.Get();

            cbbgioitinh.DataSource    = lgt;
            cbbgioitinh.DisplayMember = "Name";
            cbbgioitinh.ValueMember   = "Id";
            //khởi tạo các đối tượng form

            SetInputForm(Sinhvien.GetSinhVienSua());
        }
        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 = "Nu ";
            lgt.Add(gtNu);
            return(lgt);
        }
Exemple #5
0
        private Sinhvien GetInputForm()
        {
            if (txttensinhvien.Text == "")
            {
                txttensinhvien.Focus();
                throw new Exception(" Nhập tên sinh viên");
            }
            if (txtdiachi.Text == "")
            {
                txtdiachi.Focus();
                throw new Exception(" Nhập địa chỉ ");
            }
            GioiTinh gt = (GioiTinh)
                          cbbgioitinh.SelectedItem;

            return(new Sinhvien(txtmasinhvien.Text, txttensinhvien.Text, txtdiachi.Text, txtsodienthoai.Text, gt.Id, dtbngaysinh.Value));
        }
Exemple #6
0
        private Sinhvien GetInPutSinhVien()
        {
            if (txtmasv.Text == "")
            {
                txtmasv.Focus();
                throw new Exception(" Nhập mã sinh viên");
            }
            if (txttensv.Text == "")
            {
                txttensv.Focus();
                throw new Exception(" Nhập tên sinh viên");
            }
            if (txtdiachi.Text == "")
            {
                txtdiachi.Focus();
                throw new Exception(" Nhập địa chỉ ");
            }
            GioiTinh gt = (GioiTinh)
                          cbbgioitinh.SelectedItem;

            return(new Sinhvien(txtmasv.Text, txttensv.Text, txtdiachi.Text, txtsdt.Text, gt.Id, dtngaysinh.Value));
        }