示例#1
0
        public JsonResult GetWorkFlowDef()
        {
            string id = QueryString("id");

            id.CheckNotNullOrEmpty("id");
            WFDef cForm = UnitOfWork.GetByKey <WFDef>(id);

            cForm.CheckNotNull("WFDef");
            return(Json(cForm));
        }
示例#2
0
        public JsonResult Publish()
        {
            string bPublish = QueryString("bPublish");

            bPublish.CheckBoolType("bPublish");
            string id = QueryString("id");

            id.CheckNotNullOrEmpty("id");
            WFDef wfDef = UnitOfWork.GetByKey <WFDef>(id);

            wfDef.CheckNotNull("WFDef");
            wfDef.IsPublish = bPublish;
            if (wfDef.IsPublish == "true")
            {
                var defInst = wfDef.CreateInst();
                UnitOfWork.Add <WFDefInst>(defInst);
            }

            return(Json(UnitOfWork.Commit()));
        }
示例#3
0
        public JsonResult AddWorkFlow()
        {
            var   dataStr = QueryString("data");
            WFDef wfd     = dataStr.JsonToObject <WFDef>();

            wfd.Id        = GuidHelper.CreateTimeOrderID();
            wfd.IsPublish = "false";
            wfd.Code      = wfd.EntityFullName.Replace(".", "_");//xx_xxx_xx
            UnitOfWork.Add(wfd);

            WFDefInst defInst = new WFDefInst();

            ConvertHelper.UpdateEntity(defInst, dataStr.JsonToDictionary());
            defInst.Id      = GuidHelper.CreateTimeOrderID();
            defInst.WFDefId = wfd.Id;
            UnitOfWork.Add(defInst);

            bool b = UnitOfWork.Commit();

            return(Json(b));
        }
示例#4
0
        public JsonResult SaveWorkFlowDef()
        {
            var    dic = Request.Form["formData"].JsonToObject <Dictionary <string, object> >();
            string id  = dic.GetValue("Id");

            #region Def
            if (string.IsNullOrEmpty(id))
            {
                WFDef flowDef = ConvertHelper.ConvertToObj <WFDef>(dic);
                flowDef.Id = GuidHelper.CreateTimeOrderID();
                UnitOfWork.Add(flowDef);
            }
            else
            {
                WFDef flowDef = UnitOfWork.GetByKey <WFDef>(id);
                ConvertHelper.UpdateEntity(flowDef, dic);
                UnitOfWork.UpdateEntity(flowDef);
            }
            #endregion

            bool b = UnitOfWork.Commit();
            return(Json(b));
        }