public string SendPerson() { Person person = new Person(); DBActions dbActions = new DBActions(); string msg = ""; string table = "People"; int lastId = dbActions.LastId(table); person = dbActions.GetPerson(lastId); msg = dbActions.PersonAdd(person); string delRes = dbActions.DeleteLocal(lastId, table); if (delRes != Resources.Success) { msg = string.Concat("Deletion from local DB failed: ", delRes); } DBActions.CheckPeopleEmptiness(); return msg; }
private void AddPeopleButton_Click(object sender, EventArgs e) { InputSanitizer inputSanitizer = new InputSanitizer(); Person addedPerson = new Person(); addedPerson.FIO = inputSanitizer.Names(FIOTextBox.Text); try { addedPerson.CityId = Convert.ToInt32(inputSanitizer.DigitsOnly(CityIDTextBox.Text)); DBActions dbActions = new DBActions(); string res = dbActions.PersonAdd(addedPerson); MessageBox.Show(res, "Client message"); } catch (Exception ex) { MessageBox.Show(Resources.IdIncorrect + ex.Message); } }