private void modelDataGrid_SelectionChanged(object sender, EventArgs e) { UploadNewPhoto = false; if (SelectedModel == null) { DisableButtons(); return; } modelNameTextBox.Text = SelectedModel.Name; modelDescriptionTextBox.Text = SelectedModel.Description; PictureViewUtils.LoadImageToControl(SelectedModel.Photo, modelPictureBox); costNumericUpDown.Value = (decimal)SelectedModel.Cost; sexComboBox.SelectedItem = SelectedModel.Sex; kidsCheckBox.Checked = SelectedModel.IsForKids; bool allowModify = !ShoesClientDataServices.StockRoomServices.ExistAnyStockEntryByModelId(SelectedModel.ModelId); costNumericUpDown.Enabled = allowModify; removeButton.Enabled = allowModify; updateButton.Enabled = true; shoesTypeComboBox.SelectedValue = SelectedModel.ShoesTypeId; colorCheckedListBox.Items.Clear(); if (SelectedModel.AvailablesColors.Count > 0) { SelectedModel.AvailablesColors.ForEach(dto => colorCheckedListBox.Items.Add(dto.Name, true)); } else { colorCheckedListBox.Items.Add(AVAILABLE_FOR_ALL_COLORS, true); } }
private void ReloadShoesModelPicture(ModelDto selectedModel) { this.shoesPictureBox.Image = null; if (selectedModel != null) { PictureViewUtils.LoadImageToControl(selectedModel.Photo, shoesPictureBox); } }