Ejemplo n.º 1
0
 public static CardboardProfile CreateNew(PLMPackLibDb db, string code, string name, float thickness)
 {
     // is already exists ?
     if (Exists(db, code))
         throw new Exception(string.Format("Cardboard profile with code = {0} already exists", code));
     // build new cardboard profile
     CardboardProfile cardboardProfile = new CardboardProfile();
     cardboardProfile.Code = code;
     cardboardProfile.Name = name;
     cardboardProfile.Thickness = thickness;
     db.CardboardProfiles.Add(cardboardProfile);
     db.SaveChanges();
     return cardboardProfile;
 }
Ejemplo n.º 2
0
 public static CardboardFormat CreateNew(PLMPackLibDb db, string name, string description, float length, float width)
 {
     // is already existing ?
     if (Exists(db, name))
         throw new Exception(string.Format("CardboardFormat with name = {0} already exists", name));
     // build new cardboard format
     CardboardFormat cardboardFormat = new CardboardFormat();
     cardboardFormat.Name = name;
     cardboardFormat.Description = description;
     cardboardFormat.Length = length;
     cardboardFormat.Width = width;
     db.CardboardFormats.Add(cardboardFormat);
     db.SaveChanges();
     return cardboardFormat;
 }
Ejemplo n.º 3
0
        public static CardboardProfile CreateNew(PLMPackLibDb db, string code, string name, float thickness)
        {
            // is already exists ?
            if (Exists(db, code))
            {
                throw new Exception(string.Format("Cardboard profile with code = {0} already exists", code));
            }
            // build new cardboard profile
            CardboardProfile cardboardProfile = new CardboardProfile();

            cardboardProfile.Code      = code;
            cardboardProfile.Name      = name;
            cardboardProfile.Thickness = thickness;
            db.CardboardProfiles.Add(cardboardProfile);
            db.SaveChanges();
            return(cardboardProfile);
        }
Ejemplo n.º 4
0
        public static CardboardFormat CreateNew(PLMPackLibDb db, string name, string description, float length, float width)
        {
            // is already existing ?
            if (Exists(db, name))
            {
                throw new Exception(string.Format("CardboardFormat with name = {0} already exists", name));
            }
            // build new cardboard format
            CardboardFormat cardboardFormat = new CardboardFormat();

            cardboardFormat.Name        = name;
            cardboardFormat.Description = description;
            cardboardFormat.Length      = length;
            cardboardFormat.Width       = width;
            db.CardboardFormats.Add(cardboardFormat);
            db.SaveChanges();
            return(cardboardFormat);
        }
Ejemplo n.º 5
0
 public static bool Exists(PLMPackLibDb db, string code)
 {
     return db.CardboardProfiles.Count(cbp => cbp.Code.ToLower() == code.ToLower()) > 0;
 }
Ejemplo n.º 6
0
 public static CardboardFormat GetByID(PLMPackLibDb db, int id)
 {
     return db.CardboardFormats.Single(cbf => cbf.ID == id);
 }
Ejemplo n.º 7
0
 public static CardboardFormat GetByName(PLMPackLibDb db, string name)
 {
     return db.CardboardFormats.Single(cbf => cbf.Name.ToLower() == name.ToLower());
 }
Ejemplo n.º 8
0
 public static CardboardFormat[] GetAll(PLMPackLibDb db)
 {
     return (from cbf in db.CardboardFormats select cbf).ToArray();
 }
Ejemplo n.º 9
0
 public static CardboardProfile GetById(PLMPackLibDb db, int id)
 {
     return db.CardboardProfiles.Single(cbp => cbp.ID == id);
 }
Ejemplo n.º 10
0
 public static CardboardProfile GetById(PLMPackLibDb db, int id)
 {
     return(db.CardboardProfiles.Single(cbp => cbp.ID == id));
 }
Ejemplo n.º 11
0
 public static CardboardProfile[] GetAll(PLMPackLibDb db)
 {
     return((from cbp in db.CardboardProfiles select cbp).ToArray());
 }
Ejemplo n.º 12
0
 public static bool Exists(PLMPackLibDb db, string code)
 {
     return(db.CardboardProfiles.Count(cbp => cbp.Code.ToLower() == code.ToLower()) > 0);
 }
Ejemplo n.º 13
0
 public static CardboardFormat GetByID(PLMPackLibDb db, int id)
 {
     return(db.CardboardFormats.Single(cbf => cbf.ID == id));
 }
Ejemplo n.º 14
0
 public static CardboardFormat GetByName(PLMPackLibDb db, string name)
 {
     return(db.CardboardFormats.Single(cbf => cbf.Name.ToLower() == name.ToLower()));
 }
Ejemplo n.º 15
0
 public static CardboardFormat[] GetAll(PLMPackLibDb db)
 {
     return((from cbf in db.CardboardFormats select cbf).ToArray());
 }
Ejemplo n.º 16
0
 public void Delete(PLMPackLibDb db)
 {
     db.CardboardProfiles.Remove(this);
     db.SaveChanges();
 }
Ejemplo n.º 17
0
 public static CardboardProfile[] GetAll(PLMPackLibDb db)
 { 
     return (from cbp in db.CardboardProfiles select cbp).ToArray();
 }
Ejemplo n.º 18
0
 public static bool Exists(PLMPackLibDb db, string name)
 {
     return db.CardboardFormats.Count(cbf => cbf.Name.ToLower() == name.ToLower()) > 0;
 }
Ejemplo n.º 19
0
 public void Delete(PLMPackLibDb db)
 {
     db.CardboardProfiles.Remove(this);
     db.SaveChanges();
 }
Ejemplo n.º 20
0
 public static bool Exists(PLMPackLibDb db, string name)
 {
     return(db.CardboardFormats.Count(cbf => cbf.Name.ToLower() == name.ToLower()) > 0);
 }