Exemplo n.º 1
0
        public NodeAttribute AddNodeAttribute(NodeAttribute natt)
        {
            NodeAttribute retval = null;

            using (SystemMapEntities db = new SystemMapEntities())
            {
                node_attributes nrec = new node_attributes
                {
                    nodeid     = natt.nodeId,
                    name       = natt.name,
                    descr      = natt.description,
                    attrtypeid = natt.type.typeId
                };
                db.node_attributes.Add(nrec);
                db.SaveChanges();
                retval = new NodeAttribute
                {
                    id          = nrec.attributeid,
                    name        = nrec.name,
                    description = nrec.descr
                };
                retval.type = new TypeService().GetAttributeType(nrec.attrtypeid);
            }
            return(retval);
        }
Exemplo n.º 2
0
 public void DeleteAttribute(int nattid)
 {
     using (SystemMapEntities db = new SystemMapEntities())
     {
         node_attributes del = db.node_attributes.Where(na => na.attributeid == nattid).SingleOrDefault();
         if (del != null)
         {
             db.node_attributes.Remove(del);
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 3
0
 public void UpdateNodeAttribute(NodeAttribute udata)
 {
     using (SystemMapEntities db = new SystemMapEntities())
     {
         node_attributes urec = db.node_attributes
                                .Where(na => na.attributeid == udata.id)
                                .SingleOrDefault();
         if (urec != null)
         {
             urec.name       = udata.name;
             urec.descr      = udata.description;
             urec.attrtypeid = udata.type.typeId;
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 4
0
 public void UpdateAttribute(NodeAttribute natt)
 {
     using (SystemMapEntities db = new SystemMapEntities())
     {
         node_attributes urecord = db.node_attributes
                                   .Where(na => na.attributeid == natt.id)
                                   .SingleOrDefault();
         if (urecord != null)
         {
             urecord.name       = natt.name;
             urecord.descr      = natt.description;
             urecord.attrtypeid = natt.type.typeId;
             urecord.nodeid     = natt.nodeId;
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 5
0
        public int AddAttribute(NodeAttribute natt)
        {
            int retval = -1;

            using (SystemMapEntities db = new SystemMapEntities())
            {
                node_attributes ndata = new node_attributes
                {
                    name       = natt.name,
                    descr      = natt.description,
                    nodeid     = natt.nodeId,
                    attrtypeid = natt.type.typeId
                };
                db.node_attributes.Add(ndata);
                db.SaveChanges();
                retval = ndata.attributeid;
            }
            return(retval);
        }