private void GetPage() { try { var list = logic.Read(limit, offset); if (list.Count != 0) { dataGridView.DataSource = list; int totalRowHeight = dataGridView.ColumnHeadersHeight; foreach (DataGridViewRow row in dataGridView.Rows) { totalRowHeight += row.Height; } dataGridView.Height = totalRowHeight; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <ServiceViewModel> GetOrderServices(OrderViewModel order) { var services = new List <ServiceViewModel>(); foreach (var service in order.OrderServices) { services.Add(serviceLogic.Read(new ServiceBindingModel { Id = service.ServiceId }).FirstOrDefault()); } return(services); }
private void FormService_Load(object sender, EventArgs e) { try { var view = logic.Read(new ServiceBindingModel { Id = id }); if (view != null) { textBoxName.Text = view.ServiceName; textBoxPrice.Text = view.Price.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadData() { try { var list = logic.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormSpecialistService_Load(object sender, EventArgs e) { List <ServiceViewModel> services = serviceLogic.Read(null, null); if (services != null) { comboBoxService.DisplayMember = "ServiceName"; comboBoxService.ValueMember = "Id"; comboBoxService.DataSource = services; comboBoxService.SelectedItem = null; } List <SpecialistViewModel> specialists = specialistLogic.Read(null, null); if (specialists != null) { comboBoxSpecialist.DisplayMember = "FirstName"; comboBoxSpecialist.ValueMember = "Id"; comboBoxSpecialist.DataSource = specialists; comboBoxSpecialist.SelectedItem = null; } }
public IActionResult Service() { ViewBag.Services = _service.Read(null); return(View()); }
public IActionResult CreateOrder() { ViewBag.OrderServices = _serviceLogic.Read(null); return(View()); }