Esempio n. 1
0
        public static void DeleteKnot(int knotId)
        {
            Knots  knot  = db.Knots.Where(k => k.id.Equals(knotId)).Single();
            Guides guide = db.Guides.Where(g => g.id.Equals(knot.guide_id)).Single();

            db.Knots.DeleteOnSubmit(knot);
            db.Guides.DeleteOnSubmit(guide);
            db.SubmitChanges();

            MessageBox.Show("Узел <" + knot.name + "> успешно удален", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 2
0
        public static void UpdateKnot(int knotId, string knotName, string knotComment, Binary knotBinary, string guideComment, Binary guideBinary, int typeId)
        {
            Knots  knot  = db.Knots.Where(k => k.id.Equals(knotId)).Single();
            Guides guide = db.Guides.Where(g => g.id.Equals(knot.guide_id)).Single();

            knot.name     = knotName;
            knot.comment  = knotComment;
            knot.image    = knotBinary;
            knot.type_id  = typeId;
            guide.comment = guideComment;
            guide.image   = guideBinary;
            db.SubmitChanges();

            MessageBox.Show("Данные об узле <" + knotName + ">, успешно изменены.", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 3
0
        public static void InsertKnot(string knotName, string knotComment, Binary knotBinary, string guideComment, Binary guideBinary, int typeId)
        {
            bool exist = db.Knots.Where(k => k.name.Equals(knotName)).Any();

            if (exist != true)
            {
                Guides newGuide = new Guides
                {
                    comment = guideComment,
                    image   = guideBinary
                };

                db.Guides.InsertOnSubmit(newGuide);
                db.SubmitChanges();

                Guides guide = db.Guides.ToList().Last();

                Knots newKnot = new Knots
                {
                    name     = knotName,
                    comment  = knotComment,
                    image    = knotBinary,
                    type_id  = typeId,
                    guide_id = guide.id
                };

                db.Knots.InsertOnSubmit(newKnot);
                db.SubmitChanges();

                MessageBox.Show("Новый узел <" + knotName + "> успешно добавлен.", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Узел с названием <" + knotName + "> уже существует.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
 private void detach_Knots(Knots entity)
 {
     this.SendPropertyChanging();
     entity.Types = null;
 }
Esempio n. 5
0
 private void attach_Knots(Knots entity)
 {
     this.SendPropertyChanging();
     entity.Types = this;
 }
Esempio n. 6
0
 partial void DeleteKnots(Knots instance);
Esempio n. 7
0
 partial void UpdateKnots(Knots instance);
Esempio n. 8
0
 partial void InsertKnots(Knots instance);