public void sendMailPolicy(Car car, PolicyType type) { PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(car, type); if (string.IsNullOrEmpty(policy.File)) { throw new Exception("Не найден файл полиса"); } else { _subject = "Полис " + type.ToString(); CreateBodyPolicy(type); DriverCarList driverCarList = DriverCarList.getInstance(); Driver driver = driverCarList.GetDriver(car); Send(new List <Driver> { driver }, new string[] { _authorEmail }, new List <Attachment>() { new Attachment(policy.File) }); } }
private void FillTable() { CreateColumnsTable(); PolicyList policyList = PolicyList.getInstance(); DataTable dt = policyList.ToDataTable(_account); foreach (DataRow row in dt.Rows) { int idPolicy; int.TryParse(row.ItemArray[0].ToString(), out idPolicy); Policy policy = policyList.getItem(idPolicy); if (_account.IsPolicyKaskoAndPayment2()) { dgvPolicy.Rows.Add(row.ItemArray[0], row.ItemArray[7], row.ItemArray[3], row.ItemArray[12]); } else { dgvPolicy.Rows.Add(row.ItemArray[0], row.ItemArray[7], row.ItemArray[3], row.ItemArray[8]); } } FormatDGV(); tbSum.Text = _account.Sum.ToString(); ChangeEnableComboBoxes(); }
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 FillTable() { CreateColumnsTable(); PolicyList policyList = PolicyList.getInstance(); DataTable dt = policyList.ToDataTable(_policyType, _idOwner, _paymentNumber); foreach (DataRow row in dt.Rows) { int idPolicy; int.TryParse(row.ItemArray[0].ToString(), out idPolicy); Policy policy = policyList.getItem(idPolicy); if (_account.IsPolicyKaskoAndPayment2()) { dgvPolicy.Rows.Add(policy.IsInList(_account), idPolicy, row.ItemArray[7], row.ItemArray[3], row.ItemArray[12]); } else { dgvPolicy.Rows.Add(policy.IsInList(_account), idPolicy, row.ItemArray[7], row.ItemArray[3], row.ItemArray[8]); } } }
public void showNotice(DTP dtp) { _excelDoc = openDocumentExcel("Извещение о страховом случае"); Owners owners = Owners.getInstance(); _excelDoc.setValue(6, 5, owners.getItem(Convert.ToInt32(_car.ownerID))); //страхователь _excelDoc.setValue(7, 6, "а/я 34, 196128"); //почтовый адрес _excelDoc.setValue(8, 7, "320-40-04"); //телефон DriverCarList driverCarList = DriverCarList.getInstance(); Driver driver = driverCarList.GetDriver(_car, dtp.Date); PassportList passportList = PassportList.getInstance(); Passport passport = passportList.getLastPassport(driver); if (passport.Number != string.Empty) { string number = passport.Number; string[] numbers = number.Split(' '); _excelDoc.setValue(10, 3, numbers[0]); //серия _excelDoc.setValue(10, 6, numbers[1]); //номер _excelDoc.setValue(11, 3, passport.GiveOrg); //кем выдан _excelDoc.setValue(12, 4, passport.GiveDate.ToShortDateString()); //дата выдачи } PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(_car, PolicyType.КАСКО); _excelDoc.setValue(14, 6, policy.Number); //полис _excelDoc.setValue(16, 6, string.Concat(_car.Mark.Name, " ", _car.info.Model)); //марка а/м _excelDoc.setValue(18, 6, _car.Grz); //рег номер а/м _excelDoc.setValue(20, 6, _car.vin); //вин _excelDoc.setValue(22, 6, dtp.Date.ToShortDateString()); //дата дтп _excelDoc.setValue(27, 2, driver.GetName(NameType.Full)); //водитель фио Regions regions = Regions.getInstance(); _excelDoc.setValue(29, 3, regions.getItem(Convert.ToInt32(dtp.IDRegion))); //город _excelDoc.setValue(31, 14, dtp.Damage); //повреждения _excelDoc.setValue(33, 2, dtp.Facts); //обстоятельства происшествия //SsDTP ssDTP = SsDTPList.getInstance().getItem(_car.Mark); //_excelDoc.setValue(63, 11, ssDTP.ServiceStantion); //DateTime date = DateTime.Today; //MyDateTime myDate = new MyDateTime(date.ToShortDateString()); //_excelDoc.setValue(71, 3, string.Concat("« ", date.Day.ToString(), " »")); //_excelDoc.setValue(71, 4, myDate.MonthToStringGenitive()); //_excelDoc.setValue(71, 8, date.Year.ToString().Substring(2, 2)); _excelDoc.Show(); }
private void _dgvPolicy_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idPolicy = Convert.ToInt32(_dgvPolicy.Rows[e.RowIndex].Cells[0].Value); Policy policy = _policyList.getItem(idPolicy); if ((e.ColumnIndex == 4) && (policy.File != string.Empty)) { WorkWithFiles.OpenFile(policy.File); } else { Policy_AddEdit pAE = new Policy_AddEdit(policy); pAE.ShowDialog(); loadPolicy(); } }
private void btnDelPolicy_Click(object sender, EventArgs e) { if (MessageBox.Show("Удалить полис из согласования?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int idPolicy = Convert.ToInt32(dgvPolicy.Rows[dgvPolicy.SelectedCells[0].RowIndex].Cells[0].Value); PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(idPolicy); policy.ClearAccountID(_account); FillTable(); } }
private void SetFormatPolicy() { SetColumnHeaderText("Pay", "Оплата, руб"); SetColumnHeaderText("LimitCost", "Страховая стоимость/ Лимит ответственности, руб"); SetColumnHeaderText("Pay2", "Оплата (2 платеж), руб"); SetCellFormat("Pay", "N2"); SetCellFormat("LimitCost", "N0"); SetCellFormat("Pay2", "N2"); SetRightAligment("Pay"); SetRightAligment("LimitCost"); SetRightAligment("Pay2"); PolicyList policyList = PolicyList.getInstance(); foreach (DataGridViewRow row in _dgv.Rows) { int id; int.TryParse(row.Cells[0].Value.ToString(), out id); Policy policy = policyList.getItem(id); if (policy.File != string.Empty) { row.Cells["Номер полиса"].Style.BackColor = Color.MediumPurple; } if ((policy.Type == PolicyType.КАСКО) && (policy.IsAgreed(2))) { row.Cells["Pay2"].Style.BackColor = Color.MediumPurple; } if (policy.IsAgreed(1)) { row.Cells["Pay"].Style.BackColor = Color.MediumPurple; } if (policy.DateEnd < DateTime.Today) { row.DefaultCellStyle.BackColor = BBColors.bbGray5; } if (policy.File != string.Empty) { row.Cells["Тип полиса"].Style.BackColor = BBColors.bbGreen3; } } }
private void FormatDGV() { PolicyList policyList = PolicyList.getInstance(); foreach (DataGridViewRow row in dgvPolicy.Rows) { int idPolicy = Convert.ToInt32(row.Cells[0].Value); Policy policy = policyList.getItem(idPolicy); if (policy.File != string.Empty) { row.Cells[1].Style.BackColor = Color.Purple; } } }
public void BindWithPolicy(int idPolicy, int payment) { if (IsNotSaved()) { Save(); } PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(idPolicy); if (IsPolicyKaskoAndPayment2()) { policy.SetAccountID(ID, payment); } else { policy.SetAccountID(ID, payment); } }
private void dgvPolicy_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idPolicy = Convert.ToInt32(dgvPolicy.Rows[dgvPolicy.SelectedCells[0].RowIndex].Cells[0].Value); PolicyList policyList = PolicyList.getInstance(); Policy policy = policyList.getItem(idPolicy); if ((e.ColumnIndex == 1) && (policy.File != string.Empty)) { WorkWithFiles.openFile(policy.File); } else { Policy_AddEdit policyAE = new Policy_AddEdit(policy); if (policyAE.ShowDialog() == DialogResult.OK) { FillTable(); } } }
private ToolStripMenuItem CreateShowPolicyKasko() { ToolStripMenuItem item = CreateItem("Полис Каско"); item.Click += delegate { Car car = _dgvMain.GetCar(); if (car == null) { return; } PolicyList policyList = PolicyList.getInstance(); Policy kasko = policyList.getItem(car, PolicyType.КАСКО); if (!string.IsNullOrEmpty(kasko.File)) { WorkWithFiles.openFile(kasko.File); } }; return(item); }