private void LoadData() { try { var list = transportLogic.Read(null); if (list != null) { dataGridViewTransports.DataSource = list; dataGridViewTransports.Columns[0].Visible = false; dataGridViewTransports.Columns[1].Visible = false; dataGridViewTransports.Columns[8].Visible = false; dataGridViewTransports.Columns[9].Visible = false; dataGridViewTransports.Columns[10].Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка загрузки данных по транспорту", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadData() { try { var list = _logicT.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].Visible = false; dataGridView.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void buttonRoute_Click(object sender, EventArgs e) { var list = _logicT.Read(new TransportBindingModel { Routefrom = dataGridViewRoute.SelectedRows[0].Cells[1].Value.ToString(), Routeto = dataGridViewRoute.SelectedRows[0].Cells[2].Value.ToString() }); if (list == null) { return; } dataGridViewTransport.DataSource = list; dataGridViewTransport.Columns[0].Visible = false; dataGridViewTransport.Columns[1].Visible = false; RouteId = Convert.ToInt32(dataGridViewRoute.SelectedRows[0].Cells[0].Value); MessageBox.Show("Успешно", "Сохранено", MessageBoxButtons.OK, MessageBoxIcon.Information); // dataGridViewTransport.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; RouteId = Convert.ToInt32(dataGridViewRoute.SelectedRows[0].Cells[0].Value); }
private void FormTransport_Load(object sender, EventArgs e) { var list = _logicR.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[3].Visible = false; dataGridView.Columns[4].Visible = false; } if (Id.HasValue) { var transport = _logicT.Read(new TransportBindingModel { Id = Id.Value })?[0]; if (transport == null) { return; } textBoxViewTransport.Text = transport.Viewtransport; textBoxPrice.Text = transport.Priceticket.ToString(); } }
private void LoadDataForCrOrUpd() { if (idForShow.HasValue) { try { var view = visitLogic.Read(new VisitBindingModel { Id = idForShow })?[0]; if (view != null) { textBoxDate.Text = view.Date.ToString(); textBoxTotalSum.Text = view.TotalSum.ToString(); var transport = transportLogic.Read(new TransportBindingModel { Id = view.TransportId })?[0]; if (transport != null) { textBoxTransportInfo.Text = transport.Number + " " + transport.Label + " " + transport.Model + " " + transport.Color; var client = clientLogic.Read(new ClientBindingModel { Id = transport.ClientId })?[0]; if (client != null) { textBoxClientFIO.Text = client.Surname + " " + client.Name + " " + client.Fathername; } } try { if (view.UsedMaterials != null) { dataGridViewMaterials.Rows.Clear(); foreach (var rec in view.UsedMaterials) { dataGridViewMaterials.Rows.Add(new object[] { rec.Key, rec.Value.Item1, rec.Value.Item2 }); } } if (view.Worktypes != null) { dataGridViewWorktypes.Rows.Clear(); foreach (var rec in view.Worktypes) { dataGridViewWorktypes.Rows.Add(new object[] { rec.Key, rec.Value }); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }