private Models.Nhanvien GetData() { Models.Nhanvien nv = new Models.Nhanvien(); nv.Hoten = textBox2.Text; nv.Ngaysinh = DateTime.Parse(dateTimePicker1.Text); nv.Diachi = textBox6.Text; if (textBox7.Text != "") { nv.NhanvienID = int.Parse(textBox7.Text); } if (radioButton1.Checked == true) { nv.Gioitinh = true; } else { nv.Gioitinh = false; } nv.Hesoluong = float.Parse(textBox3.Text); Bophan bp = lstBophan.Find(x => x.Tenbophan == comboBox1.SelectedItem.ToString()); nv.BophanID = bp.BophanID; nv.Tenbophan = bp.Tenbophan; nv.Password = ""; return(nv); }
private void ViewData() { if (dataGridView1.CurrentRow != null) { int NhanvienID; int.TryParse(dataGridView1.CurrentRow.Cells[0].Value.ToString(), out NhanvienID); Models.Nhanvien nv = lstNhanvien.Find(x => x.NhanvienID == NhanvienID); if (NhanvienID > 0) { textBox2.Text = nv.Hoten; dateTimePicker1.Text = nv.Ngaysinh.ToShortDateString(); radioButton1.Checked = false; radioButton2.Checked = false; if (nv.Gioitinh) { radioButton1.Checked = true; } else { radioButton2.Checked = true; } textBox6.Text = nv.Diachi; textBox7.Text = nv.NhanvienID.ToString(); textBox3.Text = nv.Hesoluong.ToString(); comboBox1.SelectedIndex = comboBox1.Items.IndexOf(nv.Tenbophan); button2.Enabled = false; button3.Enabled = true; button4.Enabled = true; } } }
private Models.Nhanvien GetData() { Models.Nhanvien nv = new Models.Nhanvien(); nv.Hoten = textBox2.Text; nv.Ngaysinh = DateTime.Parse(dateTimePicker1.Text); nv.Diachi = textBox6.Text; if (textBox7.Text != "") { nv.NhanvienID = int.Parse(textBox7.Text); } if (radioButton1.Checked == true) { nv.Gioitinh = true; } else { nv.Gioitinh = false; } nv.Hesoluong = float.Parse(textBox3.Text); Bophan bp=lstBophan.Find(x => x.Tenbophan == comboBox1.SelectedItem.ToString()); nv.BophanID = bp.BophanID; nv.Tenbophan = bp.Tenbophan; nv.Password = ""; return nv; }