private void CreateNewBattery(string maintenanceType) { if (!IsMoney(PriceTextBox.Text)) { MessageBox.Show("Price must be a number", GlobalConstants.MessageBoxTopInfo); return; } if (!IsKilometers(KilometersOnChangeTextBox.Text)) { MessageBox.Show("Kilometers must be a number", GlobalConstants.MessageBoxTopInfo); return; } CreateBatteryInputModel model = new CreateBatteryInputModel { Make = MakeTextBox.Text, MotorcycleId = GlobalVariables.CurrentBikeId, KilometersOnChange = int.Parse(KilometersOnChangeTextBox.Text), ChangeDate = ChangeDateDatePicker.Value.ToString("dd.MM.yyyy"), Price = double.Parse(PriceTextBox.Text), }; batteryService.CreateBattery(model); AddKilometersAndMonthsDriven(maintenanceType, model.MotorcycleId, model.ChangeDate, model.KilometersOnChange); }