示例#1
0
        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();
                }
            }
        }
示例#2
0
        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;
                }
            }
        }
        public formViolationList(Driver driver)
        {
            InitializeComponent();

            this.driver = driver;

            violationList = ViolationList.getInstance();
        }
示例#4
0
        private void FillViolation()
        {
            ViolationList violationList = ViolationList.getInstance();
            Violation     violation     = violationList.getItem(_driver);

            if (violation != null)
            {
                ViolationInfo.Text = violation.ToString();
            }
        }
示例#5
0
        public void SendNotification()
        {
            IEnumerable <Violation> list = ViolationList.getInstance().GetViolationForAccount();

            if (list.Count() > 0)
            {
                Driver driversTo = GetDriverForSending();

                string mailText = CreateMail(list);

                EMail email = new EMail();

                email.SendNotification(driversTo, mailText, false);
            }
        }
示例#6
0
        public Car_AddEdit(Car car)
        {
            InitializeComponent();

            _car = car;

            diagCardList  = DiagCardList.getInstance();
            driverCarList = DriverCarList.getInstance();
            driverList    = DriverList.getInstance();
            dtpList       = DTPList.getInstance();
            invoiceList   = InvoiceList.getInstance();
            mileageList   = MileageList.getInstance();
            policyList    = PolicyList.getInstance();
            repairList    = RepairList.getInstance();
            violationList = ViolationList.getInstance();
            shipPartList  = ShipPartList.getInstance();
        }
示例#7
0
        public DialogResult ShowDialog(Car car)
        {
            _car = car;
            InitializeComponent();

            _diagCardList  = DiagCardList.getInstance();
            _driverCarList = DriverCarList.getInstance();
            _driverList    = DriverList.getInstance();
            _dtpList       = DTPList.getInstance();
            _invoiceList   = InvoiceList.getInstance();
            _mileageList   = MileageList.getInstance();
            _policyList    = PolicyList.getInstance();
            _repairList    = RepairList.getInstance();
            _violationList = ViolationList.getInstance();
            _shipPartList  = ShipPartList.getInstance();

            return(ShowDialog());
        }
示例#8
0
        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);
            }
        }