Пример #1
0
 /// <summary>
 /// Modifies a person in the data base. Returns false on error or incorrect dictionary keys.
 /// </summary>
 /// <param name="userID">Type int. ID of the person</param>
 /// <param name="person">Type Dictionarty <string,string>. Collection of the person's data.</param>
 /// <returns></returns>
 public override bool RemoveUser(int userID)
 {
     try
     {
         CRUD.User CRUDPerson = new CRUD.User();
         CRUDPerson.DeleteUser(userID);
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message.ToString());
         return(false);
     }
 }
Пример #2
0
 /// <summary>
 /// Modifies a person in the data base. Returns false on error or incorrect dictionary keys.
 /// </summary>
 /// <param name="id">Type int. ID of the person</param>
 /// <param name="person">Type Dictionarty <string,string>. Collection of the person's data.</param>
 /// <returns></returns>
 public override bool ModifyPerson(int id, Dictionary <string, string> person)
 {
     try
     {
         CRUD.User        CRUDPerson = new CRUD.User();
         Persistence.User personData = Util.dict2UserWithPassword(person);
         if (personData != null)
         {
             CRUDPerson.UpdateDBData(personData.User_ID, (Persistence.User)personData);
             return(true);
         }
         else
         {
             throw new ArgumentException("One or more of the required keys were not found.");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message.ToString());
         return(false);
     }
 }
Пример #3
0
 /// <summary>
 /// Method used to save the changes in the data base.
 /// </summary>
 public void SaveChanges()
 {
     CRUD.User user = new CRUD.User();
     user.UpdateDBData(this.GetID(), this.GetUser());
 }