private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == dtGrid.Columns[0].Index && e.RowIndex >= 0) { if (fileIDs.Contains(dtGrid.Rows[e.RowIndex].Cells[1].Value.ToString())) { fileIDs.Remove(dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); Console.WriteLine("REMOVED this id " + dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); } else { fileIDs.Add(dtGrid.Rows[e.RowIndex].Cells[1].Value.ToString()); Console.WriteLine("ADDED ITEM " + dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); } } //try //{ if (e.ColumnIndex == 18) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this information? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("tests", dtGrid.Rows[e.RowIndex].Cells[1].Value.ToString()); MessageBox.Show("Information deleted"); LoadData(); } } }
private void dtAddict_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this information? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("addiction", dtAddict.Rows[e.RowIndex].Cells[0].Value.ToString()); MessageBox.Show("Information deleted"); LoadAddiction(PatientID); } } }
private void dtServices_CellClick(object sender, DataGridViewCellEventArgs e) { if (dtGrid.Rows[e.RowIndex].Cells["Cancel"].Value.ToString() == "Cancel") { if (MessageBox.Show("YES or No?", "Cancel this service ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("services", dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); MessageBox.Show("Information deleted"); LoadServices(queueNo.Text); } } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dtGrid.Columns["Cancel"].Index && e.RowIndex >= 0) { if (MessageBox.Show("YES or No?", "Cancel service ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("services", dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); MessageBox.Show("Information deleted"); LoadServices(orderLbl.Text); } } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == dtGrid.Columns[0].Index && e.RowIndex >= 0) { if (fileIDs.Contains(dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString())) { fileIDs.Remove(dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); Console.WriteLine("REMOVED this id " + dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); } else { fileIDs.Add(dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); Console.WriteLine("ADDED ITEM " + dtGrid.Rows[e.RowIndex].Cells[0].Value.ToString()); } } //try //{ if (e.ColumnIndex == 1) { if (MessageBox.Show("YES or No?", "Are you sure you want to delete this information? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("clinics", dtGrid.Rows[e.RowIndex].Cells[2].Value.ToString()); MessageBox.Show("Information deleted"); LoadData(); } } //} //catch { } if (e.ColumnIndex == 0) { updateID = dtGrid.Rows[e.RowIndex].Cells[2].Value.ToString(); nameTxt.Text = _clinics.First(k => k.Id.Contains(updateID)).Name; maxTxt.Text = _clinics.First(k => k.Id.Contains(updateID)).Maxs; minTxt.Text = _clinics.First(k => k.Id.Contains(updateID)).Mins; saveBtn.Visible = false; updateBtn.Visible = true; } }
private void dtGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; updateID = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); if (e.ColumnIndex == 11) { if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes") { if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { } else { return; } } if (MessageBox.Show("YES or No?", "Is visit complete? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { //Global._queues.RemoveAll(x => x.Id == updateID); //DBConnect.Delete("queue", dtGrid.Rows[e.RowIndex].Cells[3].Value.ToString()); _queue = new Queue(updateID, _queues.First(x => x.Id.Contains(updateID)).Follow, _queues.First(x => x.Id.Contains(updateID)).PatientID, _queues.First(x => x.Id.Contains(updateID)).UserID, _queues.First(x => x.Id.Contains(updateID)).RoomID, _queues.First(x => x.Id.Contains(updateID)).ClinicID, "Complete", _queues.First(x => x.Id.Contains(updateID)).Dated, DateTime.Now.ToString("dd-MM-yyyy H:mm:ss"), _queues.First(x => x.Id.Contains(updateID)).Department, "", "", "", "", "", "", "", "", "", Helper.orgID, dtGrid.Rows[e.RowIndex].Cells["type"].Value.ToString()); DBConnect.Update(_queue, updateID); Global._queues.RemoveAll(x => x.Id == updateID); Global._queues.Add(_queue); MessageBox.Show("Information updated"); LoadData(); } } if (e.ColumnIndex == 10) { if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes") { if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { } else { return; } } string visitID = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); string patientID = dtGrid.Rows[e.RowIndex].Cells["patientID"].Value.ToString(); string practitionerID = dtGrid.Rows[e.RowIndex].Cells["practitionerID"].Value.ToString(); string department = dtGrid.Rows[e.RowIndex].Cells["Department"].Value.ToString(); if (department.Contains("ent")) { DentalForm frm = new DentalForm(visitID, patientID, practitionerID); frm.MdiParent = MainForm.ActiveForm; frm.Dock = DockStyle.Fill; frm.Show(); } else { PatientVisit frm = new PatientVisit(visitID, patientID, practitionerID); frm.MdiParent = MainForm.ActiveForm; frm.Dock = DockStyle.Fill; frm.Show(); } } if (e.ColumnIndex == 16) { if (dtGrid.Rows[e.RowIndex].Cells["Paid for consulation"].Value.ToString() != "Yes") { if (MessageBox.Show("YES or No?", "Payments not yet made would you like to continue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { } else { return; } } string visitID = dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString(); string patientID = dtGrid.Rows[e.RowIndex].Cells["patientID"].Value.ToString(); string practitionerID = dtGrid.Rows[e.RowIndex].Cells["practitionerID"].Value.ToString(); OutPatient frm = new OutPatient(visitID, patientID, practitionerID); frm.MdiParent = MainForm.ActiveForm; frm.Dock = DockStyle.Fill; frm.Show(); } if (e.ColumnIndex == dtGrid.Columns["Remove"].Index && e.RowIndex >= 0) { if (MessageBox.Show("YES or No?", "Remove Patient from Queue ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { DBConnect.Delete("queue", dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString()); Global._queues.RemoveAll(w => w.Id.Contains(dtGrid.Rows[e.RowIndex].Cells["id"].Value.ToString())); MessageBox.Show("Information deleted"); LoadData(); LoadItem(); } } }