private void EditCity() { if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text)) { //Todo EditedBy var lockcount = GetLockCount(_cityId); TMF.Reports.Model.City city = new TMF.Reports.Model.City() { Id = _cityId, Description = TextBoxDescription.Text, EditedBy = _currentUser.Id.ToString(), DocDate = DateTime.Now, Show = 1, LockCount = lockcount }; var updateCity = _city.Update(new SmartDB(), city); bool flag = updateCity.Code == ErrorEnum.NoError; if (flag) { MessageBox.Show("City Updated"); ResetControls(); BindCityWithDataGrid(); } else { MessageBox.Show(updateCity.Message); } } else { MessageBox.Show("No city to edit or Contact Admin."); } }
private void SaveCity() { if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text)) { TMF.Reports.Model.City city = new TMF.Reports.Model.City() { //TODO User id for CreatedBy Id = Guid.NewGuid().ToString("N"), Description = TextBoxDescription.Text, TotalNumberOfMeters = 0, CreatedBy = _currentUser.Id.ToString(), DocDate = DateTime.Now, Show = 1, LockCount = 0 }; var createCity = _city.Create(new SmartDB(), ref city); bool flag = createCity.Code == ErrorEnum.NoError; if (flag) { MessageBox.Show("City Created"); ResetControls(); BindCityWithDataGrid(); } else { MessageBox.Show(createCity.Code.ToString()); } } else { MessageBox.Show("No city to save or Contact Admin."); } }