Пример #1
0
 private void listAllPlancher()
 {
     SQLQuery = "SELECT * FROM plancher WHERE statut = 1";
     conn.LiteCo.Open();
     using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo))
     {
         try
         {
             using (SQLiteDataReader reader = command.ExecuteReader())
             {
                 Trace.Write("#### GET PLANCHERS DATA #### \n");
                 while (reader.Read())
                 {
                     Byte[]   data     = (Byte[])reader.GetValue(2);
                     Plancher plancher = new Plancher
                                         (
                         reader.GetString(0),
                         reader.GetInt32(1),
                         reader.GetBoolean(3),
                         ToImage(data));
                     Listeplancher.Add(plancher);
                 }
             }
             Trace.Write("#### GET PLANCHERS DATA SUCCESS #### \n");
         }
         catch (SQLiteException ex)
         {
             Trace.WriteLine(" \n ################################################# ERREUR RECUPERATION PLANCHERS ################################################# \n" + ex.ToString() + "\n");
         }
     }
     conn.LiteCo.Close();
 }
Пример #2
0
        /// <summary>
        /// Méthode qui permet de récupérer les planchers par id/type
        /// </summary>
        /// <param name="type">type du plancher recherché</param>
        /// <returns></returns>
        private Plancher getPlancherByType(string type)
        {
            Plancher plancher = new Plancher();

            SQLQuery = "SELECT * FROM plancher WHERE typePlancher = @type;";
            using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo))
            {
                command.Parameters.AddWithValue("@type", type);

                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    try
                    {
                        while (reader.Read())
                        {
                            Byte[] data = (Byte[])reader.GetValue(2);
                            plancher = new Plancher
                                       (
                                reader.GetString(0),
                                reader.GetInt32(1),
                                reader.GetBoolean(3),
                                ToImage(data)
                                       );
                        }
                    }
                    catch (SQLiteException ex)
                    {
                        Trace.WriteLine(ex.ToString());
                    }
                    return(plancher);
                }
            }
        }