public static List<PlanCommission> getListPlanCommission(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<PlanCommission> l = new List<PlanCommission>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 PlanCommission a = new PlanCommission();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Nature = lect["nature_commission"].ToString();
                 a.Reference = lect["reference"].ToString();
                 a.Commissions = BLL.CommissionBll.Liste("select * from yvs_com_commission where plan = " + 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 PlanCommission getAjoutPlanCommission(PlanCommission 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 PlanCommission getOnePlanCommission(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_plan_commission where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         PlanCommission a = new PlanCommission();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Nature = lect["nature_commission"].ToString();
                 a.Reference = lect["reference"].ToString();
                 a.Commissions = BLL.CommissionBll.Liste("select * from yvs_com_commission where plan = " + a.Id);
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
 public static bool getUpdatePlanCommission(PlanCommission 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 PlanCommissionBll(PlanCommission unPlanCommission)
 {
     plan = unPlanCommission;
 }