コード例 #1
0
ファイル: BLService.cs プロジェクト: Abbassimohamed/campus
        public String ajouterLF(piece_fact lBl)
        {
            String resultat = "Ok";

            using (NewCampusEntities db = new NewCampusEntities())
            {
                if (this.testAjouterLF(lBl) == false)
                {
                    try
                    {
                        db.piece_fact.Add(lBl);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        resultat = e.Message;
                    }
                }
                else
                {
                    resultat = "LF existante ";
                }
            }
            return(resultat);
        }
コード例 #2
0
ファイル: BLService.cs プロジェクト: Abbassimohamed/campus
        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);
        }
コード例 #3
0
ファイル: BLService.cs プロジェクト: Abbassimohamed/campus
        public Boolean testAjouterLF(piece_fact b)
        {
            Boolean trouve = true;

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