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