private void txtSearch_TextChanged(object sender, EventArgs e) { MarikinaOpticalEntities dbContext = new MarikinaOpticalEntities(); switch (cmbSearch.SelectedIndex) { case 1: dgvListOfPatient.DataSource = dbContext.SearchDatePatient(dtpSearch.Value.Date.ToShortDateString()); dtpSearch.Enabled = true; txtSearch.Visible = false; txtSearch.Enabled = false; break; case 2: dgvListOfPatient.DataSource = dbContext.SearchIdPatient(txtSearch.Text); txtSearch.Visible = true; dtpSearch.Enabled = false; dtpSearch.Visible = false; break; case 3: dgvListOfPatient.DataSource = dbContext.SearchFullNamePatient(txtSearch.Text); txtSearch.Visible = true; dtpSearch.Enabled = false; dtpSearch.Visible = false; break; default: break; } }
private void dtpSearch_ValueChanged(object sender, EventArgs e) { MarikinaOpticalEntities dbContext = new MarikinaOpticalEntities(); dgvListOfPatient.DataSource = dbContext.SearchDatePatient(dtpSearch.Value.Date.ToShortDateString()); }