public void AddContact(CustomerBaseRepresentation firm, CustomerBaseRepresentation agent) { using (ISQLConnection dataSource = DataSource) { dataSource.AddContact(RepresentationConverter.convertCustomer(firm), RepresentationConverter.convertCustomer(agent)); } }
public RentalGroup_Representation GetRentalGroupById(long id) { using (ISQLConnection dataSource = DataSource) { return(RepresentationConverter.convertRentalGroup(dataSource.GetRentalGroupById(id))); } }
public CityRepresentation GetCityById(long id) { using (ISQLConnection dataSource = DataSource) { return(RepresentationConverter.convertCity(dataSource.GetCityById(id))); } }
public long AddTool(ToolRepresentation tool) { using (ISQLConnection dataSource = DataSource) { return(dataSource.AddTool(RepresentationConverter.convertTool(tool))); } }
public void UpdateTool(ToolRepresentation tool) { using (ISQLConnection datasource = DataSource) { datasource.UpdateTool(RepresentationConverter.convertTool(tool)); } }
public RentalRepresentation GetLastRentalByToolId(long toolId) { using (ISQLConnection dataSource = DataSource) { return(RepresentationConverter.convertRental(dataSource.GetLastRentalByToolId(toolId))); } }
public List <ToolRepresentation> GetAllTools() { using (ISQLConnection dataSource = DataSource) { return(dataSource.GetAllTools().Select(t => RepresentationConverter.convertTool(t)).ToList()); } }
public void UpdateRentalGroup(RentalGroup_Representation rentalGroup) { using (ISQLConnection dataSource = DataSource) { dataSource.UpdateRentalGroup(RepresentationConverter.convertRentalGroup(rentalGroup)); } }
public List <PayTypeRepresentation> GetPayTypes() { using (ISQLConnection dataSource = DataSource) { return(dataSource.GetPayTypes().Select(pt => RepresentationConverter.convertPayType(pt)).ToList()); } }
public CustomerBaseRepresentation GetCustomerById(long id) { using (ISQLConnection dataSource = DataSource) { return(RepresentationConverter.convertCustomer(dataSource.GetCustomerById(id))); } }
public void DeleteCustomerById(long id) { using (ISQLConnection dataSource = DataSource) { dataSource.DeleteCustomerById(id); } }
public void DeleteRentalById(long id) { using (ISQLConnection dataSource = DataSource) { dataSource.DeleteRentalById(id); } }
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 void AddRental(RentalRepresentation rental) { using (ISQLConnection dataSource = DataSource) { dataSource.AddRental(RepresentationConverter.convertRental(rental)); } }
public List <CityRepresentation> GetAllCities() { using (ISQLConnection dataSource = DataSource) { return(dataSource.GetAllCities().Select(c => RepresentationConverter.convertCity(c)).ToList()); } }
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()); } }
private DataProxy() { using (ISQLConnection dataSource = DataSource) { customersVersion = dataSource.GetCustomersVersion(); toolsVersion = dataSource.GetToolsVersion(); rentalVersion = dataSource.GetRentalVersion(); } dbChangeCheckTimer = new Timer(10000); dbChangeCheckTimer.Elapsed += (s, a) => { dbChangeCheckTimer.Stop(); using (ISQLConnection dataSource = DataSource) { var actVersion = dataSource.GetCustomersVersion(); if (customersVersion != actVersion) { customersVersion = actVersion; OnCustomersChanged(EventArgs.Empty); } actVersion = dataSource.GetToolsVersion(); if (toolsVersion != actVersion) { toolsVersion = actVersion; OnToolsChanged(EventArgs.Empty); } actVersion = dataSource.GetRentalVersion(); if (rentalVersion != actVersion) { rentalVersion = actVersion; OnRentalChanged(EventArgs.Empty); } } dbChangeCheckTimer.Start(); }; dbChangeCheckTimer.Start(); }
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); } }
/// <summary> /// Constructeur permetant la configuration de la connexion a la base de donnée /// </summary> /// <param name="cls"> /// Objet de configuration de connexion de la base de donnée /// créer par l'utilisateur /// </param> public DboMapper(DboConfiguration cls) { // Vérification du SGBD switch (cls.GetDbType()) { case DboConfiguration.TypeSGBD.MySQL: // Création d'une connexion à une base de donnée MYSQL conn = new ORMMySQL(cls.GetConnectionString()); conn.Connection(); break; case DboConfiguration.TypeSGBD.POSTGRESQL: // Création d'une connexion à une base de donnée MYSQL conn = new ORMPostGreSQL(cls.GetConnectionString()); conn.Connection(); break; case DboConfiguration.TypeSGBD.SQLSERVER: // Création d'une connexion àune base de donnée SqlServer conn = new ORMSqlServer(cls.GetConnectionString()); break; } }
public CustomerRepository(IConfiguration configuration, ISQLConnection connection) { _configuration = configuration; _connection = connection; }
/** * */ public API_SQL_Connection(ISQLConnection iConnection) { mISQLConnection = iConnection; }
public ItemRepository(IConfiguration configuration, ISQLConnection connection) { _configuration = configuration; _connection = connection; }
public SqLiteRepository(ISQLConnection connectionFactory) { connection = connectionFactory.GetConnection(); CreateTables(); }
public DatabaseHelper(ISQLConnection sqlConnection) { conn = sqlConnection.GetConnection(); conn.CreateTableAsync <Contacto>(); }
protected override void OnConfiguring(DbContextOptionsBuilder options) { _Conexao = ConexaoFactory.GetConexao(); options.UseSqlServer(_Conexao.SQLServerString(LiraConnection.Enum.SqlServer.Ecommerce, true)); }
public void OneTimeSetUp() { factory = Substitute.For <ISQLConnection>(); connection = new SQLiteConnection(platform, testDatabase); factory.GetConnection().Returns(connection); }