Exemplo n.º 1
0
 public static PlanTarifaire getAjoutPlanTarifaire(PlanTarifaire 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<PlanTarifaire> getListPlanTarifaire(String query)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         List<PlanTarifaire> l = new List<PlanTarifaire>();
         NpgsqlCommand Lcmd = new NpgsqlCommand(query, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 PlanTarifaire a = new PlanTarifaire();
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Code = lect["code"].ToString();
                 a.Actif = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                 a.Puv = (Double)((lect["puv_minimal"] != null) ? (!lect["puv_minimal"].ToString().Trim().Equals("") ? lect["puv_minimal"] : 0) : 0);
                 a.Remise = (Double)((lect["remise"] != null) ? (!lect["remise"].ToString().Trim().Equals("") ? lect["remise"] : 0) : 0);
                 a.Ristourne = (Double)((lect["ristourne"] != null) ? (!lect["ristourne"].ToString().Trim().Equals("") ? lect["ristourne"] : 0) : 0);
                 a.Remise_ = (lect["remise"] != null
                     ? (!lect["remise"].ToString().Trim().Equals("")
                     ? BLL.RemiseBll.One(Convert.ToInt64(lect["remise"].ToString()))
                     : new Remise())
                     : new Remise());
                 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 PlanTarifaireBll(PlanTarifaire unPlanTarifaire)
 {
     plan = unPlanTarifaire;
 }
Exemplo n.º 4
0
 public static bool getUpdatePlanTarifaire(PlanTarifaire 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);
     }
 }
Exemplo n.º 5
0
 public static PlanTarifaire getOnePlanTarifaire(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_base_plan_tarifaire_article where id = " + id + "";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         PlanTarifaire a = new PlanTarifaire();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Code = lect["code"].ToString();
                 a.Actif = (Boolean)((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"] : false) : false);
                 a.Puv = (Double)((lect["puv_minimal"] != null) ? (!lect["puv_minimal"].ToString().Trim().Equals("") ? lect["puv_minimal"] : 0) : 0);
                 a.Remise = (Double)((lect["remise"] != null) ? (!lect["remise"].ToString().Trim().Equals("") ? lect["remise"] : 0) : 0);
                 a.Ristourne = (Double)((lect["ristourne"] != null) ? (!lect["ristourne"].ToString().Trim().Equals("") ? lect["ristourne"] : 0) : 0);
                 a.Remise_ = (lect["remise"] != null
                     ? (!lect["remise"].ToString().Trim().Equals("")
                     ? BLL.RemiseBll.One(Convert.ToInt64(lect["remise"].ToString()))
                     : new Remise())
                     : new Remise());
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }