如何将 WorkFlow 与 ASP.NET MVC 应用程序一起使用?
我在 asp.net mvc 3 中有一个编辑销售发票页面,看起来像
在此页面上“保存“是普通的过账按钮,它将保存在此屏幕上对发票所做的任何更改。但是,显示“提交审批”的下一个按钮会动态呈现在页面上,并取决于销售发票的当前工作流程阶段。由于该发票处于初始阶段,因此我们有“提交审批”按钮。
我想要的是执行按下此按钮时要执行的一些工作流程活动,并且发票数据也应该更新。如果没有工作流程,我的 Post 操作非常标准,看起来
[HttpPost]
public ActionResult editsales(EFModel.VMSale sale,string save)
{
EFModel.SalesRepository _salesRepository = new EFModel.SalesRepository();
EFModel.VoucherRepository _voucherRepository = new EFModel.VoucherRepository();
EFModel.scmSale oldSaleObj = _salesRepository.GetSaleObjBySaleID(sale.SaleID);
if (ModelState.IsValid)
{
Mapper.CreateMap<EFModel.VMSaleLine, UserManagement.EFModel.scmSalesLine>();
Mapper.CreateMap<UserManagement.EFModel.VMSale, UserManagement.EFModel.scmSale>();
var newSaleObj = Mapper.Map<UserManagement.EFModel.VMSale, UserManagement.EFModel.scmSale>(sale);
_salesRepository.UpdateSaleInvoice(newSaleObj, oldSaleObj);
_salesRepository.Save();
return RedirectToAction("listinvoice");
}
我还需要从 UI 引入一些与工作流程相关的字段(描述、转发等)。此外,描述和转发字段需要由工作流处理并保存到数据库。目前我对如何解决这个问题有点迷失。
I have a edit sales invoice page in asp.net mvc 3 that looks something like
On this page "save" is normal Post button which will save any changes to the invoice made at this screen. However, next button that reads "Sumbmit for Approval" is dynamically rendered on the page and depends upon the current workflow stage of the sales invoice. Since this invoice is in initial stage that's why we have "submit for Approval" button.
What I want is to perform some workflow activities to be performed when this button is pressed and also the data of invoice should be updated as well. Without workflow my Post action is quite standard and looks something like
[HttpPost]
public ActionResult editsales(EFModel.VMSale sale,string save)
{
EFModel.SalesRepository _salesRepository = new EFModel.SalesRepository();
EFModel.VoucherRepository _voucherRepository = new EFModel.VoucherRepository();
EFModel.scmSale oldSaleObj = _salesRepository.GetSaleObjBySaleID(sale.SaleID);
if (ModelState.IsValid)
{
Mapper.CreateMap<EFModel.VMSaleLine, UserManagement.EFModel.scmSalesLine>();
Mapper.CreateMap<UserManagement.EFModel.VMSale, UserManagement.EFModel.scmSale>();
var newSaleObj = Mapper.Map<UserManagement.EFModel.VMSale, UserManagement.EFModel.scmSale>(sale);
_salesRepository.UpdateSaleInvoice(newSaleObj, oldSaleObj);
_salesRepository.Save();
return RedirectToAction("listinvoice");
}
I would also need to bring some work flow related fields from UI as well (description, forwardTo, etc). Moreover the description and forward to fields need to be processed and saved to db by workFlow. Currently I'm a bit lost about how to target this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 msdn 论坛 为我指明了正确的方向。尽管我仍在努力使其工作,但该解决方案是有效的,并且也许是我可以使用 mvc 框架找到的唯一详细的工作流程示例。
I found an answer at msdn forum which has set me in the right direction. Although I'm still struggling to make it work yet the solution is effective and perhaps only detailed example of workflow that I could find with mvc framework.