forked from SeriaWei/ZKEACMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
316 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/ZKEACMS.EventAction/Controllers/PendingTaskController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* http://www.zkea.net/ | ||
* Copyright (c) ZKEASOFT. All rights reserved. | ||
* http://www.zkea.net/licenses */ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Easy.Mvc.Controllers; | ||
using ZKEACMS.EventAction.Service; | ||
using Easy.Mvc.Authorize; | ||
using ZKEACMS.EventAction.Models; | ||
using Easy.Constant; | ||
|
||
namespace ZKEACMS.EventAction.Controllers | ||
{ | ||
[DefaultAuthorize(Policy = PermissionKeys.ViewEventAction)] | ||
public class PendingTaskController : BasicController<Models.PendingTaskEntity, int, IPendingTaskManagerService> | ||
{ | ||
public PendingTaskController(IPendingTaskManagerService service) : base(service) | ||
{ | ||
} | ||
|
||
[HttpPost, DefaultAuthorize(Policy = PermissionKeys.ManageEventAction)] | ||
public override IActionResult Edit(Models.PendingTaskEntity entity) | ||
{ | ||
entity.RetryCount = 0; | ||
entity.Status = (int)RecordStatus.Active; | ||
entity.LogMessage = null; | ||
return base.Edit(entity); | ||
} | ||
|
||
[HttpPost, DefaultAuthorize(Policy = PermissionKeys.ManageEventAction)] | ||
public override IActionResult Create(Models.PendingTaskEntity entity) | ||
{ | ||
return base.Create(entity); | ||
} | ||
|
||
[HttpPost, DefaultAuthorize(Policy = PermissionKeys.ManageEventAction)] | ||
public override IActionResult Delete(int id) | ||
{ | ||
return base.Delete(id); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* http://www.zkea.net/ | ||
* Copyright (c) ZKEASOFT. All rights reserved. | ||
* http://www.zkea.net/licenses */ | ||
|
||
using Easy.MetaData; | ||
using Easy.Models; | ||
using Easy.RepositoryPattern; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using ZKEACMS.PendingTask; | ||
|
||
namespace ZKEACMS.EventAction.Models | ||
{ | ||
[DataTable("EA_PendingTask")] | ||
public class PendingTaskEntity : EditorEntity, TaskEntity | ||
{ | ||
[Key] | ||
public int ID { get; set; } | ||
public string Identifier { get; set; } | ||
public string HandlerName { get; set; } | ||
public string Data { get; set; } | ||
public string LogMessage { get; set; } | ||
public int RetryCount { get; set; } | ||
} | ||
class PendingTaskEntityMetaData : ViewMetaData<PendingTaskEntity> | ||
{ | ||
protected override void ViewConfigure() | ||
{ | ||
ViewConfig(m => m.ID).AsHidden(); | ||
ViewConfig(m => m.Identifier).AsTextBox().Required().ShowInGrid(); | ||
ViewConfig(m => m.HandlerName).AsTextBox().ShowInGrid().Required(); | ||
ViewConfig(m => m.Data).AsTextArea().AddProperty("rows", "10"); | ||
ViewConfig(m => m.LogMessage).AsTextArea().AddProperty("rows", "10").ReadOnly(); | ||
ViewConfig(m => m.RetryCount).AsTextBox().ReadOnly().ShowInGrid(); | ||
ViewConfig(m => m.Title).AsHidden(); | ||
ViewConfig(m => m.Description).AsHidden(); | ||
|
||
ViewConfig(m => m.CreatebyName).AsHidden(); | ||
ViewConfig(m => m.LastUpdateByName).AsHidden(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/ZKEACMS.EventAction/Service/IPendingTaskManagerService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* http://www.zkea.net/ | ||
* Copyright (c) ZKEASOFT. All rights reserved. | ||
* http://www.zkea.net/licenses */ | ||
|
||
using Easy.RepositoryPattern; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using ZKEACMS.EventAction.Models; | ||
|
||
namespace ZKEACMS.EventAction.Service | ||
{ | ||
public interface IPendingTaskManagerService : IService<PendingTaskEntity> | ||
{ | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/ZKEACMS.EventAction/Service/PendingTaskManagerService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* http://www.zkea.net/ | ||
* Copyright (c) ZKEASOFT. All rights reserved. | ||
* http://www.zkea.net/licenses */ | ||
|
||
using Easy; | ||
using Easy.RepositoryPattern; | ||
using Microsoft.EntityFrameworkCore; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using ZKEACMS.EventAction.Models; | ||
|
||
namespace ZKEACMS.EventAction.Service | ||
{ | ||
public class PendingTaskManagerService : ServiceBase<PendingTaskEntity>, IPendingTaskManagerService | ||
{ | ||
public PendingTaskManagerService(IApplicationContext applicationContext, DbContext dbContext) : base(applicationContext, dbContext) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@model ZKEACMS.EventAction.Models.PendingTaskEntity | ||
@{ | ||
Script.Reqiured("validate").AtFoot(); | ||
Script.Reqiured("tinymce").AtFoot(); | ||
} | ||
|
||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
@L("New") | ||
</div> | ||
<div class="panel-body"> | ||
@using (Html.BeginForm()) | ||
{ | ||
@Html.EditorForModel() | ||
<div class="toolBar"> | ||
@if (Authorizer.Authorize(ZKEACMS.EventAction.PermissionKeys.ManageEventAction)) | ||
{ | ||
<input type="submit" class="btn btn-primary" value="@L("Save")" data-value="@ActionType.Update" /> | ||
} | ||
<input type="button" class="btn btn-default cancel" value="@L("Cancel")" /> | ||
</div> | ||
} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@model ZKEACMS.EventAction.Models.PendingTaskEntity | ||
@{ | ||
Script.Reqiured("validate").AtFoot(); | ||
Script.Reqiured("tinymce").AtFoot(); | ||
} | ||
|
||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
@L("Edit") | ||
</div> | ||
<div class="panel-body"> | ||
@using (Html.BeginForm()) | ||
{ | ||
@Html.EditorForModel() | ||
<div class="toolBar"> | ||
@if (Authorizer.Authorize(ZKEACMS.EventAction.PermissionKeys.ManageEventAction)) | ||
{ | ||
<input type="submit" class="btn btn-primary" value="@L("Retry")" data-value="@ActionType.Update" /> | ||
} | ||
<input type="button" class="btn btn-default cancel" value="@L("Cancel")" /> | ||
</div> | ||
} | ||
</div> | ||
</div> |
Oops, something went wrong.