Пример #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);
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #4
0
 partial void DeleteGuides(Guides instance);
Пример #5
0
 partial void UpdateGuides(Guides instance);
Пример #6
0
 partial void InsertGuides(Guides instance);