/// <summary>
        /// 发起流程
        /// </summary>
        /// wangpf  15.11.24
        /// <param name="action">当前流程行为实体</param>
        /// <param name="toDoWork">下一个任务实体</param>
        /// <param name="processUserId">当前用户ID</param>
        /// <param name="instanceData">关联的数据</param>
        /// <returns></returns>
        public bool Start(FlowAction action, ToDoWorkInfo toDoWork, int processUserId, string instanceData)
        {
            bool result = true;
            //1.新建流程实例
            InstanceInfo1 instance = new InstanceInfo1()
            {
                WorkFlowId  = toDoWork.nodeInfo.FlowId,
                ProcessUser = processUserId,
                ProcessTime = DateTime.Now,
                StartUser   = processUserId,
                StartTime   = DateTime.Now,
                Status      = (byte)FlowStatus.流转
            };
            int instanceId = (int)this.ProcessClass.NewFlowInstance(instance);
            //2.1 下一个处理者ID
            var nextUserId = this.IFindUserMechanism.FindUser();

            //3.更新流程实例
            result &= this.ContinueProcess(toDoWork, instanceId, nextUserId, processUserId);
            //4.节点通知处理
            result &= NewNodeMessage((int)toDoWork.action.ToNode, nextUserId, "", 1);
            //5.记录流程日志
            string content = string.Format("用户" + this.ProcessClass.GetUserByUserID(processUserId).Username + "发起了流程");

            result &= NewFlowLog(instanceId, (int)toDoWork.action.Node, (int)toDoWork.action.ID, processUserId, content);

            return(result);
        }
Exemple #2
0
        private static FlowActionRequest saveToDB(FlowAction incomingReq)
        {
            using (var db = new EnouFlowInstanceContext())
            {
                var dbReq = db.flowActionRequests.Create();
                dbReq.requestType         = incomingReq.requestType;
                dbReq.clientRequestGuid   = incomingReq.clientRequestGuid;
                dbReq.bizDocumentGuid     = incomingReq.bizDocumentGuid;
                dbReq.bizDocumentTypeCode = incomingReq.bizDocumentTypeCode;
                if (incomingReq.flowInstanceId > 0) // 穿入了有效的flowInstanceId
                {
                    dbReq.flowInstance     = FlowInstanceHelper.GetFlowInstance(incomingReq.flowInstanceId, db);
                    dbReq.flowInstanceGuid = incomingReq.flowInstanceGuid;
                }
                dbReq.userMemo                   = incomingReq.userMemo;
                dbReq.bizDataPayloadJson         = incomingReq.bizDataPayloadJson;
                dbReq.concreteFlowActionMetaJson = incomingReq.concreteFlowActionMetaJson;
                dbReq.optionalFlowActionDataJson = incomingReq.optionalFlowActionDataJson;
                dbReq.userId            = incomingReq.userId;
                dbReq.userGuid          = incomingReq.userGuid;
                dbReq.delegateeUserId   = incomingReq.delegateeUserId;
                dbReq.delegateeUserGuid = incomingReq.delegateeUserGuid;

                db.flowActionRequests.Add(dbReq);
                db.SaveChanges();

                return(dbReq);
            }
        }
Exemple #3
0
 public static void CopyWorkflowToStepHis(WorkflowDbContext wfContext, WF_WORKFLOW_INST workflowRow,
                                          WF_STEP_INST_HIS stepRow, FlowAction flowAction)
 {
     // stepRow.SI_INDEX = workflowRow.WI_INDEX;
     stepRow.SI_INDEX = workflowRow.WI_INDEX;
     //步骤标识 0 -- 有效初始值  1 -- 无效的
     stepRow.SI_VALID_FLAG = 0;
     stepRow.SI_VALID_FLAG = 0;
     //流转方式
     stepRow.SI_FLOW_TYPE = (int?)flowAction;
     ////步骤基本信息
     stepRow.SI_ID    = wfContext.GetUniId();
     stepRow.SI_WI_ID = workflowRow.WI_ID;
     ////上一步骤信息
     stepRow.SI_LAST_STEP        = workflowRow.WI_LAST_STEP;
     stepRow.SI_LAST_STEP_NAME   = workflowRow.WI_LAST_STEP_NAME;
     stepRow.SI_LAST_MANUAL      = workflowRow.WI_LAST_MANUAL;
     stepRow.SI_LAST_MANUAL_NAME = workflowRow.WI_LAST_MANUAL_NAME;
     ////当前步骤
     stepRow.SI_CURRENT_STEP      = workflowRow.WI_CURRENT_STEP;
     stepRow.SI_CURRENT_STEP_NAME = workflowRow.WI_CURRENT_STEP_NAME;
     stepRow.SI_STEP_TYPE         = workflowRow.WI_STEP_TYPE;
     stepRow.SI_PRIORITY          = workflowRow.WI_PRIORITY;
     stepRow.SI_STATUS            = workflowRow.WI_STATUS ?? 0;
     ////当前步骤 时间信息:开始时间 结束时间 步骤用时
     stepRow.SI_START_DATE = workflowRow.WI_CURRENT_CREATE_DATE;
     stepRow.SI_END_DATE   = wfContext.Now;
     stepRow.SI_TIME_SPAN  = (double)((wfContext.Now - stepRow.SI_START_DATE.Value <DateTime>()).Ticks)
                             / TimeSpan.TicksPerDay;
     ////发送时间
     stepRow.SI_SEND_DATE = workflowRow.WI_SEND_DATE;
 }
