public void LoadEmailData() { var ef = new EmployeeEmail(); var employee = (Employee)comboBox1.SelectedValue; var q = ef.RetrieveEmailAddress(employee.NIK); dataGridView2.DataSource = q; }
private void EmployeeEntryEmailData_Load(object sender, EventArgs e) { var employee = new Employee(); var q = employee.RetrieveEmployees().Select(x => new { Display = x.nickname + " - " + x.NIK, Value = x }).ToList(); comboBox1.DisplayMember = "Display"; comboBox1.ValueMember = "Value"; comboBox1.DataSource = q; var employeeEmail = new EmployeeEmail(); formReady = true; LoadEmployeeData(); LoadEmailData(); }
private void button1_Click(object sender, EventArgs e) { if (!Validation(groupBox1)) { MessageBox.Show("All data must be filled"); return; } try { string emailAddress = textBox1.Text; var employee = (Employee)comboBox1.SelectedValue; EmployeeEmail ef = new EmployeeEmail(employee.NIK, emailAddress); ef.AddEmailAddress(); LoadEmailData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }