开发者

How to use WorkFlow with asp.net mvc application?

开发者 https://www.devze.com 2023-04-12 23:39 出处:网络
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, nex

I have a edit sales invoice page in asp.net mvc 3 that looks something like

How to use WorkFlow with asp.net mvc application?

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 _开发者_C百科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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号