Exemple #4
0
 private bool updateBizDataPayloadJsonOfFlowInst(FlowInstance flowInst,
                                                 FlowAction req)
 {
     if (!string.IsNullOrEmpty(req.bizDataPayloadJson))
     {
         flowInst.bizDataPayloadJson = req.bizDataPayloadJson;
         return(true);
     }
     return(false);
 }
Exemple #5
0
        public InvokeResult UpdateBaseResidentsAll(FlowAction flowAction)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };
            //流转状态  0-正流,1-逆流  默认正流,正流(当前状态加上当前操作);逆流(当前状态)
            int iAction = 0;

            if (flowAction.FlowType == 0)
            {
                //默认正向流转
                iAction += flowAction.ProcessAction;
            }

            try
            {
                FlowDefineMapping flowDefineMapping = BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).List <FlowDefineMapping>(new { MappingType = flowAction.MappingType, MappingColumn = flowAction.MappingColumn, MappingId = flowAction.MappingId }.ToStringObjectDictionary()).First();
                if (flowDefineMapping != null && !string.IsNullOrEmpty(flowDefineMapping.FlowName))
                {
                    flowAction.FlowName = flowDefineMapping.FlowName;
                }

                //找出当前流程的最高去处和默认去处
                IList <FlowDefine> flowDefineList = BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).List <FlowDefine>(new { FlowName = flowAction.FlowName, TableName = flowAction.TableName, TableColumn = flowAction.TableColumn, Status = 1, OrderByClause = " FlowTo ,CurrentState " }.ToStringObjectDictionary());

                //如果是流程到了最顶级的话或者未进入流程或者切换流程则跳回当前流程默认的最低级别,以达到重新开始流转效果
                string sql = "update {1} set Status=1 where {0} in (";

                sql += "select x.{0} From  (" +
                       "select a.{0},MAX(b.Id) as FId From {1} a left join Pub_Flow b  on a.{0}=b.BIZ_ID " +
                       "where a.{4}= '{5}'  ";

                if (!string.IsNullOrEmpty(flowAction.WhereClause))
                {
                    sql += " and " + flowAction.WhereClause;
                }

                sql += "group by a.{0} ) x left join Pub_Flow y on x.FId=y.Id  left join Pub_FlowDefine z on  y.FlowDefineId=z.FlowDefineId " +
                       "where z.FlowName='{2}' and z.TableName='{1}' and z.TableColumn='{0}' and y.FlowTo = {3}";

                sql += ")";

                string statements = string.Format(sql, flowAction.TableColumn, flowAction.TableName, flowAction.FlowName,
                                                  flowDefineList.Last().FlowTo, flowAction.MappingColumn, flowAction.MappingId);

                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 发起流程
        /// </summary>
        /// wangpf  15.11.25
        /// <param name="workFlowId">流程ID</param>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        public bool StartProcess(int workFlowId, int userId, string instanceData)
        {
            bool result = false;

            FlowAction   action   = this.WorkFlowEngineCore.GetStartAction(workFlowId);
            ToDoWorkInfo toDoWork = this.WorkFlowEngineCore.GetToDoWork((int)action.ID);

            this.WorkFlowEngineCore.IFindUserMechanism = new FindOnlyUser(toDoWork.nodeInfo.RoleId);
            result = this.WorkFlowEngineCore.Start(action, toDoWork, userId, instanceData);

            return(result);
        }
