Git Product home page Git Product logo

lmy.workflow's Introduction

lmy.workflow

LMY.workflow is a powerful workflow engine that simplifies simple and complex workflow problems.

LMY.workflow provides a simple and efficient way to develop workflows in your system.

Whether you are dealing with simple or complex workflows, LMY.workflow can handle it all.

it is built using .net 6

How To Use

1 - Include LMY.WorkFlow in your project.

2 - build your workflow configuration file (check workflow sample wf.config.json).

3 - add below to program.cs

builder.Services
.AddLMYWFEngineMSSQL()
.AddLMYWFEngine();

builder.UseLMYWFEngine(o =>
{
    o.WorkFlowsConfigFilePath = @"C:\wf.config.json";
    o.DBConnectionString = @"Server=.\SQLEXPRESS;Database=testdb;Integrated Security=SSPI;";
});

4 - once you have included the LMYEngine, you can now inject the ILMYWFEngine whenever you need it, making it available for use throughout your application

ILMYWFEngine lmyWFEngine;
public TestController(ILMYWFEngine _lmyWFEngine)
{
    lmyWFEngine= _lmyWFEngine;
}

5 - now you can start work flow like below

var result = lmyWFEngine.StartNew("LeaveRequestWF", "user1");
var LMYWFEngineRequestID = result.MethodResult;//started worklfow id

6 -you can get available actions (transitions) for specific workflow (you need to pass workflowid and current user groups )

var transitions =lmyWFEngine.GetAvailableTransitions("LeaveRequestWF", LMYWFEngineRequestID, "user1", new string[] { "DataEntry", "Leader" });

7 - process taken action (transition)

var moveNextResult = lmyWFEngine.MoveNext("LeaveRequestWF", LMYWFEngineRequestID, transitions.MethodResult[0].LMYWFEngineTransitionID, transitions.MethodResult[0].LMYWFEngineRequestVersionID, "user1", new string[] { "DataEntry", "Leader" }, true, "{you can include here whatever data you want}");

8 - you can get current user tasks (based on provided user groups)

int total = 0;

var tasks = lmyWFEngine.GetTasks("LeaveRequestWF", "user1", new string[] { "DataEntry", "Leader" }, 1, 10, out total);

0 - sample for a work flow drawing

{
  "WorkFlows": [
    {
      "WorkFlowName": "LeaveRequestWF",
      "Transitions": [
        {
          "UserGroups": [
            "DataEntry"
          ],
          "TransitionName": "Save As Draft",
          "CurrentStatuses": [
            null,
            "DataEntryDraft",
            "ReturnedFromLeader",
            "ReturnedByManagerToDataEntry"
          ],
          "NextStatus": "DataEntryDraft",
          "TransitionPageName": "SavePage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "DataEntry"
          ],
          "TransitionName": "Send To Leader",
          "CurrentStatuses": [
            null,
            "DataEntryDraft",
            "ReturnedFromLeader",
            "ReturnedByManagerToDataEntry"
          ],
          "NextStatus": "SentToLeader",
          "TransitionPageName": "SavePage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Leader"
          ],
          "TransitionName": "Return",
          "CurrentStatuses": [
            "SentToLeader",
            "LeaderDraft"
          ],
          "NextStatus": "ReturnedFromLeader",
          "TransitionPageName": "LeaderApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Leader"
          ],
          "TransitionName": "Reject",
          "CurrentStatuses": [
            "SentToLeader",
            "LeaderDraft"
          ],
          "NextStatus": "RejectedByLeader",
          "TransitionPageName": "LeaderApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Leader"
          ],
          "TransitionName": "Edit And Save",
          "CurrentStatuses": [
            "SentToLeader",
            "LeaderDraft",
            "ReturnedByManagerToLeader"
          ],
          "NextStatus": "LeaderDraft",
          "TransitionPageName": "LeaderApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Leader"
          ],
          "TransitionName": "Approve",
          "CurrentStatuses": [
            "SentToLeader",
            "LeaderDraft",
            "ReturnedByManagerToLeader"
          ],
          "NextStatus": "SentToManager",
          "TransitionPageName": "LeaderApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Manager"
          ],
          "TransitionName": "Edit And Save",
          "CurrentStatuses": [
            "SentToManager",
            "ManagerDraft"
          ],
          "NextStatus": "ManagerDraft",
          "TransitionPageName": "ManagerApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Manager"
          ],
          "TransitionName": "Return To Leader",
          "CurrentStatuses": [
            "SentToManager",
            "ManagerDraft"
          ],
          "NextStatus": "ReturnedByManagerToLeader",
          "TransitionPageName": "ManagerApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Manager"
          ],
          "TransitionName": "Return To Data Entry",
          "CurrentStatuses": [
            "SentToManager",
            "ManagerDraft"
          ],
          "NextStatus": "ReturnedByManagerToDataEntry",
          "TransitionPageName": "ManagerApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Manager"
          ],
          "TransitionName": "Reject",
          "CurrentStatuses": [
            "SentToManager",
            "ManagerDraft"
          ],
          "NextStatus": "RejectedByManager",
          "TransitionPageName": "ManagerApprovalPage",
          "TransitionCustomData": {}
        },
        {
          "UserGroups": [
            "Manager"
          ],
          "TransitionName": "Approve",
          "CurrentStatuses": [
            "SentToManager",
            "ManagerDraft"
          ],
          "NextStatus": "ApprovedByManager",
          "TransitionPageName": "ManagerApprovalPage",
          "TransitionCustomData": {}
        }
      ]
    }
  ]
}
 

lmy.workflow's People

Contributors

laythm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.