Exemplo n.º 1
0
 public static TrancheHoraire getAjoutTrancheHoraire(TrancheHoraire a)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         string insert = "";
         NpgsqlCommand cmd = new NpgsqlCommand(insert, con);
         cmd.ExecuteNonQuery();
         a.Id = getCurrent();
         return a;
     }
     catch
     {
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 2
0
 public static List<TrancheHoraire> getListTrancheHoraire(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<TrancheHoraire> l = new List<TrancheHoraire>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 TrancheHoraire a = new TrancheHoraire();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Reference = lect["reference"].ToString();
                 a.Critere = lect["critere"].ToString();
                 a.HeureDebut = Convert.ToDateTime((lect["heure_debut"] != null) ? (!lect["heure_debut"].ToString().Trim().Equals("") ? lect["heure_debut"].ToString().Trim() : "00:00:0000") : "00:00:0000");
                 a.HeureFin = Convert.ToDateTime((lect["heure_fin"] != null) ? (!lect["heure_fin"].ToString().Trim().Equals("") ? lect["heure_fin"].ToString().Trim() : "00:00:0000") : "00:00:0000");
                 a.Actif = Convert.ToBoolean((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false");
                 a.Update = true;
                 l.Add(a);
             }
             lect.Close();
         }
         return l;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 3
0
 public TrancheHoraireBll(TrancheHoraire unTrancheHoraire)
 {
     tranche = unTrancheHoraire;
 }
Exemplo n.º 4
0
 public static TrancheHoraire getOneTrancheHoraire(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_type_creneau_horaire where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         TrancheHoraire a = new TrancheHoraire();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Reference = lect["reference"].ToString();
                 a.Critere = lect["critere"].ToString();
                 a.HeureDebut = Convert.ToDateTime((lect["heure_debut"] != null) ? (!lect["heure_debut"].ToString().Trim().Equals("") ? lect["heure_debut"].ToString().Trim() : "00:00:0000") : "00:00:0000");
                 a.HeureFin = Convert.ToDateTime((lect["heure_fin"] != null) ? (!lect["heure_fin"].ToString().Trim().Equals("") ? lect["heure_fin"].ToString().Trim() : "00:00:0000") : "00:00:0000");
                 a.Actif = Convert.ToBoolean((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false");
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Exemplo n.º 5
0
 public static bool getUpdateTrancheHoraire(TrancheHoraire a)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         string update = "";
         NpgsqlCommand Ucmd = new NpgsqlCommand(update, con);
         Ucmd.ExecuteNonQuery();
         return true;
     }
     catch (Exception e)
     {
         Messages.Exception(e);
         return false;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }