private void FormQuanLyKhachHang_Load(object sender, EventArgs e) { List <GioiTinh> lgt = GioiTinh.Get(); cbbgioitinh.DataSource = lgt; cbbgioitinh.DisplayMember = "Name"; cbbgioitinh.ValueMember = "Id"; cbbgioitinh.SelectedIndex = 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 = "Nu"; lgt.Add(gtNu); return(lgt); }
private KhachHang GetInputKhachHang() { if (txtmakh.Text == "") { throw new Exception("Bạn Chưa nhập mã khách hàng"); } if (txttenkh.Text == "") { throw new Exception("Bạn Chưa nhập tên khách hàng"); } if (txtsodienthoai.Text == "") { throw new Exception("Bạn Chưa nhập số điện thoại"); } if (txtdiachi.Text == "") { throw new Exception("Bạn Chưa nhập địa chỉ"); } GioiTinh gt = (GioiTinh) cbbgioitinh.SelectedItem; return(new KhachHang(txtmakh.Text, txttenkh.Text, txtdiachi.Text, txtsodienthoai.Text, gt.Id, dtpngaysinh.Value)); }