Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace DataAccess
- {
- public class Database : IDatabase
- {
- Connection connection;
- string Name;
- public Database(string name)
- {
- this.Name = name;
- }
- public IConnection GetNewConnection(string userName, string password)
- {
- connection = new Connection(userName, password);
- connection.Open();
- return connection;
- }
- public List<Dictionary<string, object>> GetData(IConnection connection)
- {
- if (this.connection.IsOpen() == false)
- {
- throw new ConnectionClosedException();
- }
- else
- {
- List<Dictionary<string, object>> t = new List<Dictionary<string, object>>();
- for (int i = 1; i < 10; i++)
- {
- Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("pesel: ", i);
- d.Add("imię: ", "imię_" + i);
- d.Add("nazwisko: ", "nazwisko_" + i);
- t.Add(d);
- }
- return t;
- }
- }
- public string GetDatabaseName()
- {
- return Name;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement