private void SetFormatDiagCard() { DiagCardList diagCardList = DiagCardList.getInstance(); foreach (DataGridViewRow row in _dgv.Rows) { int id; int.TryParse(row.Cells[0].Value.ToString(), out id); DiagCard diagCard = diagCardList.getItem(id); if (diagCard.File != string.Empty) { row.Cells["№ ДК"].Style.BackColor = Color.MediumPurple; } } }
public void CreatePolicyTable() { const int INDEX_BEGIN = 6; DateTime date = DateTime.Today.AddMonths(1); _excelDoc = openDocumentExcel("Таблица страхования"); MyDateTime myDate = new MyDateTime(date.ToShortDateString()); _excelDoc.setValue(2, 1, "Страхуем в " + myDate.MonthToStringPrepositive() + " " + myDate.Year + " г."); PolicyList policyList = PolicyList.getInstance(); List <Policy> list = policyList.GetPolicyList(date); List <Car> listCar = policyList.GetCarListByPolicyList(list); DiagCardList diagCardList = DiagCardList.getInstance(); int rowIndex = INDEX_BEGIN; foreach (Car car in listCar) { _excelDoc.setValue(rowIndex, 2, car.Grz); _excelDoc.setValue(rowIndex, 3, car.Mark.Name); _excelDoc.setValue(rowIndex, 4, car.info.Model); _excelDoc.setValue(rowIndex, 5, car.vin); _excelDoc.setValue(rowIndex, 6, car.Year); _excelDoc.setValue(rowIndex, 7, GetPolicyBeginDate(list, car, PolicyType.ОСАГО)); _excelDoc.setValue(rowIndex, 8, GetPolicyBeginDate(list, car, PolicyType.КАСКО)); _excelDoc.setValue(rowIndex, 9, car.info.Owner); _excelDoc.setValue(rowIndex, 10, car.info.Owner); _excelDoc.setValue(rowIndex, 11, car.info.Owner); DiagCard diagCard = diagCardList.getItem(car); if (diagCard != null) { _excelDoc.setValue(rowIndex, 12, diagCard.Date.ToShortDateString()); _excelDoc.setValue(rowIndex, 13, diagCard.Number); } rowIndex++; } _excelDoc.Show(); }
private void _dgvDiagCard_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idDiagCard = Convert.ToInt32(_dgvDiagCard.Rows[e.RowIndex].Cells[0].Value); DiagCard diagCard = _diagCardList.getItem(idDiagCard); if ((e.ColumnIndex == 4) && (diagCard.File != string.Empty)) { WorkWithFiles.OpenFile(diagCard.File); } else { DiagCard_AddEdit diagcardAE = new DiagCard_AddEdit(diagCard); if (diagcardAE.ShowDialog() == System.Windows.Forms.DialogResult.OK) { loadDiagCard(); } } }
private void DoubleClickDiagCard(Point point) { if (_dgvMain.GetID() == 0) { return; } DiagCardList diagCardList = DiagCardList.getInstance(); DiagCard diagCard = diagCardList.getItem(_dgvMain.GetID()); if ((_dgvCar.Columns[point.X].HeaderText == "№ ДК") && (!string.IsNullOrEmpty(diagCard.File))) { WorkWithFiles.openFile(diagCard.File); } else { DiagCard_AddEdit diagCardAE = new DiagCard_AddEdit(diagCard); if (diagCardAE.ShowDialog() == DialogResult.OK) { loadCars(); } } }