Exemple #1
0
        public IEnumerable <Documentation> GetProcessDocs(int procid)
        {
            List <Documentation> docList = new List <Documentation>();

            using (SystemMapEntities db = new SystemMapEntities())
            {
                docList = db.process_docs
                          .Where(pd => pd.processid == procid)
                          .OrderBy(pd => pd.name)
                          .Select(pd => new Documentation
                {
                    documentationId = pd.process_docid,
                    name            = pd.name,
                    description     = pd.descr,
                    url             = pd.docurl,
                    docTypeId       = pd.doctypeid
                })
                          .ToList <Documentation>();
                TypeService           tsvc     = new TypeService();
                IEnumerable <DocType> typelist = tsvc.GetDocTypes();
                foreach (Documentation doc in docList)
                {
                    doc.documentType = typelist.Where(t => t.typeId == doc.docTypeId).FirstOrDefault();
                }
            }
            return(docList);
        }
        public int AddNode(Node nnode, bool typeadd = false)
        {
            int retval = -1;

            //Check for typeval--if not exists (and typeadd == false) throw exception;
            if (nnode.type == null)
            {
                throw new Exception("Node type data required");
            }
            TypeService typesvc = new TypeService();
            NodeType    ntype   = typesvc.GetNodeType(nnode.type.name, typeadd);

            using (SystemMapEntities db = new SystemMapEntities())
            {
                node addnode = new node {
                    name = nnode.name, descr = nnode.description, typeid = ntype.typeId
                };
                db.nodes.Add(addnode);
                db.SaveChanges();
                retval = addnode.nodeid;
            }
            return(retval);
        }