Beispiel #1
0
        public void Reconnect(string login, string password)
        {
            if (context != null)
            {
                context.Dispose();
            }

            string connectionString = String.Format("Server=127.0.0.1;Port=5432;Database=Bets;User Id={0};Password={1};", login, password);

            context = new SportBetDbContext(connectionString);
        }
Beispiel #2
0
        public string GetPassword()
        {
            string password = null;

            SportBetDbContext context = GetContext();

            AdminPasswordEntity adminPasswordEntity = context.AdminPassword.SingleOrDefault();

            if (adminPasswordEntity != null)
            {
                password = adminPasswordEntity.Value;
            }

            return(password);
        }
Beispiel #3
0
        public void SetPassword(string value)
        {
            SportBetDbContext context = GetContext();

            AdminPasswordEntity adminPasswordEntity = context.AdminPassword.SingleOrDefault();

            if (adminPasswordEntity != null)
            {
                adminPasswordEntity.Value = value;
            }
            else
            {
                adminPasswordEntity = new AdminPasswordEntity
                {
                    Value = value
                };
                context.AdminPassword.Add(adminPasswordEntity);
            }
        }
Beispiel #4
0
 public UnitOfWork()
 {
     this.context = new SportBetDbContext();
 }