private void saveButton_Click(object sender, EventArgs e) { try { _mobile.ModelName = modelNameTextBox.Text; _mobile.IMEI = imeiTextBox.Text; _mobile.Price = priceTextBox.Text; if (String.IsNullOrEmpty(_mobile.ModelName)) { MessageBox.Show("Insert Model Name!!"); return; } if (String.IsNullOrEmpty(_mobile.IMEI)) { MessageBox.Show("Insert IMEI!!"); return; } if (_mobile.IMEI.Length < 15) { MessageBox.Show("IMEI requires exact 15 characters!"); return; } if (String.IsNullOrEmpty(_mobile.Price)) { MessageBox.Show("Insert Price!!"); return; } if (_mobileManager.isIMEIExist(_mobile)) { MessageBox.Show("IMEI already exist!"); return; } if (_mobileManager.addMobile(_mobile)) { MessageBox.Show("Mobile Information Saved!"); } } catch (Exception exception) { MessageBox.Show(exception.Message); _mobileManager.CloseConnection(); } }