Example #1
0
        public ActionResult InstDetail(int id)
        {
            var inst  = FormInstanceManager.GetDbRecord(id);
            var model = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(inst.Data);

            return(View(model));
        }
Example #2
0
        public ActionResult ShowByFlowInst(int id, FormCollection collection, bool partial = false, bool showButton = true)
        {
            int formInstID = FormManager.GetFormInstanceOfFlowInstance(id);
            var formInst   = FormInstanceManager.GetDbRecord(formInstID);
            var form       = FormManager.GetDbRecord(formInst.FormID);
            var flowInst   = FlowInstanceManager.GetDbRecord(formInst.FlowInstanceID);
            var layoutID   = LayoutManager.GetLayoutOfFlowNode(flowInst.CurrentNodeID);
            var markup     = layoutID == null ? form.Layout : LayoutManager.GetDbRecord(layoutID.Value).Markup;

            var data = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(formInst.Data);

            data = data == null ? new Dictionary <string, string>() : data;
            collection.AllKeys.ForEach(x => data[x] = collection[x]);
            FormInstanceManager.UpdateDbRecord(formInstID, record =>
            {
                record.Data = System.Web.Helpers.Json.Encode(data);
            });
            TongJi.Web.Notifications.Notification.EnqueueMessage("表单数据已保存。");

            ViewBag.partial    = partial;
            ViewBag.showButton = showButton;
            ViewBag.Form       = form;
            ViewBag.markup     = markup;
            ViewBag.formInstID = formInstID;
            return(View("Show", data));
        }
Example #3
0
        public ActionResult Preview(int id)
        {
            var inst = FormInstanceManager.GetDbRecord(id);
            var form = FormManager.GetDbRecord(inst.FormID);
            var data = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(inst.Data);

            ViewBag.Form = form;
            ViewBag.Inst = inst;
            return(View(data));
        }
Example #4
0
        public ActionResult Fill(Guid id, FormCollection collection)
        {
            var data = collection.AllKeys.ToDictionary(x => x, x => collection[x]);

            FormInstanceManager.New(id, System.Web.Helpers.Json.Encode(data), 0);
            TongJi.Web.Notifications.Notification.EnqueueMessage("表单数据已保存。");
            var form = FormManager.GetDbRecord(id);

            ViewBag.Form = form;
            return(View(data));
        }
Example #5
0
        public ActionResult Modify(int id, bool partial = false, bool showButton = true)
        {
            var inst = FormInstanceManager.GetDbRecord(id);
            var form = FormManager.GetDbRecord(inst.FormID);
            var data = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(inst.Data);

            ViewBag.partial    = partial;
            ViewBag.showButton = showButton;
            ViewBag.Form       = form;
            ViewBag.Inst       = inst;
            return(View(data));
        }
Example #6
0
        public ActionResult ShowByID(Guid id, int flowInstID, bool partial = false, bool showButton = true)
        {
            int formInstID = FormManager.GetFormInstanceOfFlowInstance(flowInstID);
            var formInst   = FormInstanceManager.GetDbRecord(formInstID);
            var form       = FormManager.GetDbRecord(formInst.FormID);
            var markup     = LayoutManager.GetDbRecord(id).Markup;

            ViewBag.partial    = partial;
            ViewBag.showButton = showButton;
            ViewBag.Form       = form;
            ViewBag.markup     = markup;
            ViewBag.formInstID = formInstID;
            var data = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(formInst.Data);

            return(View("Show", data));
        }
Example #7
0
        public ActionResult ShowByFlowInst(int id, bool partial = false, bool showButton = true)
        {
            int formInstID = FormManager.GetFormInstanceOfFlowInstance(id);
            var formInst   = FormInstanceManager.GetDbRecord(formInstID);
            var form       = FormManager.GetDbRecord(formInst.FormID);
            var flowInst   = FlowInstanceManager.GetDbRecord(formInst.FlowInstanceID);
            var layoutID   = LayoutManager.GetLayoutOfFlowNode(flowInst.CurrentNodeID);
            var markup     = layoutID == null ? form.Layout : LayoutManager.GetDbRecord(layoutID.Value).Markup;

            ViewBag.partial    = partial;
            ViewBag.showButton = showButton;
            ViewBag.Form       = form;
            ViewBag.markup     = markup;
            ViewBag.formInstID = formInstID;
            var data = System.Web.Helpers.Json.Decode <Dictionary <string, string> >(formInst.Data);

            return(View("Show", data));
        }
Example #8
0
        public ActionResult Modify(int id, FormCollection collection, bool partial = false, bool showButton = true)
        {
            var data = collection.AllKeys.ToDictionary(x => x, x => collection[x]);
            var inst = FormInstanceManager.GetDbRecord(id);
            var form = FormManager.GetDbRecord(inst.FormID);

            FormInstanceManager.UpdateDbRecord(id, record =>
            {
                record.Data = System.Web.Helpers.Json.Encode(data);
            });
            TongJi.Web.Notifications.Notification.EnqueueMessage("表单数据已保存。");

            ViewBag.partial    = partial;
            ViewBag.showButton = showButton;
            ViewBag.Form       = form;
            ViewBag.Inst       = inst;
            return(View(data));
        }
Example #9
0
 public ActionResult InstDelete(int id)
 {
     FormInstanceManager.DeleteDbRecord(id);
     return(null);
 }
Example #10
0
        public ActionResult InstList(Guid?id)
        {
            var insts = id == null?FormInstanceManager.GetAllDbRecords() : FormInstanceManager.Query(x => x.FormID == id);

            return(View(insts));
        }
Example #11
0
        public ActionResult Data(int id)
        {
            var inst = FormInstanceManager.GetDbRecord(id);

            return(Content(inst.Data, "application/json"));
        }