예제 #1
0
 public void Update(Administrator administrator)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         Update(db, administrator);
         db.SubmitChanges();
     }
 }
예제 #2
0
 /// <summary>
 /// Add an administrator to the database using the given database context
 /// The administrator will be added within the context's currently active transaction 
 /// </summary>
 /// <param name="administrator">administrator object</param>
 public Administrator Add(Administrator administrator)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         Add(db, administrator);
         db.SubmitChanges();
         return administrator;
     }
 }
예제 #3
0
 public Administrator(Administrator that)
 {
     this.CreateDate = that.CreateDate;
     this.ID = that.ID;
     this.PasswordHash = that.PasswordHash;
     this.Status = that.Status;
     this.UpdateDate = that.UpdateDate;
     this.Username = that.Username;
 }
예제 #4
0
 private static void Print(Administrator administrator)
 {
     CommandUI.Print("Username", administrator.Username);
     CommandUI.Print("ID", administrator.ID);
     CommandUI.Print("Status", administrator.Status);
     CommandUI.Print("CreateDate", administrator.CreateDate);
     CommandUI.Print("UpdateDate", administrator.UpdateDate);
 }
예제 #5
0
        private static void Update(ConfigDatabase db, Administrator administrator)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            if (administrator == null)
            {
                throw new ConfigStoreException(ConfigStoreError.InvalidAdministrator);
            }

            Administrator update = new Administrator(administrator);

            db.Administrators.Attach(update);
            update.UpdateFrom(administrator);
        }
예제 #6
0
        //public bool CheckPasswordHash(string username, string passwordHash)
        //{
        //    using (ConfigDatabase db = this.Store.CreateContext())
        //    {
        //        return CheckPasswordHash(db, username, passwordHash);
        //    }
        //}

        private static void Add(ConfigDatabase db, Administrator administrator)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }

            if (administrator == null)
            {
                throw new ConfigStoreException(ConfigStoreError.InvalidAdministrator);
            }

            db.Administrators.InsertOnSubmit(administrator);
        }
예제 #7
0
 public void UpdateFrom(Administrator that)
 {
     this.PasswordHash = that.PasswordHash;
     this.Status = that.Status;
     this.UpdateDate = DateTimeHelper.Now;
 }