Exemple #7
0
        private FlowActionResult processAction(FlowAction req)
        {
            if (req == null)
            {
                return(null);
            }

            var engine = new FlowEngine();
            FlowActionResult result = null;

            switch (req.requestType)
            {
            case EnumFlowActionRequestType.start:
                result = engine.processActionRequest((FlowActionStart)req);
                break;

            case EnumFlowActionRequestType.moveTo:
                result = engine.processActionRequest((FlowActionMoveTo)req);
                break;

            case EnumFlowActionRequestType.moveToAutoGenerated:
                result = engine.processActionRequest((FlowActionMoveToAutoGenerated)req);
                break;

            case EnumFlowActionRequestType.rejectToStart:
                result = engine.processActionRequest((FlowActionRejectToStart)req);
                break;

            case EnumFlowActionRequestType.inviteOther:
                result = engine.processActionRequest((FlowActionInviteOther)req);
                break;

            case EnumFlowActionRequestType.inviteOtherFeedback:
                result = engine.processActionRequest((FlowActionInviteOtherFeedback)req);
                break;

            case EnumFlowActionRequestType.jumpTo:
                result = engine.processActionRequest((FlowActionJumpTo)req);
                break;

            case EnumFlowActionRequestType.terminate:
                result = engine.processActionRequest((FlowActionTerminate)req);
                break;

            default:
                throw new Exception(req.requestType.ToString() +
                                    " of EnumFlowActionRequestType not implemented !");
            }

            return(result);
        }
 private void PerformScreenActions(FlowAction action)
 {
     if (action == FlowAction.Clear)
     {
         previousPanelStack.Peek().Clear();
     }
     else
     {
         if (action == FlowAction.Load)
         {
             previousPanelStack.Peek().Load();
         }
     }
 }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            MongoRepository.MongoRepository<Basla> repo = new MongoRepository<Basla>();
            repo.DeleteAll();
            Basla b = new Basla();
            FlowAction a = new FlowAction();
            b.SonrakiEleman = a;
            repo.Add(b);

            var txxx = repo.Where(t => t.Id != null).ToList();

        }
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            MongoRepository.MongoRepository <Basla> repo = new MongoRepository <Basla>();
            repo.DeleteAll();
            Basla      b = new Basla();
            FlowAction a = new FlowAction();

            b.SonrakiEleman = a;
            repo.Add(b);

            var txxx = repo.Where(t => t.Id != null).ToList();
        }
Exemple #11
0
        private bool isBizTimeStampValid(DateTime bizTimeStamp, FlowAction req,
                                         FlowInstance flowInst, out string failReason)
        {
            if (bizTimeStamp < flowInst.bizTimeStamp)
            {
                failReason = "bizTimeStamp expired, 业务时间戳已过期无效.";

                //修改,根据函数名称,只检查,不更新数据库状态,由外部调用者自行更新
                //var reqInDb = db.flowActionRequests.Find(req.flowActionRequestId);
                //reqInDb.isProcessed = true;
                //reqInDb.finishTime = DateTime.Now;
                //reqInDb.failReason = failReason;

                //db.SaveChanges();
                return(false);
            }

            failReason = null;
            return(true);
        }
Exemple #12
0
        public void ProcessRequest(HttpContext context)
        {
            string                id           = context.Request["id"];
            string                websiteOwner = bllFlow.WebsiteOwner;
            FlowAction            act          = bllFlow.GetByKey <FlowAction>("AutoID", id, websiteOwner: websiteOwner);
            List <FlowActionFile> actFiles     = bllFlow.GetActionFiles(websiteOwner, act.AutoID, act.FlowID);
            List <string>         files        = new List <string>();

            if (actFiles.Count > 0)
            {
                files = actFiles.Select(p => p.FilePath).Distinct().ToList();
            }
            FlowActionDetail endStepAct = bllFlow.GetEndActionDetail(websiteOwner, act.AutoID, act.FlowID);

            apiResp.code   = (int)APIErrCode.IsSuccess;
            apiResp.status = true;
            apiResp.msg    = "查询完成";
            apiResp.result = new
            {
                id            = act.AutoID,
                flowname      = act.FlowName,
                stepname      = act.StepName,
                flow_key      = act.FlowKey,
                amount        = act.Amount,
                true_amount   = act.TrueAmount,
                deduct_amount = act.DeductAmount,
                status        = act.Status,
                ex1           = act.StartEx1,
                ex2           = act.StartEx2,
                ex3           = act.StartEx3,
                content       = act.StartContent,
                select_date   = act.StartSelectDate.ToString("yyyy/MM/dd HH:mm:ss"),
                start         = act.CreateDate.ToString("yyyy/MM/dd HH:mm:ss"),
                end           = act.EndDate.ToString("yyyy/MM/dd HH:mm:ss"),
                cancel_date   = act.CancelDate.ToString("yyyy/MM/dd HH:mm:ss"),
                end_content   = endStepAct != null && !string.IsNullOrWhiteSpace(endStepAct.HandleContent) ?endStepAct.HandleContent:"",
                files         = files
            };
            bllFlow.ContextResponse(context, apiResp);
        }
