예제 #1
0
        /// <summary>
        /// Reload the links in a box; to be called after the UI records changes in links
        /// </summary>
        public void UpdateLinks(ExtPerson ep)
        {
            using var db = new SystematizerContext();
            var links = DBUtil.LoadLinksFor(db, ep.Person).ToList();

            ep.Links = links;
        }
예제 #2
0
        /// <summary>
        /// Validate and save person
        /// throws exception on validation/save problem
        /// </summary>
        /// <returns>new rowID</returns>
        public long SavePerson(ExtPerson person)
        {
            //validate
            string message = person.Person.Validate();

            if (message != null)
            {
                throw new Exception("Invalid person record: " + message);
            }

            //save
            DBUtil.WriteAny(person.Person, null, db =>
            {
                DBUtil.WritePersonIndex(db, person.Person);
                DBUtil.SavePersonCats(db, person.Person.RowId, person.SelectedCatIds);
            });

            //update cache
            return(person.Person.RowId);
        }