mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-04-11 11:31:28 +08:00
全面修改Id为Guid类型,为2.0版做准备
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载分类下面的所有分类
|
||||
/// </summary>
|
||||
public string Load(int parentId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid parentId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(parentId, pageCurrent, pageSize));
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string Delete(int Id)
|
||||
public string Delete(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using OptimaJet.Workflow;
|
||||
using OptimaJet.Workflow.Core.Builder;
|
||||
using OptimaJet.Workflow.Core.Bus;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using OptimaJet.Workflow.Core.Parser;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
@@ -12,9 +6,14 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Xml.Linq;
|
||||
using OptimaJet.Workflow;
|
||||
using OptimaJet.Workflow.Core.Builder;
|
||||
using OptimaJet.Workflow.Core.Bus;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using OptimaJet.Workflow.DbPersistence;
|
||||
using WorkflowRuntime = OptimaJet.Workflow.Core.Runtime.WorkflowRuntime;
|
||||
|
||||
namespace WF.Sample.Controllers
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class DesignerController : Controller
|
||||
{
|
||||
@@ -44,47 +43,13 @@ namespace WF.Sample.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
var res = getRuntime.DesignerAPI(pars, filestream, true);
|
||||
var res = WorkflowInit.Runtime.DesignerAPI(pars, filestream, true);
|
||||
if (pars["operation"].ToLower() == "downloadscheme")
|
||||
return File(Encoding.UTF8.GetBytes(res), "text/xml", "scheme.xml");
|
||||
return Content(res);
|
||||
}
|
||||
|
||||
private static volatile WorkflowRuntime _runtime;
|
||||
private static readonly object _sync = new object();
|
||||
|
||||
private WorkflowRuntime getRuntime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
var connectionString = ConfigurationManager.ConnectionStrings["WorkFlow"].ConnectionString;
|
||||
var builder = new WorkflowBuilder<XElement>(
|
||||
new OptimaJet.Workflow.DbPersistence.DbXmlWorkflowGenerator(connectionString),
|
||||
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
|
||||
new OptimaJet.Workflow.DbPersistence.DbSchemePersistenceProvider(connectionString)
|
||||
).WithDefaultCache();
|
||||
|
||||
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
|
||||
.WithBuilder(builder)
|
||||
.WithPersistenceProvider(new OptimaJet.Workflow.DbPersistence.DbPersistenceProvider(connectionString))
|
||||
.WithTimerManager(new TimerManager())
|
||||
.WithBus(new NullBus())
|
||||
.SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn()
|
||||
.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _runtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
75
OpenAuth.Mvc/Controllers/GoodsAppliesController.cs
Normal file
75
OpenAuth.Mvc/Controllers/GoodsAppliesController.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.Domain;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using ProcessStatus = OptimaJet.Workflow.Core.Persistence.ProcessStatus;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class GoodsAppliesController : BaseController
|
||||
{
|
||||
private GoodsApplyApp _app;
|
||||
|
||||
public GoodsAppliesController()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<GoodsApplyApp>();
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string Load(Guid parentId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(AuthUtil.GetCurrentUser().User.Id, parentId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string Edit(GoodsApply apply)
|
||||
{
|
||||
try
|
||||
{
|
||||
apply.UserId = AuthUtil.GetCurrentUser().User.Id;
|
||||
_app.AddOrUpdate(apply);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BjuiResponse.statusCode = "300";
|
||||
BjuiResponse.message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public dynamic Get(Guid id)
|
||||
{
|
||||
var apply = _app.Get(id);
|
||||
CreateWorkflowIfNotExists(id);
|
||||
|
||||
return new
|
||||
{
|
||||
Apply=apply
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private void CreateWorkflowIfNotExists(Guid id)
|
||||
{
|
||||
if (WorkflowInit.Runtime.IsProcessExists(id))
|
||||
return;
|
||||
|
||||
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
||||
{
|
||||
WorkflowInit.Runtime.CreateInstance("SimpleWF", id);
|
||||
|
||||
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||
|
||||
sync.Wait(new TimeSpan(0, 0, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,12 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<ModuleElementManagerApp>();
|
||||
}
|
||||
public ActionResult Index(int id)
|
||||
public ActionResult Index(Guid id)
|
||||
{
|
||||
ViewBag.ModuleId = id;
|
||||
return View();
|
||||
}
|
||||
public ActionResult Get(int moduleId = 0)
|
||||
public ActionResult Get(Guid moduleId)
|
||||
{
|
||||
return Json(_app.LoadByModuleId(moduleId));
|
||||
}
|
||||
@@ -76,13 +76,13 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <param name="firstId">The first identifier.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns>ActionResult.</returns>
|
||||
public ActionResult AssignModuleElement(int firstId, string key)
|
||||
public ActionResult AssignModuleElement(Guid firstId, string key)
|
||||
{
|
||||
ViewBag.FirstId = firstId;
|
||||
ViewBag.ModuleType = key;
|
||||
return View();
|
||||
}
|
||||
public string LoadWithAccess(int tId, int firstId, string key)
|
||||
public string LoadWithAccess(Guid tId, Guid firstId, string key)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess(key, firstId, tId));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.App.ViewModel;
|
||||
@@ -26,7 +25,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Assign(int firstId, string key)
|
||||
public ActionResult Assign(Guid firstId, string key)
|
||||
{
|
||||
ViewBag.FirstId = firstId;
|
||||
ViewBag.ModuleType = key;
|
||||
@@ -36,7 +35,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载模块下面的所有模块
|
||||
/// </summary>
|
||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
@@ -61,7 +60,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// </summary>
|
||||
/// <param name="firstId">The user identifier.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public string LoadForUser(int firstId)
|
||||
public string LoadForUser(Guid firstId)
|
||||
{
|
||||
var orgs = _app.LoadForUser(firstId);
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
@@ -72,7 +71,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// </summary>
|
||||
/// <param name="firstId">The role identifier.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public string LoadForRole(int firstId)
|
||||
public string LoadForRole(Guid firstId)
|
||||
{
|
||||
var orgs = _app.LoadForRole(firstId);
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
@@ -102,7 +101,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
foreach (var obj in Id.Split(','))
|
||||
{
|
||||
_app.Delete(int.Parse(obj));
|
||||
_app.Delete(Guid.Parse(obj));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -3,11 +3,8 @@ using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.App.ViewModel;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
@@ -27,7 +24,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public ActionResult Assign(int firstId, string key)
|
||||
public ActionResult Assign(Guid firstId, string key)
|
||||
{
|
||||
ViewBag.FirstId = firstId;
|
||||
ViewBag.ModuleType = key;
|
||||
@@ -39,13 +36,13 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(AuthUtil.GetCurrentUser().AccessedOrgs);
|
||||
}
|
||||
|
||||
public string LoadForUser(int firstId)
|
||||
public string LoadForUser(Guid firstId)
|
||||
{
|
||||
var orgs = _orgApp.LoadForUser(firstId);
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
}
|
||||
|
||||
public string LoadForRole(int firstId)
|
||||
public string LoadForRole(Guid firstId)
|
||||
{
|
||||
var orgs = _orgApp.LoadForRole(firstId);
|
||||
return JsonHelper.Instance.Serialize(orgs);
|
||||
@@ -68,7 +65,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string LoadChildren(int id)
|
||||
public string LoadChildren(Guid id)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_orgApp.LoadAllChildren(id));
|
||||
}
|
||||
@@ -78,7 +75,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <para>Id为逗号分开的字符串</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public string DelOrg(int Id)
|
||||
public string DelOrg(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -20,12 +20,11 @@ namespace OpenAuth.Mvc.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string Assign(string type, int firstId, string secIds)
|
||||
public string Assign(string type, Guid firstId, Guid[] secIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
var secIdList = JsonHelper.Instance.Deserialize<int[]>(secIds);
|
||||
_app.Assign(type, firstId, secIdList);
|
||||
_app.Assign(type, firstId, secIds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -35,12 +34,11 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
[HttpPost]
|
||||
public string UnAssign(string type, int firstId, string secIds)
|
||||
public string UnAssign(string type, Guid firstId, Guid[] secIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
var secIdList = JsonHelper.Instance.Deserialize<int[]>(secIds);
|
||||
_app.UnAssign(type, firstId, secIdList);
|
||||
_app.UnAssign(type, firstId, secIds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载某分类的所有Resources
|
||||
/// </summary>
|
||||
public string Load(int categoryId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid categoryId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(AuthUtil.GetUserName(), categoryId, pageCurrent, pageSize));
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(models);
|
||||
}
|
||||
|
||||
public string Delete(int Id)
|
||||
public string Delete(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -79,7 +79,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <para>如:UserResource/RoleResource</para>
|
||||
/// </param>
|
||||
/// <returns>ActionResult.</returns>
|
||||
public ActionResult AssignRes(int firstId, string key)
|
||||
public ActionResult AssignRes(Guid firstId, string key)
|
||||
{
|
||||
ViewBag.FirstId = firstId;
|
||||
ViewBag.ModuleType = key;
|
||||
@@ -93,7 +93,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <param name="firstId">关联表中的firstId</param>
|
||||
/// <param name="key">关联表中的key</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public string LoadWithAccess(int cId, int firstId, string key)
|
||||
public string LoadWithAccess(Guid cId, Guid firstId, string key)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.LoadWithAccess(AuthUtil.GetUserName(),key,firstId, cId));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载角色下面的所有用户
|
||||
/// </summary>
|
||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
foreach (var obj in Id.Split(','))
|
||||
{
|
||||
_app.Delete(int.Parse(obj));
|
||||
_app.Delete(Guid.Parse(obj));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -68,28 +68,26 @@ namespace OpenAuth.Mvc.Controllers
|
||||
}
|
||||
|
||||
#region 为用户设置角色界面
|
||||
public ActionResult LookupMulti(int userId)
|
||||
public ActionResult LookupMulti(Guid userId)
|
||||
{
|
||||
ViewBag.UserId = userId;
|
||||
return View();
|
||||
}
|
||||
|
||||
public string LoadForOrgAndUser(int orgId, int userId)
|
||||
public string LoadForOrgAndUser(Guid orgId, Guid userId)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.LoadForOrgAndUser(orgId, userId));
|
||||
}
|
||||
|
||||
public string AccessRoles(int userId, string ids)
|
||||
public string AccessRoles(Guid userId, Guid[] ids)
|
||||
{
|
||||
var roleids = JsonHelper.Instance.Deserialize<int[]>(ids);
|
||||
_app.AccessRole(userId, roleids);
|
||||
_app.AccessRole(userId, ids);
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
public string DelAccessRoles(int userId, string ids)
|
||||
public string DelAccessRoles(Guid userId, Guid[] ids)
|
||||
{
|
||||
var roleids = JsonHelper.Instance.Deserialize<int[]>(ids);
|
||||
_app.DelAccessRole(userId, roleids);
|
||||
_app.DelAccessRole(userId, ids);
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载节点下面的所有Stocks
|
||||
/// </summary>
|
||||
public string Load(int parentId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid parentId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(AuthUtil.GetUserName(), parentId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
public string Delete(int Id)
|
||||
public string Delete(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace OpenAuth.Mvc.Controllers
|
||||
/// <summary>
|
||||
/// 加载组织下面的所有用户
|
||||
/// </summary>
|
||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
public string Load(Guid orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
public string Delete(int Id)
|
||||
public string Delete(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
134
OpenAuth.Mvc/Controllers/WorkFlowDesignerController.cs
Normal file
134
OpenAuth.Mvc/Controllers/WorkFlowDesignerController.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class WorkFlowDesignerController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /WorkFlowDesigner/
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Open()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Open_Tree()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
public string GetJSON()
|
||||
{
|
||||
//string flowid = Request.QueryString["flowid"];
|
||||
//string type = Request.QueryString["type"];
|
||||
//if (!flowid.IsGuid())
|
||||
//{
|
||||
// return "{}";
|
||||
//}
|
||||
//var flow = new Business.Platform.WorkFlow().Get(flowid.ToGuid());
|
||||
//if (flow == null)
|
||||
//{
|
||||
return "{}";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return "0" == type ? flow.RunJSON : flow.DesignJSON;
|
||||
//}
|
||||
}
|
||||
|
||||
public ActionResult Set_Flow()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string GetTables()
|
||||
{
|
||||
Response.Charset = "utf-8";
|
||||
//string connID = Request.QueryString["connid"];
|
||||
//if (!connID.IsGuid())
|
||||
//{
|
||||
return "[]";
|
||||
//}
|
||||
//List<string> tables = new Business.Platform.DBConnection().GetTables(connID.ToGuid());
|
||||
//System.Text.StringBuilder sb = new System.Text.StringBuilder("[", 1000);
|
||||
//foreach (string table in tables)
|
||||
//{
|
||||
// sb.Append("{\"name\":");
|
||||
// sb.AppendFormat("\"{0}\"", table);
|
||||
// sb.Append("},");
|
||||
//}
|
||||
//return sb.ToString().TrimEnd(',') + "]";
|
||||
}
|
||||
|
||||
public string GetFields()
|
||||
{
|
||||
string table = Request.QueryString["table"];
|
||||
string connid = Request.QueryString["connid"];
|
||||
|
||||
//if (table.IsNullOrEmpty() || !connid.IsGuid())
|
||||
//{
|
||||
return "[]";
|
||||
//}
|
||||
//Dictionary<string, string> fields = new Business.Platform.DBConnection().GetFields(connid.ToGuid(), table);
|
||||
//System.Text.StringBuilder sb = new System.Text.StringBuilder("[", 1000);
|
||||
|
||||
//foreach (var field in fields)
|
||||
//{
|
||||
// sb.Append("{");
|
||||
// sb.AppendFormat("\"name\":\"{0}\",\"note\":\"{1}\"", field.Key, field.Value);
|
||||
// sb.Append("},");
|
||||
//}
|
||||
//return sb.ToString().TrimEnd(',') + "]";
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Set_Step()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Set_SubFlow()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Set_Line()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Opation()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Save()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Install()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult UnInstall()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult SaveAs()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
OpenAuth.Mvc/Controllers/WorkflowActionProvider.cs
Normal file
34
OpenAuth.Mvc/Controllers/WorkflowActionProvider.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using OpenAuth.App;
|
||||
using OptimaJet.Workflow.Core.Model;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class WorkflowActionProvider :IWorkflowActionProvider
|
||||
{
|
||||
private ModuleManagerApp _app;
|
||||
|
||||
public WorkflowActionProvider()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||
}
|
||||
public void ExecuteAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<string> GetActions()
|
||||
{
|
||||
return new List<string>{"ok"};
|
||||
}
|
||||
}
|
||||
}
|
||||
50
OpenAuth.Mvc/Controllers/WorkflowInit.cs
Normal file
50
OpenAuth.Mvc/Controllers/WorkflowInit.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Xml.Linq;
|
||||
using OptimaJet.Workflow.Core.Builder;
|
||||
using OptimaJet.Workflow.Core.Bus;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using OptimaJet.Workflow.DbPersistence;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class WorkflowInit
|
||||
{
|
||||
private static volatile WorkflowRuntime _runtime;
|
||||
private static readonly object _sync = new object();
|
||||
|
||||
public static WorkflowRuntime Runtime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
if (_runtime == null)
|
||||
{
|
||||
var connectionString = ConfigurationManager.ConnectionStrings["WorkFlow"].ConnectionString;
|
||||
var builder = new WorkflowBuilder<XElement>(
|
||||
new MSSQLProvider(connectionString),
|
||||
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
|
||||
new MSSQLProvider(connectionString)
|
||||
).WithDefaultCache();
|
||||
|
||||
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
|
||||
.WithBuilder(builder)
|
||||
// .WithRuleProvider(new WorkflowRuleProvider())
|
||||
// .WithActionProvider(new WorkflowActionProvider())
|
||||
.WithPersistenceProvider(new MSSQLProvider(connectionString))
|
||||
.WithTimerManager(new TimerManager())
|
||||
.WithBus(new NullBus())
|
||||
.SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn()
|
||||
.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _runtime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
OpenAuth.Mvc/Controllers/WorkflowRuleProvider.cs
Normal file
40
OpenAuth.Mvc/Controllers/WorkflowRuleProvider.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenAuth.App;
|
||||
using OptimaJet.Workflow.Core.Model;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class WorkflowRuleProvider : IWorkflowRuleProvider
|
||||
{
|
||||
private RoleManagerApp _app;
|
||||
|
||||
public WorkflowRuleProvider()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<RoleManagerApp>();
|
||||
}
|
||||
|
||||
public List<string> GetRules()
|
||||
{
|
||||
var roles = _app.Load(Guid.Empty, 1, 100).list;
|
||||
var rolestrs = new List<string>();
|
||||
foreach (var role in roles)
|
||||
{
|
||||
rolestrs.Add(role.Name);
|
||||
}
|
||||
return rolestrs;
|
||||
}
|
||||
|
||||
public bool Check(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName,
|
||||
string parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetIdentities(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user