public void SaveChanges() { try { context.SaveChanges(); } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error saving coupon information", exception); } }
public void SaveChanges() { tireBindingSource.EndEdit(); usageHistoryBindingSource.EndEdit(); try { context.SaveChanges(); } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error saving tire information", exception); } }
public void SaveChanges() { if (!ValidateForm()) { return; } lookUpItemBindingSource.EndEdit(); var Item = (LookupItem)lookUpItemBindingSource.DataSource; if (newMode) { var lr = (from l in _context.LookupItems select l).OrderByDescending(l => l.LookupItemId).FirstOrDefault(); Item.LookupItemId = lr.LookupItemId + 1; _context.LookupItems.AddObject(Item); } try { _context.SaveChanges(); Close(); _lookupView.RefreshList(); } catch (Exception e) { ViewHelper.ShowSaveError(); return; } }
public void SaveChanges() { tireUsageBindingSource.EndEdit(); var tireId = transaction.TireId; var tire = context.Tires.FirstOrDefault(t => t.TireId == tireId); if (this.CurrentTask == TireTask.Mount) { tire.Status = FleetHelper.TIRE_STATUS_MOUNTED; transaction.Status = FleetHelper.TIRE_STATUS_MOUNTED; } else if (CurrentTask == TireTask.Unmount) { tire.Status = FleetHelper.TIRE_STATUS_UNMOUNTED; transaction.Status = FleetHelper.TIRE_STATUS_UNMOUNTED; } try { context.SaveChanges(); } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error saving record", exception); } }
public void SaveChanges() { if (!ValidateForm()) { return; } vehicleBindingSource.EndEdit(); try { //Save the changes to the database through the context context.SaveChanges(); } catch (Exception e) { ViewHelper.ShowErrorMessage(@"Error saving vehicle information."); ErrorLogger.LogError(this, e); } }
public void SaveChanges() { couponBindingSource.EndEdit(); try { context.Coupons.AddObject(coupon); context.SaveChanges(); this.DialogResult = DialogResult.OK; } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error adding coupon information", exception); } }
public void SaveChanges() { try { maintenanceBindingSource.EndEdit(); context.Maintanances.AddObject(maintenance); context.SaveChanges(); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error occured while creating Maintenance record", exception); } }
public void SaveChanges() { this.tireBindingSource.EndEdit(); try { // Set the status of the tire to unmounted tire.Status = 2; context.Tires.AddObject(tire); context.SaveChanges(); this.DialogResult = DialogResult.OK; } catch (Exception exception) { ViewHelper.ShowErrorMessage("Error occured while adding new tire record", exception); throw; } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = ViewHelper.Conformation("Are you sure you want to delete this lookup information?"); if (result == DialogResult.Yes) { itemListBindingSource.EndEdit(); try { _context.LookupItems.DeleteObject(lookupItem); _context.SaveChanges(); ShowItems(); } catch (Exception ex) { ViewHelper.ShowErrorMessage(@"Error deleting lookup item information."); ErrorLogger.LogError(this, ex); } } }
private void AddFuelLog() { var selected = (VehicleInfo)vehicleListBindingSource.Current; var record = new FuelLog { VehicleId = selected.VehicleId }; var dialog = new FuelLogEdit(); dialog.ShowObject(record); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { using (var ctx = new FleetEntities()) { ctx.FuelLogs.AddObject(record); ctx.SaveChanges(); } } }
public void SaveChanges() { if (!ValidateForm()) { return; } vehicleBindingSource.EndEdit(); try { //If we are in new mode then we need to add the new object to the context context.Vehicles.AddObject(vehicle); //Save the changes to the database through the context context.SaveChanges(); this.DialogResult = DialogResult.OK; } catch (Exception e) { this.DialogResult = DialogResult.Cancel; ViewHelper.ShowErrorMessage(@"Error saving vehicle information."); ErrorLogger.LogError(this, e); } }
public void SaveChanges() { if (!ValidateForm()) { return; } maintenanceBindingSource.EndEdit(); maintenancePartsBindingSource.EndEdit(); activitiesBindingSource.EndEdit(); expenseBindingSource.EndEdit(); try { //Save the changes to the database through the context context.SaveChanges(); } catch (Exception e) { ViewHelper.ShowErrorMessage(@"Error saving Maintenance information."); ErrorLogger.LogError(this, e); } }