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); }
public string supprimerLbl(List <ligne_bl> listp) { String resultat = "OK"; foreach (ligne_bl aX in listp) { using (NewCampusEntities db = new NewCampusEntities()) { try { if (aX.id > 0) { ligne_bl artX = db.ligne_bl.Single(a => a.id == aX.id); db.ligne_bl.Remove(artX); db.SaveChanges(); } } catch (Exception) { resultat = resultat + "," + aX.id_bl; db.Dispose(); } } } return(resultat); }
public ligne_bl getLblById(int b) { ligne_bl lBl = new ligne_bl(); try { using (NewCampusEntities db = new NewCampusEntities()) { return(db.ligne_bl.Where(aa => aa.id == b).FirstOrDefault()); } } catch (Exception) { lBl = new ligne_bl(); } return(lBl); }
public ligne_bl getLblByCodeBLandart(int b, string codeart) { ligne_bl lBl = new ligne_bl(); try { using (NewCampusEntities db = new NewCampusEntities()) { lBl = db.ligne_bl.Where(aa => aa.id_bl == b && aa.code_art == codeart).FirstOrDefault(); } } catch (Exception) { lBl = new ligne_bl(); } return(lBl); }
public Boolean testAjouterLBl(ligne_bl b) { Boolean trouve = true; //string s = cli.code; using (NewCampusEntities db = new NewCampusEntities()) { try { var cx = db.ligne_bl.Single(c => c.id.Equals(b.id)); if (cx == null) { trouve = false; } } catch (Exception) { trouve = false; } } return(trouve); }