public static List<Emplacement> getListEmplacement(String query) { NpgsqlConnection con = Connexion.Connection(); try { List<Emplacement> l = new List<Emplacement>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { Emplacement a = new Emplacement(); a.Id = Convert.ToInt64(lect["id"].ToString()); a.Code = lect["code"].ToString(); a.Designation = lect["designation"].ToString(); a.Defaut = (Boolean)((lect["defaut"] != null) ? (!lect["defaut"].ToString().Trim().Equals("") ? lect["defaut"] : false) : false); //a.Articles = BLL.ArticleDepotBll.Liste("select * from yvs_base_article_depot where emplacement = " + a.Id); a.Update = true; l.Add(a); } lect.Close(); } return l; } catch (NpgsqlException e) { Messages.Exception(e); return null; } finally { Connexion.Deconnection(con); } }
public static Emplacement getAjoutEmplacement(Emplacement 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 static bool getUpdateEmplacement(Emplacement 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); } }
public EmplacementBll(Emplacement unEmplacement) { emplacement = unEmplacement; }