public void DeleteContact(CustomerBaseRepresentation firm, CustomerBaseRepresentation agent) { using (ISQLConnection dataSource = DataSource) { dataSource.DeleteContact(RepresentationConverter.convertCustomer(firm), RepresentationConverter.convertCustomer(agent)); } }
public void UpdateCustomer(CustomerBaseRepresentation customer) { using (ISQLConnection dataSource = DataSource) { dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(customer)); } }
public long AddCustomer(CustomerBaseRepresentation customer) { using (ISQLConnection dataSource = DataSource) { return(dataSource.AddCustomer(RepresentationConverter.convertCustomer(customer))); } }
public CustomerBaseRepresentation GetCustomerById(long id) { using (ISQLConnection dataSource = DataSource) { return(RepresentationConverter.convertCustomer(dataSource.GetCustomerById(id))); } }
public ObservableCollection <CustomerBaseRepresentation> GetContacts(CustomerBaseRepresentation firm) { using (ISQLConnection dataSource = DataSource) { List <Customers> contactList = dataSource.GetContacts(RepresentationConverter.convertCustomer(firm)); List <CustomerBaseRepresentation> contactListRep = contactList.Select(c => RepresentationConverter.convertCustomer(c)).ToList(); return(new ObservableCollection <CustomerBaseRepresentation>(contactListRep)); } }
public List <RentalGroup_Representation> GetAllRentalGroups() { using (ISQLConnection dataSource = DataSource) { List <RentalGroup_Representation> rtn = new List <RentalGroup_Representation>(); dataSource.GetAllRentalGroups().ForEach(rg => rtn.Add(RepresentationConverter.convertRentalGroup(rg))); return(rtn); } }
public List <CustomerBaseRepresentation> GetAllCustomers() { using (ISQLConnection dataSource = DataSource) { var customerList = dataSource.GetAllCustomers().Select(c => RepresentationConverter.convertCustomer(c)); // Too much time! //foreach (var customer in customerList) //{ // // TODO: fill the contact list of the customer // customer.contacts = GetContacts(customer); //} return(customerList.ToList()); } }
public static ToolRepresentation convertTool(Tools tool) { ToolRepresentation convertedTool = new ToolRepresentation() { id = tool.toolID, defaultDeposit = tool.defaultDeposit, fromDate = tool.fromDate, IDNumber = tool.IDNumber, isDeleted = tool.isDeleted, rentCounter = tool.rentCounter, rentPrice = tool.rentPrice, serialNumber = tool.serialNumber, toolManufacturer = tool.toolManufacturer, toolName = tool.toolName, toolStatus = RepresentationConverter.convertToolStatus(tool.ToolStatuses) }; return(convertedTool); }
public long AddRentalGroup(RentalGroup_Representation rentalGroup) { using (ISQLConnection dataSource = DataSource) { RentalGroups rentalGroupToAdd = RepresentationConverter.convertRentalGroup(rentalGroup); //foreach (RentalRepresentation rental in rentalGroup.rentals) //{ //rentalGroupToAdd.Rentals.Add(RepresentationConverter.convertRental(rental)); //dataSource.UpdateTool(RepresentationConverter.convertTool(rental.tool)); //dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(rental.customer)); //} rentalGroup.id = dataSource.AddRentalGroup(rentalGroupToAdd); //foreach (RentalRepresentation rental in rentalGroup.rentals) //{ // rental.group = rentalGroup; // AddRental(rental); //} return(rentalGroup.id); } }
public DbSettingsRepresentation GetDbSettings() { return(RepresentationConverter.convertDbSettings(DataSource.GetSettings())); }