Esempio n. 1
0
 public ligne_bc findlcmdbyartcmd(string codeart, int lcmd)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.ligne_bc.Where(aa => aa.code_art == codeart && aa.id_bc == lcmd).FirstOrDefault());
     }
 }
Esempio n. 2
0
 public List <bon_commande> getAllBbyetat(string etat)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.bon_commande.Where(aa => aa.etat == etat).ToList());
     }
 }
Esempio n. 3
0
        public String modifierStock(Livre Cab)
        {
            String resultat = "OK";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testModifierStock(Cab) == false)
                {
                    try
                    {
                        db.Livre.Attach(db.Livre.Single(x => x.Rang == Cab.Rang));
                        db.Entry(db.Livre.Single(x => x.Rang == Cab.Rang)).CurrentValues.SetValues(Cab);
                        //db.piece.ApplyCurrentValues(Cab);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "piece inexistante";
                }
            }
            return(resultat);
        }
Esempio n. 4
0
 public bon_commande getAllBcbycode(int numcmd)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.bon_commande.Where(aa => aa.numero_bc == numcmd).FirstOrDefault());
     }
 }
 public List <reservation> getallreservbyarticle(string codeart)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.reservation.Where(aa => aa.article == codeart).ToList());
     }
 }
Esempio n. 6
0
        public String ajouterDevis(devis Bl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterDevis(Bl) == false)
                {
                    try
                    {
                        db.devis.Add(Bl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "Devis existante, verifiez le champs num devis ";
                }
            }
            return(resultat);
        }
Esempio n. 7
0
        public string supprimerLDevis(List <ligne_devis> listp)
        {
            String resultat = "OK";

            foreach (ligne_devis aX in listp)
            {
                using (NewCampusEntities db = new NewCampusEntities())
                {
                    try
                    {
                        if (aX.id > 0)
                        {
                            ligne_devis artX = db.ligne_devis.Single(a => a.id == aX.id);
                            db.ligne_devis.Remove(artX);
                            db.SaveChanges();
                        }
                    }
                    catch (Exception)
                    {
                        resultat = resultat + "," + aX.id_devis;
                        db.Dispose();
                    }
                }
            }
            return(resultat);
        }
 public List <reservation> getallreservationbycmd(int numbc)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.reservation.Where(aa => aa.ncmd == numbc).ToList());
     }
 }
Esempio n. 9
0
        public string supprimerLF(List <piece_fact> listp)
        {
            String resultat = "OK";

            foreach (piece_fact aX in listp)
            {
                using (NewCampusEntities db = new NewCampusEntities())
                {
                    try
                    {
                        if (aX.id_piece > 0)
                        {
                            piece_fact artX = db.piece_fact.Single(a => a.id_piece == aX.id_piece);
                            db.piece_fact.Remove(artX);
                            db.SaveChanges();
                        }
                    }
                    catch (Exception)
                    {
                        //resultat = resultat + "," + aX.id_commande;
                        db.Dispose();
                    }
                }
            }
            return(resultat);
        }
Esempio n. 10
0
 public reservation getreserv(string codeart, int idcmd)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.reservation.Where(aa => aa.article == codeart && aa.ncmd == idcmd).FirstOrDefault());
     }
 }
Esempio n. 11
0
        public String ajouterBL(bon_livraison Bl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterBl(Bl) == false)
                {
                    try
                    {
                        db.bon_livraison.Add(Bl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "BL existante, verifiez le champs num Bl ";
                }
            }
            return(resultat);
        }
Esempio n. 12
0
 public List <facturevente> GetFactByetat(string etat)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         return(db.facturevente.Where(aa => aa.etat == etat).ToList());
     }
 }
Esempio n. 13
0
        public String ajouterBS(bon_sortie lBl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterBS(lBl) == false)
                {
                    try
                    {
                        db.bon_sortie.Add(lBl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "LF existante ";
                }
            }
            return(resultat);
        }
Esempio n. 14
0
        public String ajouterLBL(ligne_bl lBl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterLBl(lBl) == false)
                {
                    try
                    {
                        db.ligne_bl.Add(lBl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "LBL existante, verifiez le champs num Bl ";
                }
            }
            return(resultat);
        }
Esempio n. 15
0
        public void livrer(string codearticle, double quantit)
        {
            NewCampusEntities db  = new NewCampusEntities();
            Livre             art = db.Livre.Where(aa => aa.codeart == codearticle).Single();

            art.quantitenstock = art.quantitenstock - quantit;
            db.SaveChanges();
        }
Esempio n. 16
0
        public void annulerreservblivcmdstay(string codearticle, double quantit)
        {
            NewCampusEntities db  = new NewCampusEntities();
            Livre             art = db.Livre.Where(aa => aa.codeart == codearticle).Single();

            art.quantitenstock = art.quantitenstock + quantit;
            db.SaveChanges();
        }
