private void DoubleClickViolation(Point point) { if (_dgvMain.GetID() == 0) { return; } ViolationList violationList = ViolationList.getInstance(); Violation violation = violationList.getItem(_dgvMain.GetID()); if ((_dgvCar.Columns[point.X].HeaderText == "№ постановления") && (!string.IsNullOrEmpty(violation.File))) { WorkWithFiles.openFile(violation.File); } else if ((_dgvCar.Columns[point.X].HeaderText == "Дата оплаты") && (!string.IsNullOrEmpty(violation.FilePay))) { WorkWithFiles.openFile(violation.FilePay); } else { Violation_AddEdit vAE = new Violation_AddEdit(violation); if (vAE.ShowDialog() == DialogResult.OK) { loadCars(); } } }
private void SetFormatViolation() { SetCellFormat("Сумма штрафа", "N0"); SetRightAligment("Сумма штрафа"); ViolationList violationList = ViolationList.getInstance(); foreach (DataGridViewRow row in _dgv.Rows) { int id; int.TryParse(row.Cells[0].Value.ToString(), out id); Violation violation = violationList.getItem(id); if (violation.Sent) { row.Cells["№ постановления"].Style.BackColor = Color.MediumPurple; } if (violation.FilePay != string.Empty) { row.Cells["Дата оплаты"].Style.BackColor = Color.MediumPurple; } } }
private void FillViolation() { ViolationList violationList = ViolationList.getInstance(); Violation violation = violationList.getItem(_driver); if (violation != null) { ViolationInfo.Text = violation.ToString(); } }
private void _dgvViolation_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idViolation = Convert.ToInt32(_dgvViolation.Rows[e.RowIndex].Cells[0].Value); Violation violation = _violationList.getItem(idViolation); if ((e.ColumnIndex == 6) && (violation.File != string.Empty)) { WorkWithFiles.OpenFile(violation.File); } else if ((e.ColumnIndex == 7) && (violation.FilePay != string.Empty)) { WorkWithFiles.OpenFile(violation.FilePay); } else { Violation_AddEdit vAE = new Violation_AddEdit(violation); if (vAE.ShowDialog() == System.Windows.Forms.DialogResult.OK) { loadViolation(); } } }