private void AddCityButtonClick(object sender, EventArgs e) { City addedCity = new City(); InputSanitizer inputSanitizer = new InputSanitizer(); addedCity.Name = inputSanitizer.Names(CityTextBox.Text); addedCity.Region = inputSanitizer.Names(RegionTextBox.Text); addedCity.Country = inputSanitizer.Names(CountryTextBox.Text); addedCity.Attrib = AttributeCheckbox.Checked; DBActions dbAct = new DBActions(); string msg = dbAct.AddCity(addedCity); MessageBox.Show(msg); }
public string SendCity() { City city = new City(); DBActions dbActions = new DBActions(); string msg = ""; string table = "Cities"; int lastId = dbActions.LastId(table); city = dbActions.GetCity(lastId); msg = dbActions.AddCity(city); string delRes = dbActions.DeleteLocal(lastId, table); if (delRes != Resources.Success) { msg = string.Concat("Deletion from local DB failed: ", delRes); } DBActions.CheckCitiesEmptiness(); return msg; }