private void frmCheckout_Load(object sender, EventArgs e) { //SSK.ConnectDB_Win("Anonymous"); //SSK.ConnectDB_Auth("SSK-10", "admin", "admin"); //Recent List SSK.LoadData("SELECT * FROM vwSSKTop5"); dgvRecent.DataSource = SSK.dt; SSK.DisableColumnSorted(dgvRecent); //Check-in List SSK.LoadData("SELECT * FROM vwSSK"); dgvCheckIn.DataSource = SSK.dt; dgvCheckIn.Columns[9].Visible = false; //Photo column dgvCheckOut.Columns[9].Visible = false; SSK.DisableColumnSorted(dgvCheckIn); SSK.DisableColumnSorted(dgvCheckOut); dgvCheckIn.Columns[0].HeaderText = "No"; dgvCheckIn.Columns[1].HeaderText = "ID"; dgvCheckIn.Columns[2].HeaderText = "Name"; dgvCheckIn.Columns[3].HeaderText = "Sex"; dgvCheckIn.Columns[4].HeaderText = "Date of Birth"; dgvCheckIn.Columns[5].HeaderText = "Illness"; dgvCheckIn.Columns[6].HeaderText = "Bed"; dgvCheckIn.Columns[7].HeaderText = "Doctor"; dgvCheckIn.Columns[8].HeaderText = "Date In"; clearSelection(); }
private void txtSearch_KeyUp(object sender, KeyEventArgs e) { clearSelection(); SSK.SearchDataGridView(dgvCheckIn, txtSearch.Text.ToLower()); try { dgvCheckIn_CellClick(dgvCheckIn, new DataGridViewCellEventArgs(1, dgvCheckIn.SelectedRows[0].Index)); }catch (Exception exc) { } }
private void btnAddCheckout_Click(object sender, EventArgs e) { try { SSK.MoveDataBetweenDataGridViews(dgvCheckIn, dgvCheckOut); dgvCheckOut.Rows[dgvCheckOut.RowCount - 1].Cells[10].Value = DateTime.Now.ToString("dd/MM/yyyy"); clearSelection(); pictureBox.Image = null; } catch (Exception exc) { } }
private void dgvCheckOut_CellClick(object sender, DataGridViewCellEventArgs e) { pictureBox.Image = null; byte[] image = null; try { image = (byte[])dgvCheckOut.Rows[e.RowIndex].Cells[9].Value; } catch (Exception ex) { } if (dgvCheckOut.RowCount > -1) { if (image != null) { pictureBox.Image = SSK.GetImage(image); } } }