public void AddPerson(EF_ZMTdbEntities.Person person) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.People.AddObject(person); context.SaveChanges(); } catch (UpdateException) { throw new FaultException("Użytkownik o podanym ID istnieje. Popraw dane i spróbuj ponownie."); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void AddDevice(EF_ZMTdbEntities.Device device) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.Devices.AddObject(device); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się dodać urządzenia. Popraw dane i spróbuj ponownie")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void AddContractor(EF_ZMTdbEntities.Contractor contractor) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.Contractors.AddObject(contractor); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się dodać kontrahenta. Popraw dane i spróbuj ponownie")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void EditDevice(EF_ZMTdbEntities.Device device) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { Device originalDevice = context.Context.Devices.Single(p => p.id == device.id); context.Context.Devices.ApplyCurrentValues(device); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się edytować urządzenia. Popraw dane i spróbuj ponownie")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void DeleteContractor(EF_ZMTdbEntities.Contractor contractor) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.Contractors.Attach(contractor); context.Context.Contractors.DeleteObject(contractor); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się usunąć kontrahenta. Prawdopodobnie kontrahent nie istnieje")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void EditContractor(EF_ZMTdbEntities.Contractor contractor) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { Contractor originalContractor = context.Context.Contractors.FirstOrDefault(c => c.id == contractor.id); context.Context.Contractors.ApplyCurrentValues(contractor); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało sie edytować kontrahenta. Popraw dane i spróbuj ponownie")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void DeleteDevice(EF_ZMTdbEntities.Device device) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.Devices.Attach(device); context.Context.Devices.DeleteObject(device); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się usunąć urządzenia. Prawdopodobnie nie istnieje")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void DeletePerson(EF_ZMTdbEntities.Person person) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { context.Context.People.Attach(person); context.Context.People.DeleteObject(person); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się usunąć użytkownika. Prawdopodobnie nie istnieje")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void EditPerson(EF_ZMTdbEntities.Person person) { using (EF_ZMT_DbContext.EF_ZMT_DbContext context = new EF_ZMT_DbContext.EF_ZMT_DbContext()) { try { Person originalPerson = context.Context.People.FirstOrDefault(p => p.id == person.id); context.Context.People.ApplyCurrentValues(person); context.SaveChanges(); } catch (UpdateException) { throw new FaultException(string.Format( "Nie udało się edytować użytkownika. Popraw dane i spróbuj ponownie")); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } } }
public void EditMembershipRole(EF_ZMTdbEntities.MembershipRole role) { MembershipRoleTransactions transaction = new MembershipRoleTransactions(); transaction.EditMembershipRole(role); }
public void EditDevice(EF_ZMTdbEntities.Device device) { DeviceTransactions transaction = new DeviceTransactions(); transaction.EditDevice(device); }
public void EditPeripheralDevice(EF_ZMTdbEntities.PeripheralDevice peripheralDevice) { PeripheralDeviceTransactions transaction = new PeripheralDeviceTransactions(); transaction.EditPeripheralDevice(peripheralDevice); }
public void EditPerson(EF_ZMTdbEntities.Person person) { PersonTransactions transaction = new PersonTransactions(); transaction.EditPerson(person); }
public void DeletePerson(EF_ZMTdbEntities.Person person) { PersonTransactions transaction = new PersonTransactions(); transaction.DeletePerson(person); }
public void DeleteKind(EF_ZMTdbEntities.Kind kind) { KindTransactions transaction = new KindTransactions(); transaction.DeleteKind(kind); }
public void EditMembershipUser(EF_ZMTdbEntities.MembershipUser membershipUser) { MembershipUserTransactions transaction = new MembershipUserTransactions(); transaction.EditMembershipUser(membershipUser); }
public void EditLicence(EF_ZMTdbEntities.Licence licence) { LicenceTransactions transaction = new LicenceTransactions(); transaction.EditLicence(licence); }
public void EditSection(EF_ZMTdbEntities.Section section) { SectionTransactions transaction = new SectionTransactions(); transaction.EditSection(section); }
public void DeleteSection(EF_ZMTdbEntities.Section section) { SectionTransactions transaction = new SectionTransactions(); transaction.DeleteSection(section); }
public void EditSubgroup(EF_ZMTdbEntities.Subgroup subgroup) { SubgroupTransactions transaction = new SubgroupTransactions(); transaction.EditSubgroup(subgroup); }
public void EditFixedAsset(EF_ZMTdbEntities.FixedAsset fixedAsset) { FixedAssetTransactions transaction = new FixedAssetTransactions(); transaction.EditFixedAsset(fixedAsset); }
public void EditKind(EF_ZMTdbEntities.Kind kind) { KindTransactions transaction = new KindTransactions(); transaction.EditKind(kind); }
public void DeleteLicence(EF_ZMTdbEntities.Licence licence) { LicenceTransactions transaction = new LicenceTransactions(); transaction.DeleteLicence(licence); }
public void EditContractor(EF_ZMTdbEntities.Contractor contractor) { ContractorTransactions transaction = new FixedAssetsTransactions.ContractorTransactions(); transaction.EditContractor(contractor); }