예제 #1
0
        public ActionResult SubmitFlowForm(string KeyValue, Base_Flow flow, string BuildFormJson)
        {
            string        ModuleId    = DESEncrypt.Decrypt(CookieHelper.GetCookie("ModuleId"));
            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                string Message = KeyValue == "" ? "新增成功。" : "编辑成功。";
                if (!string.IsNullOrEmpty(KeyValue))
                {
                    if (KeyValue == ManageProvider.Provider.Current().UserId)
                    {
                        throw new Exception("无权限编辑信息");
                    }
                    //base_user.Modify(KeyValue);
                    flow.Modify(KeyValue);
                    database.Update(flow, isOpenTrans);
                }
                else
                {
                    flow.Create();

                    database.Insert(flow, isOpenTrans);
                    //database.Insert(base_employee, isOpenTrans);
                    Base_DataScopePermissionBll.Instance.AddScopeDefault(ModuleId, ManageProvider.Provider.Current().UserId, flow.FlowID, isOpenTrans);
                }
                Base_FormAttributeBll.Instance.SaveBuildForm(BuildFormJson, flow.FlowID, ModuleId, isOpenTrans);
                database.Commit();
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                database.Rollback();
                database.Close();
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }
예제 #2
0
        public ActionResult SetFlowForm(string KeyValue)
        {
            Base_Flow base_user = DataFactory.Database().FindEntity <Base_Flow>(KeyValue);

            if (base_user == null)
            {
                return(Content(""));
            }
            //Base_Employee base_employee = DataFactory.Database().FindEntity<Base_Employee>(KeyValue);
            //Base_Company base_company = DataFactory.Database().FindEntity<Base_Company>(base_user.CompanyId);
            string strJson = base_user.ToJson();

            //公司
            //strJson = strJson.Insert(1, "\"CompanyName\":\"" + base_company.FullName + "\",");
            //员工信息
            //strJson = strJson.Insert(1, base_employee.ToJson().Replace("{", "").Replace("}", "") + ",");
            //自定义
            strJson = strJson.Insert(1, Base_FormAttributeBll.Instance.GetBuildForm(KeyValue));
            return(Content(strJson));
        }