public static Ristourne getOneRistourne(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_com_ristourne where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                Ristourne        a      = new Ristourne();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id            = Convert.ToInt64(lect["id"].ToString());
                        a.Reference     = lect["reference"].ToString();
                        a.BaseRistourne = lect["base_ristourne"].ToString();
                        a.Permanent     = Convert.ToBoolean((lect["permanent"] != null) ? (!lect["permanent"].ToString().Trim().Equals("") ? lect["permanent"].ToString().Trim() : "false") : "false");
                        a.Grilles       = BLL.GrilleRistourneBll.Liste("SELECT * FROM yvs_com_grille_ristourne WHERE remise =" + a.Id);
                    }
                    a.Update = true;
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
        public static Ristourne getAjoutRistourne(Ristourne 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 getUpdateRistourne(Ristourne 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 static List <Ristourne> getListRistourne(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <Ristourne> l    = new List <Ristourne>();
                NpgsqlCommand    Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        Ristourne a = new Ristourne();
                        a.Id            = Convert.ToInt64(lect["id"].ToString());
                        a.Reference     = lect["reference"].ToString();
                        a.BaseRistourne = lect["base_ristourne"].ToString();
                        a.Permanent     = Convert.ToBoolean((lect["permanent"] != null) ? (!lect["permanent"].ToString().Trim().Equals("") ? lect["permanent"].ToString().Trim() : "false") : "false");
                        a.Grilles       = BLL.GrilleRistourneBll.Liste("SELECT * FROM yvs_com_grille_ristourne WHERE remise =" + 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 RistourneBll(Ristourne unRistourne)
 {
     ristourne = unRistourne;
 }