Esempio n. 1
0
        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();
        }