Exemple #13
0
        private void ExecuteAction(IObjectSpace newFormOs, 单据 fromObject, FlowAction action)
        {
            //action数据是来自于 初始化按钮时的os,它可能不是当前objectspace
            action = ObjectSpace.GetObject(action);
            var os = new NonPersistentObjectSpace(null);


            var toType = ReflectionHelper.FindType(action.To.Form);

            #region 生成目标单据主表属性
            单据 toObject = null;
            //查找当前单据是从那张单据生成过来的
            var record = ObjectSpace.FindObject <单据流程状态记录>(CriteriaOperator.Parse("目标单据=?", CurrentObject.GetMemberValue("Oid").ToString()));

            if (action.目标类型 == 目标类型.生成单据)
            {
                toObject = newFormOs.CreateObject(toType) as 单据;
            }
            else if (action.目标类型 == 目标类型.更新单据)
            {
                var history = ObjectSpace.FindObject <单据流程状态记录>(CriteriaOperator.Parse("来源单据=? and 执行动作.Oid=?", CurrentObject.GetMemberValue("Oid").ToString(), action.Oid));
                if (history != null)
                {
                    //更新动作已经执行过了,不要再执行。
                    return;
                }

                //如果是更新单据,那必然是有已经生成过的单据。
                if (record != null)
                {
                    toObject = newFormOs.GetObject(record.来源单据); // newFormOs.GetObjectByStringKey(action.ToType, record.来源单据) as 单据;
                }
                else
                {
                    return;
                }
                if (toObject == null)
                {
                    return;
                }
            }

            var clsname                    = action.GetFlowLogicClassFullName();
            var actionLogicType            = ReflectionHelper.FindType(clsname);
            IExecuteFlowAction actionLogic = null;
            if (actionLogicType != null)
            {
                actionLogic = Activator.CreateInstance(actionLogicType) as IExecuteFlowAction;
                if (actionLogic != null)
                {
                    actionLogic.ExecuteMasterCore(fromObject, toObject);
                }
            }

            #endregion

            #region 生成目标单据子表记录
            var fromItems  = fromObject.GetMemberValue("明细项目") as XPBaseCollection;
            var toItems    = toObject.GetMemberValue("明细项目") as XPBaseCollection;
            var toItemType = toItems.GetObjectClassInfo().ClassType;
            //来源单据的明细,当前单据
            var detailRecords = new List <Tuple <string, string> >();
            foreach (XPBaseObject item in fromItems)
            {
                //查找记录?
                XPBaseObject toItem = null;
                if (action.目标类型 == 目标类型.更新单据)
                {
                    //如果是更新单据(反写)时,没有找到反写目标明细,则继续。忽略当前条目。
                    //recs可以查到来源明细
                    //
                    var recs = record.明细.FirstOrDefault(x => x.目标 == item.GetMemberValue("Oid").ToString());
                    toItem = (toObject.GetMemberValue("明细项目") as IList).OfType <BaseObject>().FirstOrDefault(x => x.Oid.ToString() == recs.来源);
                    if (toItem == null)
                    {
                        continue;
                    }
                }
                else if (action.目标类型 == 目标类型.生成单据)
                {
                    toItem = newFormOs.CreateObject(toItemType) as XPBaseObject;
                }
                else
                {
                    throw new Exception("未处理的目标类型!");
                }
                toItems.BaseAdd(toItem);

                if (actionLogic != null)
                {
                    actionLogic.ExecuteChildrenCore(item, toItem);
                }
                //foreach (var f in action.ItemsMapping)
                //{
                //    var fromValue = item.Evaluate(f.FromProperty.Name);
                //    toItem.SetMemberValue(f.ToProperty.Name, fromValue);
                //}

                detailRecords.Add(new Tuple <string, string>(item.GetMemberValue("Oid").ToString(), toItem.GetMemberValue("Oid").ToString()));
            }

            #region 生成主表记录
            EventHandler act = null;
            act = (snd, evt) =>
            {
                newFormOs.Committed -= act;
                var process = ObjectSpace.CreateObject <单据流程状态记录>();
                process.来源单据 = this.CurrentObject as 单据;
                process.目标单据 = this.ObjectSpace.GetObject(toObject);

                process.执行动作 = action;
                process.业务项目 = process.来源单据.业务项目;
                foreach (var item in detailRecords)
                {
                    var det = ObjectSpace.CreateObject <单据流程记录明细>();
                    det.来源 = item.Item1;
                    det.目标 = item.Item2;
                    process.明细.Add(det);
                }

                ObjectSpace.CommitChanges();
            };
            newFormOs.Committed += act;
            #endregion

            #endregion

            if (action.自动保存)
            {
                newFormOs.CommitChanges();
            }

            if (action.显示编辑界面)
            {
                var para = new ShowViewParameters();
                para.CreatedView  = Application.CreateDetailView(newFormOs, toObject, true);
                para.TargetWindow = TargetWindow.Default;

                Application.ShowViewStrategy.ShowView(para, new ShowViewSource(this.Frame, this.FlowToNext));
                //e.ShowViewParameters.CreatedView =
            }
        }
