Esempio 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;
 }
Esempio 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;
 }
Esempio 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);
        }
Esempio 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);
        }
Esempio n. 5
0
 public static bool Exists(PLMPackLibDb db, string code)
 {
     return db.CardboardProfiles.Count(cbp => cbp.Code.ToLower() == code.ToLower()) > 0;
 }
Esempio n. 6
0
 public static CardboardFormat GetByID(PLMPackLibDb db, int id)
 {
     return db.CardboardFormats.Single(cbf => cbf.ID == id);
 }
Esempio n. 7
0
 public static CardboardFormat GetByName(PLMPackLibDb db, string name)
 {
     return db.CardboardFormats.Single(cbf => cbf.Name.ToLower() == name.ToLower());
 }
Esempio n. 8
0
 public static CardboardFormat[] GetAll(PLMPackLibDb db)
 {
     return (from cbf in db.CardboardFormats select cbf).ToArray();
 }
Esempio n. 9
0
 public static CardboardProfile GetById(PLMPackLibDb db, int id)
 {
     return db.CardboardProfiles.Single(cbp => cbp.ID == id);
 }
Esempio n. 10
0
 public static CardboardProfile GetById(PLMPackLibDb db, int id)
 {
     return(db.CardboardProfiles.Single(cbp => cbp.ID == id));
 }
Esempio n. 11
0
 public static CardboardProfile[] GetAll(PLMPackLibDb db)
 {
     return((from cbp in db.CardboardProfiles select cbp).ToArray());
 }
Esempio n. 12
0
 public static bool Exists(PLMPackLibDb db, string code)
 {
     return(db.CardboardProfiles.Count(cbp => cbp.Code.ToLower() == code.ToLower()) > 0);
 }
Esempio n. 13
0
 public static CardboardFormat GetByID(PLMPackLibDb db, int id)
 {
     return(db.CardboardFormats.Single(cbf => cbf.ID == id));
 }
Esempio n. 14
0
 public static CardboardFormat GetByName(PLMPackLibDb db, string name)
 {
     return(db.CardboardFormats.Single(cbf => cbf.Name.ToLower() == name.ToLower()));
 }
Esempio n. 15
0
 public static CardboardFormat[] GetAll(PLMPackLibDb db)
 {
     return((from cbf in db.CardboardFormats select cbf).ToArray());
 }
Esempio n. 16
0
 public void Delete(PLMPackLibDb db)
 {
     db.CardboardProfiles.Remove(this);
     db.SaveChanges();
 }
Esempio n. 17
0
 public static CardboardProfile[] GetAll(PLMPackLibDb db)
 { 
     return (from cbp in db.CardboardProfiles select cbp).ToArray();
 }
Esempio n. 18
0
 public static bool Exists(PLMPackLibDb db, string name)
 {
     return db.CardboardFormats.Count(cbf => cbf.Name.ToLower() == name.ToLower()) > 0;
 }
Esempio n. 19
0
 public void Delete(PLMPackLibDb db)
 {
     db.CardboardProfiles.Remove(this);
     db.SaveChanges();
 }
Esempio n. 20
0
 public static bool Exists(PLMPackLibDb db, string name)
 {
     return(db.CardboardFormats.Count(cbf => cbf.Name.ToLower() == name.ToLower()) > 0);
 }