public ActionResult ReApply(ReApplyViewModel model)
        {
            string     result   = "no";
            WFInstance instance = WFInstanceBll.GetById(model.InstanceId);

            if (instance.InstanceTitle.StartsWith("报销"))
            {
                //WorkFlowHelper.Resume(new Expense(), Guid.Parse(instance.InstanceGuid), "BackInput", new ExpenseModel()
                //{
                //    Reason = model.Reason,
                //    Money = model.Num
                //});
                instance.InstanceTitle = model.InstanceTitle.StartsWith("报销--") ? model.InstanceTitle : "报销--" + model.InstanceTitle;
                instance.Details       = string.Format("事由:{0},金额:{1}元。", model.Reason, model.Num);
            }
            else if (instance.InstanceTitle.StartsWith("请假"))
            {
                //WorkFlowHelper.Resume(new Leave(), Guid.Parse(instance.InstanceGuid), "ReInput", new LeaveModel()
                //{
                //    Reason = model.Reason,
                //    Days = model.Num
                //});
                string title = model.InstanceTitle == "1" ? "事假" : model.InstanceTitle == "2" ? "病假" : "休假";
                instance.InstanceTitle = "请假--" + title;
                instance.Details       = string.Format("事由:{0},天数:{1}天。", model.Reason, model.Num);
            }
            else
            {
                return(Content("no"));
            }
            instance.InstanceState = (int)InstanceState.Approving;
            instance.RejectMsg     = "";
            instance.Remark        = model.Remark;
            instance.WFStep.Add(new WFStep()
            {
                IsEnd   = 0,
                NextId  = model.NextId,
                SubBy   = UserLogin.UserId,
                SubTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
            });
            if (WFInstanceBll.Edit(instance))
            {
                result = "ok";
            }
            return(Content(result));
        }
        public ActionResult Approve(ApproveViewModel model)
        {
            string     result    = "no";
            WFInstance wInstance = WFInstanceBll.GetById(model.InstanceId);

            //int status = !model.Approve ? -1 : model.Approve && model.NextId == 0 ? 1 : 0;
            //if (wInstance.InstanceTitle.StartsWith("报销"))
            //{
            //    WorkFlowHelper.Resume(new Expense(), Guid.Parse(wInstance.InstanceGuid), "Check", status);
            //}
            //else if (wInstance.InstanceTitle.StartsWith("请假"))
            //{
            //    WorkFlowHelper.Resume(new Leave(), Guid.Parse(wInstance.InstanceGuid), "LeaveCheck", status);
            //}
            //else
            //{
            //    return Content("no");
            //}
            wInstance.WFStep.Add(new WFStep
            {
                Tips    = string.IsNullOrWhiteSpace(model.Tips) ? "" : model.Approve ? "同意,意见为:" + model.Tips : "驳回,意见为:" + model.Tips,
                NextId  = model.NextId,
                SubBy   = UserLogin.UserId,
                SubTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                IsEnd   = model.NextId == 0 ? (byte)1 : (byte)0
            });
            if (model.Approve && model.NextId == 0)
            {
                wInstance.InstanceState = (int)InstanceState.Over;
            }
            else if (!model.Approve)
            {
                wInstance.InstanceState = (int)InstanceState.Reject;
            }
            wInstance.RejectMsg = model.Tips;
            WFStepBll.GetById(model.StepId).IsEnd = 1;
            if (WFInstanceBll.Edit(wInstance))
            {
                result = "ok";
            }
            return(Content(result));
        }