Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
            }
        }
Exemplo n.º 4
0
 partial void DeleteGuides(Guides instance);
Exemplo n.º 5
0
 partial void UpdateGuides(Guides instance);
Exemplo n.º 6
0
 partial void InsertGuides(Guides instance);