Beispiel #1
0
        public frmThaoTacGV(string id)
        {
            InitializeComponent();
            _ID = id;
            gvc = new GiaoVienController();
            GiaoVien gv = new GiaoVien();

            if (id == null)
            {
                txtMaGV.Enabled = true;
                return;
            }
            gv            = gvc.GetData(id);
            txtMaGV.Text  = gv.MaGV;
            txtHoTen.Text = gv.HoTen;
            DateTime _NgaySinh = (Convert.ToDateTime(gv.NgaySinh));

            dtNgaySinh.Value = _NgaySinh;
            if (gv.GioiTinh == "False")
            {
                ckNam.Checked = true;
            }
            else if (gv.GioiTinh == "True")
            {
                ckNu.Checked = true;
            }
            txtSDT.Text     = gv.Sdt;
            txtQueQuan.Text = gv.QueQuan;
            lblTen.Text     = gv.HoTen;
            string gt = null;

            if (gv.GioiTinh == "False")
            {
                gt = "Nam";
            }
            else if (gv.GioiTinh == "True")
            {
                gt = "Nữ";
            }
            lblGoiTinh.Text = gt;
            int tuoi = DateTime.Now.Year - _NgaySinh.Year;

            lblTuoi.Text = tuoi.ToString() + " Tuổi";
        }