Esempio n. 17
0
 public void deletereservation(reservation reservat)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         db.reservation.Remove(reservat);
         db.SaveChanges();
     }
 }
Esempio n. 18
0
 public void addReservation(reservation reservat)
 {
     using (NewCampusEntities db = new  NewCampusEntities())
     {
         db.reservation.Add(reservat);
         db.SaveChanges();
     }
 }
Esempio n. 19
0
        public List <piece_fact> rapportventearticle(Livre art, DateTime date1, DateTime date2)
        {
            List <piece_fact> lBlst = new List <piece_fact>();

            using (NewCampusEntities db = new NewCampusEntities())
            {
                return(db.spRapportArt(art.codeart, date1, date2).ToList());
            }
        }
Esempio n. 20
0
        public List <Livre> getarticlestartby(string vartext)
        {
            List <Livre> arts = new List <Livre>();

            using (NewCampusEntities db = new NewCampusEntities())
            {
                return(db.spFindlistartstartby(vartext).ToList());
            }
        }
Esempio n. 21
0
        public void modifierLBC(ligne_bc lignebc)
        {
            using (NewCampusEntities db = new NewCampusEntities())
            {
                db.ligne_bc.Attach(db.ligne_bc.Single(x => x.id == lignebc.id));
                db.Entry(db.ligne_bc.Single(x => x.id == lignebc.id)).CurrentValues.SetValues(lignebc);

                db.SaveChanges();
            }
        }
Esempio n. 22
0
 public void updatefact(facturevente fact)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         db.facturevente.Attach(db.facturevente.Single(x => x.id == fact.id));
         db.Entry(db.facturevente.Single(x => x.id == fact.id)).CurrentValues.SetValues(fact);
         //db.piece.ApplyCurrentValues(Cab);
         db.SaveChanges();
     }
 }
Esempio n. 23
0
 public string updatereservation(reservation rsv)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         db.reservation.Attach(db.reservation.Single(x => x.id == rsv.id));
         db.Entry(db.reservation.Single(x => x.id == rsv.id)).CurrentValues.SetValues(rsv);
         db.SaveChanges();
     }
     return(rsv.article);
 }
Esempio n. 24
0
        public void modifierBC(bon_commande bc)
        {
            using (NewCampusEntities db = new NewCampusEntities())
            {
                db.bon_commande.Attach(db.bon_commande.Single(x => x.id == bc.id));
                db.Entry(db.bon_commande.Single(x => x.id == bc.id)).CurrentValues.SetValues(bc);

                db.SaveChanges();
            }
        }
Esempio n. 25
0
 public void modifier(devis bl)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         db.devis.Attach(db.devis.Single(x => x.id == bl.id));
         db.Entry(db.devis.Single(x => x.id == bl.id)).CurrentValues.SetValues(bl);
         //db.piece.ApplyCurrentValues(Cab);
         db.SaveChanges();
     }
 }
Esempio n. 26
0
 public void deletelbl(int numbl)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         List <ligne_bl> lbls = db.ligne_bl.Where(a => a.id_bl == numbl).ToList();
         foreach (ligne_bl lbl in lbls)
         {
             db.ligne_bl.Remove(lbl);
         }
         db.SaveChanges();
     }
 }
Esempio n. 27
0
        public List <piece_fact> getpiecefacts(int codeart)
        {
            List <piece_fact> pcfacts = new List <piece_fact>();

            using (NewCampusEntities db = new NewCampusEntities())
            {
                pcfacts = (from p in db.piece_fact
                           where p.idauteur == codeart
                           select p).ToList();
            }
            return(pcfacts);
        }
Esempio n. 28
0
        public int checkavailab(string codearticle, double quantit)
        {
            NewCampusEntities db  = new NewCampusEntities();
            Livre             art = db.Livre.Where(c => c.codeart == codearticle).First();

            if (art.quantitenstock >= quantit)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 29
0
        public void deleteallreserv(int numcmd)
        {
            List <reservation> rsvs = new List <reservation>();

            using (NewCampusEntities db = new NewCampusEntities())
            {
                rsvs = db.reservation.Where(aa => aa.ncmd == numcmd).ToList();
                foreach (reservation rsv in rsvs)
                {
                    db.reservation.Remove(rsv);
                }
                db.SaveChanges();
            }
        }
Esempio n. 30
0
        public Livre GetProdByQtRest(string code)
        {
            NewCampusEntities db = new NewCampusEntities();
            Livre             p  = new Livre();

            try
            {
                return(db.Livre.Where(aa => aa.codeart == code).FirstOrDefault());
            }
            catch (Exception)
            {
                p = new Livre();
            }
            return(p);
        }