Ejemplo n.º 1
0
        /// <summary>
        /// 编辑功能
        /// </summary>
        /// <param name="input"></param>
        /// <param name="profile"></param>
        /// <returns></returns>
        public ActionResult EditFunc(Dictionary <string, string> input, sys_member profile)
        {
            sys_func f = JsonConvert.DeserializeObject <sys_func>(input["inputData"]);

            if (input["type"] == "save")
            {
                _db.Updateable(f).ExecuteCommand();
            }
            else if (input["type"] == "del")
            {
                if (!_db.Queryable <sys_func>().Where(_f => _f.pid == f.ID).Any())
                {
                    _db.Deleteable <sys_func>().Where(d => d.ID == f.ID).ExecuteCommand();
                }
                else
                {
                    return(new ActionResult(false, null, null, "请先删除子节点"));
                }
            }
            else
            {
                if (f.pid != null && f.pid == 0)
                {
                    f.pid = null;
                }
                if (input.ContainsKey("child") && input["child"] == "child")
                {
                    f.pid = f.ID;
                }
                _db.Insertable(f).ExecuteCommand();
            }
            return(new ActionResult(true));
        }
Ejemplo n.º 2
0
        public ActionResult TraceBatch()
        {
            List <sys_trace> traces = Request <List <sys_trace> >("traces");

            traces.ForEach(t => { t.ID = IdWorker.NextId(); });
            _db.Insertable <sys_trace>(traces).With(SqlWith.NoLock).ExecuteCommand();
            return(new ActionResult(true, null, null, null));
        }
Ejemplo n.º 3
0
        internal string CreateTitle(string noteTiltle)
        {
            NoteTitle noteTitle = new NoteTitle();

            noteTitle.n_title     = noteTiltle;
            noteTitle.n_length    = 0;
            noteTitle.create_time = DateTime.Now.ToString();
            db.Insertable(noteTitle).ExecuteCommand();
            var         noteID      = db.Queryable <NoteTitle>().Max(nt => nt.id);
            NoteContent noteContent = new NoteContent();

            noteContent.n_title_id = noteID;
            db.Insertable(noteContent).ExecuteCommand();
            return(noteID.ToString());
        }