public static List<ModePaiement> getListModePaiement(String query) { NpgsqlConnection con = Connexion.Connection(); try { List<ModePaiement> l = new List<ModePaiement>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { ModePaiement a = new ModePaiement(); a.Id = Convert.ToInt64(lect["id"].ToString()); a.TypePaiement = lect["type_paiement"].ToString(); a.Update = true; l.Add(a); } lect.Close(); } return l; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static ModePaiement getAjoutModePaiement(ModePaiement 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); } }
public ModePaiementBll(ModePaiement unModePaiement) { mode = unModePaiement; }
public static ModePaiement getOneModePaiement(long id) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_mode_paiement where id = " + id + ""; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); ModePaiement a = new ModePaiement(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.TypePaiement = lect["type_paiement"].ToString(); a.Update = true; } lect.Close(); } return a; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static bool getUpdateModePaiement(ModePaiement 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); } }