Ejemplo n.º 1
0
        public void SendNotification()
        {
            if (DateTime.Today.Day != SEND_DAY)
            {
                return;
            }

            DiagCardList    diagCardList = DiagCardList.getInstance();
            List <DiagCard> list         = diagCardList.GetDiagCardEnds().ToList();

            int begin = 0;
            int end   = 0;

            if (!ListEmpty(list))
            {
                STSList stsList = STSList.getInstance();

                while (end < list.Count)
                {
                    begin = end;
                    end  += ((end + MAILS_COUNT) < list.Count) ? MAILS_COUNT : (list.Count - end);

                    List <DiagCard> listCut = new List <DiagCard>();

                    for (int i = begin; i < end; i++)
                    {
                        listCut.Add(list[i]);
                    }

                    IEnumerable <Car> carList = diagCardList.GetCarListFromDiagCardList(listCut);
                    List <string>     files   = new List <string>();

                    foreach (Car car in carList)
                    {
                        STS sts = stsList.getItem(car);
                        if (sts.File != string.Empty)
                        {
                            files.Add(sts.File);
                        }
                    }

                    string mailText = CreateMail(listCut);

                    EMail email = new EMail();

                    Driver employeeAutoDept = GetDriverForSending();
                    email.SendNotification(employeeAutoDept, mailText, true, files);
                }
            }
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        public void CreatePolicyTable()
        {
            const int indexBegin = 6;
            var       date       = DateTime.Today.AddMonths(1);

            _excelDoc = openDocumentExcel("Таблица страхования");

            var myDate = new MyDateTime(date.ToShortDateString());

            _excelDoc.setValue(2, 1, "Страхуем в " + myDate.MonthToStringPrepositive() + " " + myDate.Year + " г.");

            var policyList = PolicyList.getInstance();
            var list       = policyList.GetPolicyList(date);
            var listCar    = policyList.GetCarListByPolicyList(list);

            var diagCardList = DiagCardList.getInstance();

            var rowIndex = indexBegin;

            foreach (var 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);

                var diagCard = diagCardList.getItem(car);

                if (diagCard != null)
                {
                    _excelDoc.setValue(rowIndex, 12, diagCard.Date.ToShortDateString());
                    _excelDoc.setValue(rowIndex, 13, diagCard.Number);
                }

                rowIndex++;
            }

            _excelDoc.Show();
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
0
        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();
                }
            }
        }
Ejemplo n.º 7
0
        public DataTable getDataTableDiagCard()
        {
            DiagCardList diagCardList = DiagCardList.getInstance();

            return(diagCardList.ToDataTable(this));
        }