private void DoubleClickPolicy(Point point) { if (_dgvMain.GetID() == 0) { return; } PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(_dgvMain.GetID()); string columnName = _dgvCar.Columns[point.X].HeaderText; if ((_dgvCar.Columns[point.X].HeaderText == "Номер полиса") && (!string.IsNullOrEmpty(policy.File))) { WorkWithFiles.openFile(policy.File); } else if (DGVSpecialColumn.CanFiltredPolicy(columnName)) // (labelList.Where(item => item.Text == columnName).Count() == 1) { _myFilter.SetFilterValue(string.Concat(columnName, ":"), point); } else { Policy_AddEdit policyAE = new Policy_AddEdit(policy); if (policyAE.ShowDialog() == DialogResult.OK) { loadCars(); } } }
private void CreateAllComboBox() { _load = false; clearComboList(); foreach (DataGridViewColumn col in _dgv.Columns) { if ((col.Visible) && (DGVSpecialColumn.CanInclude(col.HeaderText))) { CreateLabelAndComboBox(col.HeaderText); } } FillAllComboBox(); _load = true; }
private void DoubleClickDefault(Point point) { Car car = _dgvMain.GetCar(); if (car == null) { return; } /*TODO: Столяровой доступ к информации про водителя и основную о машине */ if (User.getDriver().UserRole == RolesList.AccountantWayBill && _dgvCar.Columns[point.X].HeaderText != "Водитель") { OpenCarAddEdit(car); return; } PTSList ptsList = PTSList.getInstance(); PTS pts = ptsList.getItem(car); STSList stsList = STSList.getInstance(); STS sts = stsList.getItem(car); string columnName = _dgvCar.Columns[point.X].HeaderText; if (_dgvCar.Columns[point.X].HeaderText == "VIN") { formCarInfo formcarInfo = new formCarInfo(car); formcarInfo.ShowDialog(); } else if (_dgvCar.Columns[point.X].HeaderText == "Водитель") { if (isCellNoHeader(point.X)) { DriverCarList driverCarList = DriverCarList.getInstance(); Driver driver = driverCarList.GetDriver(car); if (driver == null) { return; } DriverList driverList = DriverList.getInstance(); Driver_AddEdit dAE = new Driver_AddEdit(driver); if (dAE.ShowDialog() == DialogResult.OK) { loadCars(); } } } else if ((_dgvCar.Columns[point.X].HeaderText == "№ ПТС") && (!string.IsNullOrEmpty(pts.File))) { WorkWithFiles.openFile(pts.File); } else if ((_dgvCar.Columns[point.X].HeaderText == "№ СТС") && (!string.IsNullOrEmpty(sts.File))) { WorkWithFiles.openFile(sts.File); } else if (DGVSpecialColumn.CanFiltredActual(columnName)) { _myFilter.SetFilterValue(string.Concat(columnName, ":"), point); } else { OpenCarAddEdit(car); } }
private void DoubleClickAccountViolation(Point point) { try { int id = _dgvMain.GetID(); if (id == 0) { return; } Violation violation = ViolationList.getInstance().getItem(id); string columnName = _dgvCar.Columns[point.X].HeaderText; if (((_dgvCar.Columns[point.X].HeaderText == "№ постановления") || (_dgvCar.Columns[point.X].HeaderText == "Сумма штрафа")) && (!string.IsNullOrEmpty(violation.File))) { WorkWithFiles.openFile(violation.File); } else if ((_dgvCar.Columns[point.X].HeaderText == "Согласование") && (!violation.Agreed)) { if (violation.File == string.Empty) { throw new NotImplementedException("Для согласования необходимо прикрепить скан копию счёта"); } else if ((User.GetRole() == RolesList.Boss) || (User.GetRole() == RolesList.Adminstrator)) { violation.Agree(); loadCars(); } else { throw new AccessViolationException("Вы не имеете прав на выполнение этой операции"); } } else if (DGVSpecialColumn.CanInclude(columnName)) { _myFilter.SetFilterValue(string.Concat(columnName, ":"), point); } else { Violation_AddEdit violationAE = new Violation_AddEdit(violation); if (violationAE.ShowDialog() == DialogResult.OK) { loadCars(); } } } catch (NotImplementedException ex) { MessageBox.Show(ex.Message, "Ошибка отправки", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (NullReferenceException ex) { MessageBox.Show(ex.Message, "Ошибка отправки", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (AccessViolationException ex) { MessageBox.Show(ex.Message, "Ошибка доступа", MessageBoxButtons.OK, MessageBoxIcon.Error); } }