示例#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);
        }
示例#2
0
        public string GetPassword()
        {
            string password = null;

            SportBetDbContext context = GetContext();

            AdminPasswordEntity adminPasswordEntity = context.AdminPassword.SingleOrDefault();

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

            return(password);
        }
示例#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);
            }
        }
示例#4
0
 public UnitOfWork()
 {
     this.context = new SportBetDbContext();
 }