Exemplo n.º 1
0
        private static void TotalRemiseDoc(RemiseFacture r, Facture doc)
        {
            double qte = 0;

            foreach (Contenu c in doc.Contenus)
            {
                qte += c.Quantite;
            }
            Remise r_     = r.Remise;
            double remise = MontantRemise(r.Remise, qte, doc.MontantTTC);

            r.Montant          = remise;
            doc.MontantRemise += remise;
        }
Exemplo n.º 2
0
        public static RemiseFacture getAjoutRemiseFacture(RemiseFacture 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.º 3
0
        public static bool getUpdateRemiseFacture(RemiseFacture 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.º 4
0
        public static List <RemiseFacture> getListRemiseFacture(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <RemiseFacture> l    = new List <RemiseFacture>();
                NpgsqlCommand        Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader     lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        RemiseFacture a = new RemiseFacture();
                        a.Id     = Convert.ToInt64(lect["id"].ToString());
                        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.º 5
0
        public static RemiseFacture getOneRemiseFacture(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_com_remise_doc_vente where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                RemiseFacture    a      = new RemiseFacture();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id     = Convert.ToInt64(lect["id"].ToString());
                        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);
            }
        }
Exemplo n.º 6
0
 public RemiseFactureBll(RemiseFacture unRemiseFacture)
 {
     remise = unRemiseFacture;
 }