Exemplo n.º 1
0
 public void Update(Administrator administrator)
 {
     using (ConfigDatabase db = this.Store.CreateContext())
     {
         Update(db, administrator);
         db.SubmitChanges();
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
 public void UpdateFrom(Administrator that)
 {
     this.PasswordHash = that.PasswordHash;
     this.Status = that.Status;
     this.UpdateDate = DateTimeHelper.Now;
 }