Exemple #14
0
        public void ProcessRequest(HttpContext context)
        {
            BLLJIMP.Model.API.Flow.PostAction requestPost = bllFlow.ConvertRequestToModel <BLLJIMP.Model.API.Flow.PostAction>(new BLLJIMP.Model.API.Flow.PostAction());
            string     websiteOwner  = bllFlow.WebsiteOwner;
            FlowAction act           = bllFlow.GetByKey <FlowAction>("AutoID", requestPost.action_id.ToString(), websiteOwner: websiteOwner);
            string     handleUserId  = currentUserInfo.UserID;
            string     handleGroupId = currentUserInfo.PermissionGroupID.HasValue ? currentUserInfo.PermissionGroupID.Value.ToString() : "";
            bool       isCanAction   = bllFlow.IsCanAction(websiteOwner, act.AutoID, handleUserId, handleGroupId);

            if (!isCanAction)
            {
                apiResp.code = (int)APIErrCode.NoPms;
                apiResp.msg  = "您没有权限审核!";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            BLLJIMP.Model.FlowStep step1 = null;
            BLLJIMP.Model.FlowStep step2 = null;
            if (requestPost.audit == 1 || requestPost.audit == 3)
            {
                List <BLLJIMP.Model.FlowStep> steps = bllFlow.GetStepList(int.MaxValue, 1, websiteOwner, act.FlowID);
                foreach (var itemStep in steps)
                {
                    if (step1 != null)
                    {
                        step2 = itemStep;
                        break;
                    }
                    if (itemStep.AutoID == act.StepID)
                    {
                        step1 = itemStep;
                    }
                }
            }
            else if (requestPost.audit == 2 || requestPost.audit == 4)
            {
                step1 = bllFlow.GetStep(websiteOwner, act.FlowID, act.StepID);
            }


            BLLJIMP.Model.FlowActionDetail actionDetail1 = new BLLJIMP.Model.FlowActionDetail();
            actionDetail1.ActionID      = act.AutoID;
            actionDetail1.WebsiteOwner  = websiteOwner;
            actionDetail1.FlowID        = act.FlowID;
            actionDetail1.StepID        = step1.AutoID;
            actionDetail1.StepName      = step1.StepName;
            actionDetail1.HandleUserID  = currentUserInfo.UserID;
            actionDetail1.HandleDate    = DateTime.Now;
            actionDetail1.HandleContent = requestPost.content;
            if (requestPost.select_date.HasValue)
            {
                actionDetail1.HandleSelectDate = requestPost.select_date.Value;
            }
            if (!string.IsNullOrWhiteSpace(requestPost.ex1))
            {
                actionDetail1.Ex1 = requestPost.ex1;
            }
            if (!string.IsNullOrWhiteSpace(requestPost.ex2))
            {
                actionDetail1.Ex2 = requestPost.ex2;
            }

            List <BLLJIMP.Model.FlowActionFile> files = new List <BLLJIMP.Model.FlowActionFile>();

            if (!string.IsNullOrWhiteSpace(requestPost.files))
            {
                List <string> fileUrls = requestPost.files.Split(',').ToList();
                if (fileUrls.Count > 0)
                {
                    foreach (var item in fileUrls)
                    {
                        files.Add(new BLLJIMP.Model.FlowActionFile()
                        {
                            ActionID     = act.AutoID,
                            FlowID       = act.FlowID,
                            StepID       = step1.AutoID,
                            WebsiteOwner = websiteOwner,
                            FilePath     = item
                        });
                    }
                }
            }
            string msg = "";

            apiResp.status = bllFlow.Action(out msg, requestPost.audit, websiteOwner, act, actionDetail1, files, step2);
            if (apiResp.status && string.IsNullOrWhiteSpace(msg))
            {
                msg = "审核完成";
            }
            apiResp.msg  = msg;
            apiResp.code = apiResp.status ? (int)APIErrCode.IsSuccess : (int)APIErrCode.OperateFail;
            bllFlow.ContextResponse(context, apiResp);
        }
 public void ShowPreviousPanel(string panelName, FlowAction action)
 {
     ShowPreviousPanel(panelName);
     PerformScreenActions(action);
 }
Exemple #16
0
        public void ProcessRequest(HttpContext context)
        {
            string id      = context.Request["id"];
            string content = context.Request["content"];

            if (string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "请填写申请取消原因";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            string     websiteOwner = bllFlow.WebsiteOwner;
            FlowAction act          = bllFlow.GetByKey <FlowAction>("AutoID", id, websiteOwner: websiteOwner);

            if (act.Status == 11)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "您已经申请取消";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            if (act.Status != 0)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "已经处理完成不能申请取消";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            if (CurrentUserInfo.UserID != act.CreateUserID)
            {
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "仅能申请人申请取消";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            act.CancelDate = DateTime.Now;
            act.Status     = 11;

            BLLJIMP.Model.FlowActionDetail actionDetail1 = new BLLJIMP.Model.FlowActionDetail();
            actionDetail1.ActionID      = act.AutoID;
            actionDetail1.WebsiteOwner  = websiteOwner;
            actionDetail1.FlowID        = act.FlowID;
            actionDetail1.StepID        = 0;
            actionDetail1.StepName      = "申请取消";
            actionDetail1.HandleUserID  = CurrentUserInfo.UserID;
            actionDetail1.HandleDate    = DateTime.Now;
            actionDetail1.HandleContent = content;

            BLLTransaction tran = new BLLTransaction();

            if (!bllFlow.Update(act, tran))
            {
                tran.Rollback();
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "申请取消失败";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            if (!bllFlow.Add(actionDetail1, tran))
            {
                tran.Rollback();
                apiResp.code = (int)APIErrCode.OperateFail;
                apiResp.msg  = "记录申请取消失败";
                bllFlow.ContextResponse(context, apiResp);
                return;
            }
            tran.Commit();
            apiResp.status = true;
            apiResp.code   = (int)APIErrCode.IsSuccess;
            apiResp.msg    = "申请取消成功";
            bllFlow.ContextResponse(context, apiResp);
        }
Exemple #17
0
        public void ProcessRequest(HttpContext context)
        {
            string     id                      = context.Request["id"];
            string     websiteOwner            = bllFlow.WebsiteOwner;
            FlowAction act                     = bllFlow.GetByKey <FlowAction>("AutoID", id, websiteOwner: websiteOwner);
            List <FlowActionDetail> actDetails = bllFlow.GetActionDetails(websiteOwner, act.AutoID, act.FlowID);

            string handleUserId            = currentUserInfo.UserID;
            string handleGroupId           = currentUserInfo.PermissionGroupID.HasValue ? currentUserInfo.PermissionGroupID.Value.ToString() : "";
            bool   isCanAction             = bllFlow.IsCanAction(websiteOwner, act.AutoID, handleUserId, handleGroupId);
            List <FlowActionFile> actFiles = bllFlow.GetActionFiles(websiteOwner, act.AutoID, act.FlowID);
            List <UserInfo>       uList    = new List <UserInfo>();
            UserInfo member = bllUser.GetUserInfo(act.MemberID, websiteOwner);

            if (member != null)
            {
                uList.Add(member);
            }
            UserInfo cu = uList.FirstOrDefault(p => p.UserID == act.CreateUserID);

            if (cu == null)
            {
                cu = bllUser.GetUserInfo(act.CreateUserID, websiteOwner);
                if (cu != null)
                {
                    uList.Add(cu);
                }
            }
            UserInfo regUser            = null;
            string   regUserLevelString = "";
            double   regUseAmount       = 0;

            if (act.FlowKey == "CancelRegister" && !string.IsNullOrWhiteSpace(member.RegUserID))
            {
                regUser = bllUser.GetUserInfo(member.RegUserID, websiteOwner);
                UserLevelConfig levelConfig = bll.QueryUserLevel(websiteOwner, "DistributionOnLine", regUser.MemberLevel.ToString());
                if (levelConfig != null)
                {
                    regUserLevelString = levelConfig.LevelString;
                }
                UserScoreDetailsInfo regScore = bllScore.GetNewScore(websiteOwner, "TotalAmount", userIDs: member.UserID, colName: "AutoID,Score", scoreEvents: "他人注册转入", startTime: member.Regtime.Value.ToString("yyyy-MM-dd"));
                if (regScore != null)
                {
                    regUseAmount = regScore.Score;
                }
            }

            UserInfo upUser            = null;
            string   upUserLevelString = "";

            if (act.FlowKey == "RegisterOffLine" || act.FlowKey == "CancelRegister" || act.FlowKey == "EmptyBilFill")
            {
                upUser = bllUser.GetUserInfo(member.DistributionOwner, websiteOwner);
                UserLevelConfig upLevelConfig = bll.QueryUserLevel(websiteOwner, "DistributionOnLine", upUser.MemberLevel.ToString());
                if (upLevelConfig != null)
                {
                    upUserLevelString = upLevelConfig.LevelString;
                }
            }

            List <dynamic> handles = new List <dynamic>();

            foreach (var item in actDetails)
            {
                UserInfo ru = uList.FirstOrDefault(p => p.UserID == item.HandleUserID);
                if (ru == null)
                {
                    ru = bllUser.GetUserInfo(item.HandleUserID, websiteOwner);
                    if (ru != null)
                    {
                        uList.Add(ru);
                    }
                }
                var files = (from fp in actFiles
                             where fp.StepID.Equals(item.StepID)
                             select new
                {
                    id = fp.AutoID,
                    url = fp.FilePath
                });

                handles.Add(new
                {
                    id               = item.AutoID,
                    ex1              = item.Ex1,
                    ex2              = item.Ex2,
                    ex3              = item.Ex3,
                    content          = item.HandleContent,
                    handle_time      = item.HandleDate.ToString("yyyy/MM/dd HH:mm:ss"),
                    stepname         = item.StepName,
                    handle_user_id   = ru == null ? 0 : ru.AutoID,
                    handle_user_name = ru == null ? "" : bllUser.GetUserDispalyName(ru),
                    select_date      = item.HandleSelectDate.ToString("yyyy/MM/dd HH:mm:ss"),
                    files            = files
                });
            }
            apiResp.result = new
            {
                id               = act.AutoID,
                flowname         = act.FlowName,
                stepname         = act.StepName,
                amount           = act.Amount,
                true_amount      = act.TrueAmount,
                deduct_amount    = act.DeductAmount,
                status           = act.Status,
                ex1              = act.StartEx1,
                ex2              = act.StartEx2,
                ex3              = act.StartEx3,
                content          = act.StartContent,
                select_date      = act.StartSelectDate.ToString("yyyy/MM/dd HH:mm:ss"),
                member_id        = member == null ? act.MemberAutoID : member.AutoID,
                member_name      = member == null ? act.MemberName : bllUser.GetUserDispalyName(member),
                member_phone     = member == null ? act.MemberPhone : member.Phone,
                member_regtime   = member == null ? "" : member.Regtime.Value.ToString("yyyy/MM/dd HH:mm:ss"),
                lvname           = act.MemberLevelName,
                create_user_id   = cu == null ? 0 : cu.AutoID,
                create_user_name = cu == null ? "" : bllUser.GetUserDispalyName(cu),
                start            = act.CreateDate.ToString("yyyy/MM/dd HH:mm:ss"),
                end              = act.EndDate.ToString("yyyy/MM/dd HH:mm:ss"),
                handles          = handles,
                can_act          = isCanAction,
                way              = member == null ? "":member.RegisterWay,
                reg              = regUser == null ? null:new
                {
                    uid    = regUser.AutoID,
                    name   = bllUser.GetUserDispalyName(regUser),
                    level  = regUserLevelString,
                    phone  = regUser.Phone,
                    amount = regUseAmount
                },
                up = upUser == null ? null : new
                {
                    uid   = upUser.AutoID,
                    name  = bllUser.GetUserDispalyName(upUser),
                    level = upUserLevelString,
                    phone = upUser.Phone
                },
            };
            apiResp.code   = (int)APIErrCode.IsSuccess;
            apiResp.status = true;
            apiResp.msg    = "查询完成";
            bllFlow.ContextResponse(context, apiResp);
        }
 public void ShowNextPanel(Type panelType, FlowAction action)
 {
     ShowNextPanel(panelType);
     PerformScreenActions(action);
 }
Exemple #19
0
        public void ProcessRequest(HttpContext context)
        {
            string id           = context.Request["id"];
            string websiteOwner = bllUser.WebsiteOwner;
            UserScoreDetailsInfo scoreDetail = bllUser.GetByKey <UserScoreDetailsInfo>("AutoID", id, websiteOwner: websiteOwner);
            UserInfo             member      = bllUser.GetUserInfo(scoreDetail.UserID, websiteOwner);
            UserInfo             upUser      = new UserInfo();

            if (!string.IsNullOrWhiteSpace(member.DistributionOwner))
            {
                upUser = bllUser.GetUserInfo(member.DistributionOwner, websiteOwner);
            }
            FlowAction act = new FlowAction();
            List <FlowActionDetail> actDetails = new List <FlowActionDetail>();
            List <FlowActionFile>   actFiles   = new List <FlowActionFile>();
            dynamic flow_action = null;

            if (!string.IsNullOrWhiteSpace(scoreDetail.RelationID) &&
                (scoreDetail.ScoreEvent == "线下注册充值" || scoreDetail.ScoreEvent == "线下充值" || scoreDetail.ScoreEvent == "申请提现"))
            {
                bool isReg = scoreDetail.ScoreEvent.Contains("注册");
                act        = bllFlow.GetByKey <FlowAction>("AutoID", scoreDetail.RelationID, websiteOwner: websiteOwner);
                actDetails = bllFlow.GetListByKey <FlowActionDetail>("ActionID", scoreDetail.RelationID, websiteOwner: websiteOwner);
                actFiles   = bllFlow.GetListByKey <FlowActionFile>("ActionID", scoreDetail.RelationID, websiteOwner: websiteOwner);
                UserInfo       createUser = bllUser.GetUserInfo(act.CreateUserID, websiteOwner);
                List <dynamic> details    = new List <dynamic>();
                foreach (var item in actDetails)
                {
                    UserInfo ru = bllUser.GetUserInfo(item.HandleUserID, websiteOwner);
                    details.Add(new
                    {
                        id            = item.AutoID,
                        aid           = item.ActionID,
                        fid           = item.FlowID,
                        sid           = item.StepID,
                        ex1           = item.Ex1,
                        ex2           = isReg ? "":item.Ex2,
                        ex3           = item.Ex3,
                        content       = item.HandleContent,
                        handle_time   = item.HandleDate.ToString("yyyy/MM/dd HH:mm:ss"),
                        select_date   = item.HandleSelectDate.ToString("yyyy/MM/dd HH:mm:ss"),
                        stepname      = item.StepName,
                        handler_phone = ru == null ? "" : ru.Phone,
                        handler_name  = ru == null ? "" : ru.TrueName,
                        files         = (from fp in actFiles
                                         where fp.StepID.Equals(item.StepID)
                                         select new
                        {
                            id = fp.AutoID,
                            url = fp.FilePath
                        })
                    });
                }
                flow_action = new
                {
                    id            = act.AutoID,
                    flow_name     = act.FlowName,
                    creater_phone = createUser.Phone,
                    creater_name  = createUser.TrueName,
                    create_time   = act.CreateDate.ToString("yyyy/MM/dd HH:mm:ss"),
                    end_time      = act.EndDate.ToString("yyyy/MM/dd HH:mm:ss"),
                    member_phone  = act.MemberPhone,
                    member_name   = act.MemberName,
                    member_lv     = act.MemberLevelName,
                    ex1           = act.StartEx1,
                    ex2           = isReg ? "" : act.StartEx2,
                    ex3           = act.StartEx3,
                    content       = act.StartContent,
                    amount        = act.Amount,
                    true_amount   = act.TrueAmount,
                    deduct_amount = act.DeductAmount,
                    files         = (from fp in actFiles
                                     where fp.StepID.Equals(act.StartStepID)
                                     select new {
                        id = fp.AutoID,
                        url = fp.FilePath
                    }),
                    details = details
                };
            }
            apiResp.status = true;
            apiResp.code   = (int)APIErrCode.IsSuccess;
            apiResp.result = new
            {
                id            = scoreDetail.AutoID,
                member_phone  = member.Phone,
                member_name   = member.TrueName,
                time          = scoreDetail.AddTime.ToString("yyyy/MM/dd HH:mm:ss"),
                score_event   = scoreDetail.ScoreEvent,
                rel_id        = scoreDetail.RelationID,
                serial_number = scoreDetail.SerialNumber,
                amount        = scoreDetail.Score,
                event_amount  = scoreDetail.EventScore,
                deduct_amount = scoreDetail.DeductScore,
                ex1           = scoreDetail.Ex1,
                ex2           = scoreDetail.Ex2,
                ex3           = scoreDetail.Ex3,
                ex4           = scoreDetail.Ex4,
                ex5           = scoreDetail.Ex5,
                flow_action   = flow_action
            };
            bllUser.ContextResponse(context, apiResp);
        }
Exemple #20
0
        private void UpdateFlow(FlowAction action)
        {
            switch (captureImageType)
            {
            case CaptureImageType.None:
                switch (action)
                {
                case FlowAction.StartPreview:
                    UpdateBtnStatus(CaptureImageType.NewPerson);
                    break;

                case FlowAction.SelectFace:
                    UpdateBtnStatus(CaptureImageType.CurrentPerson);
                    break;

                case FlowAction.List:
                    break;

                case FlowAction.Remove:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;

            case CaptureImageType.NewPerson:
                switch (action)
                {
                case FlowAction.SelectFace:
                case FlowAction.CaptureFace:
                    UpdateBtnStatus(CaptureImageType.NewPersonCaptured);
                    break;

                case FlowAction.Cancel:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;

            case CaptureImageType.NewPersonCaptured:
                switch (action)
                {
                case FlowAction.SelectFace:
                    UpdateSaveBtn();
                    UpdateCheckImageBtn();
                    break;

                case FlowAction.Cancel:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;

                case FlowAction.Save:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;

            case CaptureImageType.CurrentPerson:
                switch (action)
                {
                case FlowAction.StartPreview:
                    UpdateBtnStatus(CaptureImageType.UpdatePerson);
                    break;

                case FlowAction.SelectFace:
                    UpdateSaveBtn();
                    UpdateCheckImageBtn();
                    break;

                case FlowAction.Cancel:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;

                case FlowAction.Save:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;

                case FlowAction.Remove:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;

            case CaptureImageType.UpdatePerson:
                switch (action)
                {
                case FlowAction.CaptureFace:
                case FlowAction.SelectFace:
                    UpdateBtnStatus(CaptureImageType.UpdatePersonCaptured);
                    break;

                case FlowAction.Cancel:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;

                case FlowAction.Save:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;

            case CaptureImageType.UpdatePersonCaptured:
                switch (action)
                {
                case FlowAction.CaptureFace:
                case FlowAction.SelectFace:
                    UpdateCheckImageBtn();
                    UpdateSaveBtn();
                    break;

                case FlowAction.Cancel:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;

                case FlowAction.Save:
                    UpdateBtnStatus(CaptureImageType.None);
                    break;
                }
                break;
            }
        }