Ejemplo n.º 1
0
 public ViewEditYouthForm(Youth youth)
 {
     InitializeComponent();
     selectedYouth = youth;
 }
Ejemplo n.º 2
0
 public static bool UpdateYouth(Youth youth)
 {
     try
     {
         using(SQLiteConnection conn = new SQLiteConnection(Globals.ConnectionString))
         {
             int isActive = 1;
             if(youth.IsActive == false)
             {
                 isActive = 0;
             }
             string UpdateYouthCommandString = 
                 string.Format("UPDATE Youth SET FirstName = '{0}', LastName = '{1}', FullName = '{2}', IsActive = {3} WHERE YouthID = {4}",
                 youth.FirstName, youth.LastName, youth.FullName, isActive, youth.YouthID);
             using(SQLiteCommand UpdateYouthCommand = new SQLiteCommand(UpdateYouthCommandString, conn))
             {
                 conn.Open();
                 UpdateYouthCommand.ExecuteNonQuery();
                 return true;
             }
         }
     }
     catch(Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(string.Format("Unable to update youth in the database.  \nError message: ", ex.Message));
         return false;
     }
 }