Ejemplo n.º 1
0
        public ActionResult ReadKendo([DataSourceRequest] DataSourceRequest request, int ProcessTemplateID = 0)
        {
            IEnumerable <FlowTemplate> list;

            if (ProcessTemplateID == 0)
            {
                list = _FlowTemplateService.GetAll();
            }
            else
            {
                list = _FlowTemplateService.FindBy(t => t.InitialState.ParentProcessTemplateID == ProcessTemplateID);
            }

            return(Json(toFlowTemplatePOCOList(list).ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
        public ActionResult PromoteList(List <ProcessTemplateViewModel> requests, int transporterId, string actionType)
        {
            if (requests != null)
            {
                var          type    = typeof(ActionType);
                MemberInfo[] memInfo = null;

                if (String.Compare(actionType, Enum.GetName(typeof(ActionType), ActionType.Finance), true) == 0)
                {
                    memInfo = type.GetMember(ActionType.Finance.ToString());
                }

                if (String.Compare(actionType, Enum.GetName(typeof(ActionType), ActionType.Approve), true) == 0)
                {
                    memInfo = type.GetMember(ActionType.Approve.ToString());
                }

                var attributes    = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                var description   = ((DescriptionAttribute)attributes[0]).Description;
                var templateModel = _flowTemplateService.FindBy(o => o.Name == description).First();

                if (templateModel != null)
                {
                    requests.ForEach(o => o.StateID = templateModel.FinalStateID);
                }

                var processTemplates = ProcessTemplateViewModelBinder.BindProcessTemplateViewModel(requests);

                foreach (var oTemplate in processTemplates)
                {
                    _BusinessProcessService.PromotWorkflow(oTemplate);
                }
            }

            return(RedirectToAction("PaymentRequests", "TransporterPaymentRequest",
                                    new { Area = "Logistics", transporterId }));
        }