private void buttonSmartWatch_Click(object sender, EventArgs e) { if (textBoxName.Text == string.Empty || textBoxPrice.Text == string.Empty) { errorProviderName.SetError(textBoxName, "Please enter a value to Name field"); errorProviderPrice.SetError(textBoxPrice, "Please enter a value to Price field"); } else { errorProviderName.Clear(); errorProviderPrice.Clear(); SmartWatchDto smartWatch = new SmartWatchDto(); smartWatch.Name = textBoxName.Text; smartWatch.Price = Parsers.DecimalParse(textBoxPrice.Text); smartWatch.Description = textBoxDescription.Text; smartWatch.Manufacturer = new ProductService.ManufacturerDto { Id = ((ManufacturerService.ManufacturerDto)comboBoxManufacturer.SelectedItem).Id }; smartWatch.InterfaceForConnecting = new ProductService.InterfaceForConnectingDto { Id = ((ConnectionTypeService.InterfaceForConnectingDto)comboBoxConnectionType.SelectedItem).Id }; smartWatch.ScreenDiagonal = Parsers.DoubleParse(textBoxScreenDiagonal.Text); smartWatch.Pulsometer = checkBoxPulsometer.Checked; smartWatch.SimCard = checkBoxSimCard.Checked; _productServiceClient.AddSmartWatch(smartWatch); MessageBox.Show("Book successfully added"); Close(); } }