Exemplo n.º 1
0
        public String ajouterLBc(ligne_bc lBl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterLBc(lBl) == false)
                {
                    try
                    {
                        db.ligne_bc.Add(lBl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "LBL existante, verifiez le champs num Bc";
                }
            }
            return(resultat);
        }
Exemplo n.º 2
0
        public string supprimerLbc(List <ligne_bc> listp)
        {
            String resultat = "OK";

            foreach (ligne_bc aX in listp)
            {
                using (NewCampusEntities db = new NewCampusEntities())
                {
                    try
                    {
                        if (aX.id > 0)
                        {
                            ligne_bc artX = db.ligne_bc.Single(a => a.id == aX.id);
                            db.ligne_bc.Remove(artX);
                            db.SaveChanges();
                        }
                    }
                    catch (Exception)
                    {
                        resultat = resultat + "," + aX.id_bc;
                        db.Dispose();
                    }
                }
            }
            return(resultat);
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
 public void supprimerLbcbyone(ligne_bc listp)
 {
     using (NewCampusEntities db = new NewCampusEntities())
     {
         try
         {
             ligne_bc artX = db.ligne_bc.Single(a => a.id == listp.id);
             db.ligne_bc.Remove(artX);
             db.SaveChanges();
         }
         catch (Exception)
         {
         }
     }
 }
Exemplo n.º 5
0
        public ligne_bc getLbcBycode(int b)
        {
            ligne_bc lBl = new ligne_bc();

            try
            {
                using (NewCampusEntities db = new NewCampusEntities())
                {
                    return(db.ligne_bc.Where(aa => aa.id_bc == b).FirstOrDefault());
                }
            }
            catch (Exception)
            {
                lBl = new ligne_bc();
            }
            return(lBl);
        }
Exemplo n.º 6
0
        public Boolean testAjouterLBc(ligne_bc b)
        {
            Boolean trouve = true;

            //string s = cli.code;
            using (NewCampusEntities db = new NewCampusEntities())
            {
                try
                {
                    var cx = db.ligne_bc.Single(c => c.id.Equals(b.id));
                    if (cx == null)
                    {
                        trouve = false;
                    }
                }
                catch (Exception)
                {
                    trouve = false;
                }
            }
            return(trouve);
        }