/// <summary>
 /// Initializes a new instance of the <see cref="RepositoryDatabase"/> class.
 /// Creates a database repository.
 /// Requires that the data provider is connected to a database.
 /// All queries will be forwarded to the data provider.
 /// </summary>
 /// </param>
 /// </param>
 public RepositoryDatabase(
     IDatabaseUtility databaseUtility,
     IConvertedPokerHandInserter convertedPokerHandInserter,
     IConvertedPokerHandRetriever convertedPokerHandRetriever)
 {
     _databaseUtility             = databaseUtility;
     _convertedPokerHandRetriever = convertedPokerHandRetriever;
     _convertedPokerHandInserter  = convertedPokerHandInserter;
 }
示例#2
0
        public Authenticate(IDatabaseUtility connection)
        {
            this.connection = connection;
            this.user       = new User(this.connection);

            try
            {
                HttpCookie cusername = HttpContext.Current.Request.Cookies["username"];
                HttpCookie cpassword = HttpContext.Current.Request.Cookies["password"];

                if (cusername == null || cpassword == null)
                {
                    HttpCookie cun = new HttpCookie("username");
                    cun.Expires  = DateTime.Now.AddMonths(-1);
                    cun.HttpOnly = true;
                    HttpContext.Current.Response.Cookies.Add(cun);
                    HttpCookie cpw = new HttpCookie("password");
                    cpw.Expires  = DateTime.Now.AddMonths(-1);
                    cpw.HttpOnly = true;
                    HttpContext.Current.Response.Cookies.Add(cpw);
                }
                else
                {
                    string username = cusername.Value;
                    string password = cpassword.Value;

                    if (!this.user.Login(username, password))
                    {
                        HttpCookie cun = new HttpCookie("username");
                        cun.Expires  = DateTime.Now.AddMonths(-1);
                        cun.HttpOnly = true;
                        HttpContext.Current.Response.Cookies.Add(cun);
                        HttpCookie cpw = new HttpCookie("password");
                        cpw.Expires  = DateTime.Now.AddMonths(-1);
                        cpw.HttpOnly = true;
                        HttpContext.Current.Response.Cookies.Add(cpw);
                    }
                }
            }catch (DBException e)
            {
                string s = e.Message;
            }
        }
示例#3
0
 public PostListModel(IDatabaseUtility connection) : this()
 {
     this.connection = connection;
 }
示例#4
0
 public void SetConnection(IDatabaseUtility connection)
 {
     this.connection = connection;
 }
示例#5
0
 public PostImage(IDatabaseUtility connection) : this()
 {
     this.connection = connection;
 }
示例#6
0
文件: User.cs 项目: mobi170296/news
 public User(IDatabaseUtility connection) : this()
 {
     this.connection = connection;
 }
示例#7
0
 public CategoryListModel(IDatabaseUtility connection) : this()
 {
     this.connection = connection;
 }
示例#8
0
 public ConvertedPokerHandInserter(IPokerHandStringConverter pokerHandStringConverter, IDatabaseUtility databaseUtility)
 {
     _databaseUtility          = databaseUtility;
     _pokerHandStringConverter = pokerHandStringConverter;
 }