예제 #1
0
        private void cmbSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            MarikinaOpticalEntities dbContext = new MarikinaOpticalEntities();

            switch (cmbSearch.SelectedIndex)
            {
            case 0:
                dgvListOfPatient.DataSource = dbContext.GetPatients();
                txtSearch.Enabled           = false;
                dtpSearch.Enabled           = false;
                txtSearch.Visible           = true;
                break;

            case 1:
                dgvListOfPatient.DataSource = dbContext.SearchDatePatient(dtpSearch.Value.Date.ToShortDateString());
                dtpSearch.Enabled           = true;
                dtpSearch.Visible           = true;
                txtSearch.Text    = null;
                txtSearch.Visible = false;
                txtSearch.Enabled = false;
                break;

            case 2:
                dgvListOfPatient.DataSource = dbContext.SearchIdPatient(txtSearch.Text);
                txtSearch.Text    = null;
                txtSearch.Visible = true;
                txtSearch.Enabled = true;
                dtpSearch.Enabled = false;
                dtpSearch.Visible = false;
                break;

            case 3:
                dgvListOfPatient.DataSource = dbContext.SearchFullNamePatient(txtSearch.Text);
                txtSearch.Text    = null;
                txtSearch.Visible = true;
                txtSearch.Enabled = true;
                dtpSearch.Enabled = false;
                dtpSearch.Visible = false;
                break;

            default:
                break;
            }
        }
예제 #2
0
        public void PatientLoad()
        {
            MarikinaOpticalEntities dbContext = new MarikinaOpticalEntities();

            cmbSearch.SelectedIndex     = 0;
            dgvListOfPatient.DataSource = dbContext.GetPatients();
            dgvListOfPatient.Columns[0].HeaderCell.Value  = "Id";
            dgvListOfPatient.Columns[0].Visible           = false;
            dgvListOfPatient.Columns[1].HeaderCell.Value  = "Date and Time";
            dgvListOfPatient.Columns[1].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[2].HeaderCell.Value  = "Patient No.";
            dgvListOfPatient.Columns[2].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[3].HeaderCell.Value  = "Full Name";
            dgvListOfPatient.Columns[3].AutoSizeMode      = DataGridViewAutoSizeColumnMode.Fill;
            dgvListOfPatient.Columns[4].HeaderCell.Value  = "Gender";
            dgvListOfPatient.Columns[4].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[5].HeaderCell.Value  = "Birthday";
            dgvListOfPatient.Columns[5].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[6].HeaderCell.Value  = "Age";
            dgvListOfPatient.Columns[6].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[7].HeaderCell.Value  = "Mobile No.";
            dgvListOfPatient.Columns[7].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[8].HeaderCell.Value  = "Telephone No.";
            dgvListOfPatient.Columns[8].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[9].HeaderCell.Value  = "Address";
            dgvListOfPatient.Columns[9].AutoSizeMode      = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[10].HeaderCell.Value = "Status";
            dgvListOfPatient.Columns[10].AutoSizeMode     = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvListOfPatient.Columns[11].Visible          = false;
            dgvListOfPatient.Columns[12].Visible          = false;
            dgvListOfPatient.Columns[13].Visible          = false;
            dgvListOfPatient.Columns[14].Visible          = false;
            dgvListOfPatient.Columns[15].Visible          = false;
            dgvListOfPatient.Columns[16].Visible          = false;
            dgvListOfPatient.Columns[17].Visible          = false;
        }