Пример #1
0
        /// <summary>
        /// 取消通知
        /// </summary>
        /// <param name="flInstance">流程</param>
        /// <param name="currentFLActivity">当前Activity</param>
        /// <param name="flNotifyActivity">通知Activity</param>
        /// <param name="flInstanceParms">流程参数</param>
        /// <param name="keyValues">宿主表的筛选条件</param>
        /// <param name="clientInfo">ClientInfo</param>
        public static void InsertToDo4RejectNotify(FLInstance flInstance, IEventWaiting currentFLActivity, FLNotifyActivity flNotifyActivity, object[] flInstanceParms, object[] keyValues, object[] clientInfo)
        {
            string insertToDoListSQL4Notify = GetInsertToDoListSQL4RejectNotify(flInstance, currentFLActivity, flNotifyActivity, flInstanceParms, keyValues, clientInfo);

            string sql = insertToDoListSQL4Notify;
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            String dbType = GetDBType(clientInfo);
            if (dbType == "3" && sql.EndsWith(";"))
                sql = "BEGIN " + sql + "END;";

            //object[] objs = remoteModule.ExecuteSql(clientInfo, "GLModule", "cmdWorkflow", sql, false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "UpdateWorkFlow", new object[] { sql });
            if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
        }
Пример #2
0
        /// <summary>
        /// 取得上一Activity的集合
        /// </summary>
        /// <param name="currentFLActivity">当前Activity</param>
        /// <param name="previousFLActivity2">上一Activity</param>
        /// <param name="nextFLActivities">下一Activity的集合</param>
        private void GetPreviousFLActivites2(FLActivity currentFLActivity, FLActivity previousFLActivity2, List<FLActivity> nextFLActivities)
        {
            if (Version == "2.0")
            {
                //比对2个activity的位置
                var availableActivity = GetAvailableActivity(previousFLActivity2, currentFLActivity);
                if (availableActivity == previousFLActivity2) //直接退回
                {
                    ReturnActivity(previousFLActivity2);
                    nextFLActivities.Add(previousFLActivity2);

                    LastActivity = availableActivity == null ? string.Empty : availableActivity.Name;
                }
                else
                {
                    //var currentParallelPath = string.Join("->", GetParallelPath(currentFLActivity));
                    foreach (var nextActivity in availableActivity.NextActivities) //退进平行的话(只有退回上一步才会), 退回到平行关卡的上一关
                    {
                        //var nextParallelPath = string.Join("->", GetParallelPath(nextActivity));
                        //if (nextParallelPath.Contains(currentParallelPath))
                        //{
                        ReturnActivity(nextActivity);
                        if (nextActivity is IEventWaiting)
                        {
                            nextFLActivities.Add(nextActivity);
                        }
                        //}
                    }
                    foreach (var executedActivity in availableActivity.ExecutedActivities)
                    {
                        if (executedActivity is FLParallelActivity)
                        {
                            (executedActivity as FLParallelActivity).ExecutedBranches.Clear(); //清除ExecutedBranches
                        }
                    }
                    LastActivity = availableActivity.Name;
                }
            }
            else
            {
                if (_p.Count <= 1)
                {
                    String message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(_clientInfo[0]))[0]), "FLTools", "FLWebNavigator", "ReturnToEnd");
                    throw new FLException(message);
                    return;
                }
                //同时要退回当前activity的上级
                object current = _p[_p.Count - 1];
                if (current is string)
                {
                    ReturnUpperParallel((string)current, previousFLActivity2);
                }
                else
                {
                    if (previousFLActivity2.UpperParallel != string.Empty && previousFLActivity2.UpperParallel == currentFLActivity.UpperParallel)
                    {
                        List<object> list = (List<object>)current;
                        // 特别的在平行签核同一边的退回
                        var path = GetParallelPath(previousFLActivity2.Name, currentFLActivity.Name, list);
                        if (path != null)
                        {
                            for (int i = path.Count - 1; i >= 0; i--)
                            {
                                var obj = path[i];
                                if (obj is string)
                                {
                                    var activity = _rootFLActivity.GetFLActivityByName(obj.ToString());
                                    if (activity != null)
                                    {
                                        if (obj.ToString() == previousFLActivity2.Name)
                                        {
                                            nextFLActivities.Add(activity);
                                            break;
                                        }
                                        else
                                        {
                                            activity.InitExecStatus();
                                        }
                                    }

                                }
                            }
                            return;
                        }
                    }
                    else
                    {
                        List<object> list = (List<object>)current;
                        foreach (object obj in list)
                        {
                            List<object> branch = obj as List<object>;
                            foreach (object str in branch)
                            {
                                ReturnUpperParallel(str.ToString(), previousFLActivity2);
                            }
                        }
                    }
                }
                object o0 = _p[_p.Count - 2];
                if (o0 is string)
                {
                    FLActivity previousFLActivity = _rootFLActivity.GetFLActivityByName(o0.ToString());

                    UnExecuteIFLControls(currentFLActivity, previousFLActivity);

                    //当前步是会签时。这里会移除不掉
                    if (current is string)
                    {
                        _p.Remove(currentFLActivity.Name);
                    }
                    else
                    {
                        List<object> list = (List<object>)current;
                        foreach (object item in list)
                        {
                            if (item is string && item.Equals(currentFLActivity.Name))
                            {
                                _p.Remove(current);
                                break;
                            }
                            else
                            {
                                List<object> list1 = (List<object>)item;
                                if (list1.Contains(currentFLActivity.Name))
                                {
                                    _p.Remove(current);
                                    break;
                                }
                            }
                        }
                    }
                    if (previousFLActivity is IEventWaiting && previousFLActivity.Name.ToLower() == previousFLActivity2.Name.ToLower())
                    {
                        nextFLActivities.Add(previousFLActivity);

                        //Hashtable table = _rootFLActivity.GetAllChildFLActivities();
                        //foreach (object key in table.Keys)
                        //{
                        //    object o3 = table[key];
                        //    if (o3 == null)
                        //    {
                        //        continue;
                        //    }

                        //    FLActivity temp2FLActivity = (FLActivity)o3;
                        //    if (temp2FLActivity is FLIfElseActivity)
                        //    {
                        //        ((FLIfElseActivity)temp2FLActivity).InitExecStatus();
                        //        foreach (FLActivity child in ((FLIfElseActivity)temp2FLActivity).ChildFLActivities)
                        //        {
                        //            child.InitExecStatus();
                        //        }
                        //    }
                        //}
                    }
                    else
                    {
                        if (previousFLActivity is IEventWaiting && !string.IsNullOrEmpty(((IEventWaiting)previousFLActivity).SendToId))
                        {
                            FLNotifyActivity notifyActivity = new FLNotifyActivity();
                            notifyActivity.Name = "Notify_" + previousFLActivity.Name;
                            // -------------------------------------------------------------------
                            //notifyActivity.SendToField = ((IEventWaiting)previousFLActivity).SendToField;
                            //notifyActivity.SendToKind = ((IEventWaiting)previousFLActivity).SendToKind;
                            //notifyActivity.SendToRole = ((IEventWaiting)previousFLActivity).SendToRole;
                            notifyActivity.SendToKind = SendToKind.Role;
                            notifyActivity.SendToRole = ((IEventWaiting)previousFLActivity).SendToId;
                            // -------------------------------------------------------------------
                            notifyActivity.FormName = ((IEventWaiting)previousFLActivity).FormName;
                            notifyActivity.WebFormName = ((IEventWaiting)previousFLActivity).WebFormName;
                            notifyActivity.UrgentTime = (int)((IEventWaiting)previousFLActivity).UrgentTime;
                            notifyActivity.TimeUnit = ((IEventWaiting)previousFLActivity).TimeUnit;
                            notifyActivity.NavigatorMode = ((IEventWaiting)previousFLActivity).NavigatorMode;
                            notifyActivity.FLNavigatorMode = ((IEventWaiting)previousFLActivity).FLNavigatorMode;
                            notifyActivity.UserId = ((IEventWaitingExecute)previousFLActivity).UserId;
                            notifyActivity.RoleId = ((IEventWaitingExecute)previousFLActivity).RoleId;

                            nextFLActivities.Add(notifyActivity);
                        }
                        else if (previousFLActivity is IFLProcedureActivity)
                        {
                            if (previousFLActivity is IFLProcedureActivity)
                            {
                                Logic.CallServerMethod(this, FLInstanceParms, this._keyValues, this._clientInfo, previousFLActivity as IFLProcedureActivity);
                            }
                            nextFLActivities.Add(previousFLActivity);
                        }
                        GetPreviousFLActivites2(previousFLActivity, previousFLActivity2, nextFLActivities);
                    }
                }
                else
                {
                    List<object> list01 = (List<object>)_p[_p.Count - 2];
                    bool isDetailReturn = false;
                    List<string> branches = new List<string>();
                    foreach (object o1 in list01)
                    {
                        List<object> list1 = (List<object>)o1;
                        if (list1.Count > 0)
                        {
                            string previousFLActivityName = list1[list1.Count - 1].ToString();
                            FLActivity previousFLActivity = _rootFLActivity.GetFLActivityByName(previousFLActivityName);
                            if (previousFLActivity.Location == previousFLActivity2.Location)
                            {
                                isDetailReturn = true;
                                branches.Add(previousFLActivity.UpperParallelBranch);

                                UnExecuteIFLControls(currentFLActivity, previousFLActivity);

                                if (previousFLActivity is IEventWaiting)
                                {
                                    nextFLActivities.Add(previousFLActivity);
                                }
                            }
                        }
                    }

                    if (isDetailReturn)
                    {
                        FLActivity tempFLActivity = _rootFLActivity.GetFLActivityByName(((List<object>)list01[0])[0].ToString());
                        string upperParallel = tempFLActivity.UpperParallel;
                        FLActivity parallelFLActivity = _rootFLActivity.GetFLActivityByName(upperParallel);
                        foreach (string branch in branches)
                        {
                            ((IFLParallelActivity)parallelFLActivity).ExecutedBranches.Remove(branch);
                            ((IFLSequenceActivity)_rootFLActivity.GetFLActivityByName(branch)).SetFLDirection(FLDirection.Waiting);
                        }

                        _p.Remove(currentFLActivity.Name);
                    }
                    else
                    {
                        branches = new List<string>();
                        foreach (object o1 in list01)
                        {
                            List<object> list1 = (List<object>)o1;
                            if (list1.Count > 0)
                            {
                                string previousFLActivityName = list1[list1.Count - 1].ToString();
                                FLActivity previousFLActivity = _rootFLActivity.GetFLActivityByName(previousFLActivityName);

                                branches.Add(previousFLActivity.UpperParallelBranch);
                            }
                        }

                        FLActivity temp1FLActivity = _rootFLActivity.GetFLActivityByName(((List<object>)list01[0])[0].ToString());
                        string upperParallel = temp1FLActivity.UpperParallel;
                        FLActivity parallelFLActivity = _rootFLActivity.GetFLActivityByName(upperParallel);
                        parallelFLActivity.InitExecStatus();
                        if (!string.IsNullOrEmpty(parallelFLActivity.Location))//退回时要初始化FlDetail
                        {
                            UnExecuteIFLControls(parallelFLActivity, previousFLActivity2);
                            //FLActivity detailActivity = _rootFLActivity.GetFLActivityByName(parallelFLActivity.Location);
                            //if (detailActivity != null)
                            //{
                            //    detailActivity.InitExecStatus();
                            //}
                        }
                        foreach (string branch in branches)
                        {
                            ((IFLParallelActivity)parallelFLActivity).ExecutedBranches.Remove(branch);
                            FLActivity previousFLActivity = _rootFLActivity.GetFLActivityByName(branch);
                            //_rootFLActivity.GetFLActivityByName(branch).InitExecStatus();//多步退回时触发procedure
                            previousFLActivity.InitExecStatus();
                            if (previousFLActivity is IFLProcedureActivity)
                            {
                                if (previousFLActivity is IFLProcedureActivity)
                                {
                                    Logic.CallServerMethod(this, FLInstanceParms, this._keyValues, this._clientInfo, previousFLActivity as IFLProcedureActivity);
                                }
                                nextFLActivities.Add(previousFLActivity);
                            }
                            ((IFLSequenceActivity)_rootFLActivity.GetFLActivityByName(branch)).SetFLDirection(FLDirection.Waiting);
                        }

                        //Hashtable table = _rootFLActivity.GetAllChildFLActivities();
                        //foreach (object key in table.Keys)
                        //{
                        //    object o3 = table[key];
                        //    if (o3 == null)
                        //    {
                        //        continue;
                        //    }

                        //    FLActivity temp2FLActivity = (FLActivity)o3;
                        //    if (temp2FLActivity is IEventWaiting)
                        //    {
                        //        ((IEventWaitingExecute)(temp2FLActivity)).InitExecStatus();
                        //    }
                        //    else if (temp2FLActivity is FLIfElseActivity)
                        //    {
                        //        ((FLIfElseActivity)temp2FLActivity).InitExecStatus();
                        //        foreach (FLActivity child in ((FLIfElseActivity)temp2FLActivity).ChildFLActivities)
                        //        {
                        //            child.InitExecStatus();
                        //        }
                        //    }
                        //}

                        _p.Remove(list01);
                        GetPreviousFLActivites2(currentFLActivity, previousFLActivity2, nextFLActivities);
                    }

                }

                _flflag = 'P';
            }
        }
Пример #3
0
        /// <summary>
        /// 初始化流程FLActivity
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="wfActivity"></param>
        private void InitFLActivities(IFLActivity activity, object wfActivity)
        {
            //if (wfActivity is IEventWaiting)
            //{
            //    IEventWaiting m = (IEventWaiting)activity;
            //    IEventWaiting n = (IEventWaiting)wfActivity;
            //    m.AllowSendBack = n.AllowSendBack;
            //}

            if (wfActivity is IFLRootActivity)
            {
                IFLRootActivity m = (IFLRootActivity)activity;
                IFLRootActivity n = (IFLRootActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.EEPAlias = n.EEPAlias;
                m.TableName = n.TableName;
                m.Keys = n.Keys;
                m.PresentFields = n.PresentFields;
                m.OrgKind = (_orgKind == null || _orgKind == string.Empty) ? n.OrgKind : _orgKind;
                m.FormName = n.FormName;
                m.WebFormName = n.WebFormName;
                m.ExpTime = n.ExpTime;
                m.ExpTimeField = n.ExpTimeField;
                m.UrgentTime = n.UrgentTime;
                m.TimeUnit = n.TimeUnit;
                m.NotifySendMail = n.NotifySendMail;
                m.SkipForSameUser = n.SkipForSameUser;
                m.RejectProcedure = n.RejectProcedure;
                m.BodyField = n.BodyField;
            }
            else if (wfActivity is IFLDetailsActivity)
            {
                IFLDetailsActivity m = (IFLDetailsActivity)activity;
                IFLDetailsActivity n = (IFLDetailsActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.DetailsTableName = n.DetailsTableName;
                m.ParallelField = n.ParallelField;
                m.SendToMasterField = n.SendToMasterField;
                m.ParallelMode = n.ParallelMode;
                m.ParallelRate = n.ParallelRate;
                m.RelationKeys = n.RelationKeys;
                m.SendToField = n.SendToField;

                m.ExpTime = n.ExpTime;
                m.FLNavigatorMode = n.FLNavigatorMode;
                m.FLNavigatorField = n.FLNavigatorField;
                m.FormName = n.FormName;
                m.WebFormName = n.WebFormName;
                m.NavigatorMode = n.NavigatorMode;
                m.Parameters = n.Parameters;

                m.ExtApproveID = n.ExtApproveID;
                m.ExtGroupField = n.ExtGroupField;
                m.ExtValueField = n.ExtValueField;

                m.SendToKind = n.SendToKind;
                m.SendToRole = n.SendToRole;
                m.SendToUser = n.SendToUser;
                m.TimeUnit = n.TimeUnit;
                m.UrgentTime = n.UrgentTime;
                m.SendEmail = n.SendEmail;

                m.AllowSendBack = n.AllowSendBack;

                m.PlusApprove = n.PlusApprove;
                m.PlusApproveReturn = n.PlusApproveReturn;

                #region  --- 修改为动态---

                //if (_hostDataSet == null)
                //{
                //    _hostDataSet = HostTable.GetHostDataSet(this, _keyValues, _clientInfo);
                //}

                //Activity temp = FLInstance.GetActivityByXoml(_flDefinitionFile, string.Empty);
                //IFLRootActivity rootActivity = (IFLRootActivity)temp;

                //DataSet detailsDataSet = HostTable.GetDetailsDataSet(_hostDataSet, rootActivity.Keys, n.DetailsTableName, n.RelationKeys, _clientInfo);
                //string parallelField = n.ParallelField;
                //string sendToField = n.SendToField;

                //if (detailsDataSet != null && detailsDataSet.Tables.Count != 0 && detailsDataSet.Tables[0].Rows.Count != 0)
                //{
                //    int i0 = 1;
                //    int i1 = 1;
                //    int i2 = 1;

                //    FLParallelActivity parallelActivity = null;
                //    foreach (DataRow row in detailsDataSet.Tables[0].Rows)
                //    {
                //        FLStandActivity stand = new FLStandActivity();

                //        //stand.Name = n.Name + "_s" + i0.ToString();
                //        stand.Name = n.Name + "_" + i0.ToString();
                //        i0++;

                //        stand.Description = ((FLDetails)n).Description;
                //        stand.Enabled = ((FLDetails)n).Enabled;

                //        stand.ExpTime = ((FLDetails)n).ExpTime;
                //        stand.FLNavigatorMode = ((FLDetails)n).FLNavigatorMode;
                //        stand.FormName = ((FLDetails)n).FormName;
                //        stand.WebFormName = ((FLDetails)n).WebFormName;
                //        stand.NavigatorMode = ((FLDetails)n).NavigatorMode;
                //        stand.Parameters = ((FLDetails)n).Parameters;
                //        stand.SendToField = ((FLDetails)n).SendToField;
                //        stand.SendToKind = ((FLDetails)n).SendToKind;
                //        stand.SendToRole = ((FLDetails)n).SendToRole;
                //        stand.TimeUnit = ((FLDetails)n).TimeUnit;
                //        stand.UrgentTime = ((FLDetails)n).UrgentTime;
                //        stand.SendEmail = ((FLDetails)n).SendEmail;
                //        stand.PlusApprove = false;

                //        object sendToId2 = row[sendToField];
                //        if (sendToId2 == null || sendToId2 == DBNull.Value || sendToId2.ToString() == string.Empty)
                //        {
                //            continue;
                //            //String message = string.Format(SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(_clientInfo[0]))[0]), "FLRuntime", "FLInstance", "SendToFieldValueIsNull"), n.DetailsTableName);
                //            //throw new FLException(message);
                //        }
                //        ((ISupportFLDetailsActivity)stand).SendToId2 = sendToId2.ToString();

                //        if (!string.IsNullOrEmpty(parallelField))
                //        {
                //            object isParallel = row[parallelField];
                //            if ((isParallel != null && isParallel != DBNull.Value) &&
                //                (isParallel.ToString().Trim().ToLower() == "y" || isParallel.ToString().Trim().ToLower() == "and"))
                //            {
                //                if (parallelActivity == null)
                //                {
                //                    parallelActivity = new FLParallelActivity();
                //                    parallelActivity.Description = n.ParallelRate > 0 ? string.Format("rate:{0}", n.ParallelRate) : "and";
                //                    parallelActivity.Name = n.Name + "_p" + i2.ToString();
                //                    i2++;

                //                    ((FLActivity)m).ChildFLActivities.Add(parallelActivity);
                //                }

                //                FLSequenceActivity sequenceActivity = new FLSequenceActivity();
                //                sequenceActivity.Name = n.Name + "_se" + i1.ToString();
                //                i1++;
                //                ((FLActivity)parallelActivity).ChildFLActivities.Add(sequenceActivity);

                //                ((FLActivity)sequenceActivity).ChildFLActivities.Add(stand);
                //            }
                //            else
                //            {
                //                parallelActivity = null;
                //                ((FLActivity)m).ChildFLActivities.Add(stand);
                //            }
                //        }
                //        else
                //        {
                //            parallelActivity = null;
                //            ((FLActivity)m).ChildFLActivities.Add(stand);
                //        }
                //    }
                //}

                #endregion
            }
            else if (wfActivity is IFLSubFlowActivity)
            {
                IFLSubFlowActivity m = (IFLSubFlowActivity)activity;
                IFLSubFlowActivity n = (IFLSubFlowActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.IncludeFirstActivity = n.IncludeFirstActivity;
                m.XomlName = n.XomlName;
                m.XomlField = n.XomlField;
                //    m.Name = n.Name;
                //    m.Description = n.Description;
                //    m.Enabled = n.Enabled;

                //    string xomlName = n.XomlName;

                //    IFLActivity temp1 = new FLRootActivity();

                //    FileInfo fileInfo = new FileInfo(_flDefinitionFile);
                //    string file = fileInfo.Directory + @"\" + xomlName;
                //    Activity temp2 = GetActivityByXoml(file, string.Empty);

                //    InitFLActivities(temp1, temp2);

                //    List<string> temp3 = new List<string>();
                //    foreach (FLActivity a in ((FLActivity)temp1).ChildFLActivities)
                //    {
                //        temp3.Add(a.Name);
                //    }

                //    bool isFirst = true;
                //    foreach (string k in temp3)
                //    {
                //        if (isFirst && !n.IncludeFirstActivity)
                //        {
                //            isFirst = false; continue;
                //        }

                //        FLActivity temp4 = ((FLActivity)temp1).GetFLActivityByName(k);
                //        temp4.Enabled = n.Enabled;

                //        ((FLActivity)temp1).ChildFLActivities.Remove(temp4);
                //        ((FLActivity)m).ChildFLActivities.Add(temp4);
                //    }
            }
            else if (wfActivity is IEventWaiting)
            {
                IEventWaiting m = (IEventWaiting)activity;
                IEventWaiting n = (IEventWaiting)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.ExpTime = n.ExpTime;
                m.FLNavigatorMode = n.FLNavigatorMode;
                m.FormName = n.FormName;
                m.WebFormName = n.WebFormName;
                m.NavigatorMode = n.NavigatorMode;
                m.Parameters = n.Parameters;
                m.SendToField = n.SendToField;
                m.SendToKind = n.SendToKind;
                m.SendToRole = n.SendToRole;
                m.SendToUser = n.SendToUser;
                m.TimeUnit = n.TimeUnit;
                m.UrgentTime = n.UrgentTime;
                m.SendEmail = n.SendEmail;

                m.AllowSendBack = n.AllowSendBack;

                if (wfActivity is IFLStandActivity)
                {
                    ((IFLStandActivity)m).PlusApprove = ((IFLStandActivity)n).PlusApprove;
                    ((IFLStandActivity)m).PlusApproveReturn = ((IFLStandActivity)n).PlusApproveReturn;
                    ((IFLStandActivity)m).DelayAutoApprove = ((IFLStandActivity)n).DelayAutoApprove;
                }
                else if (wfActivity is IFLApproveActivity)
                {
                    IFLApproveActivity q = (IFLApproveActivity)activity;
                    IFLApproveActivity p = (IFLApproveActivity)wfActivity;

                    ((IFLApproveActivity)q).PlusApprove = ((IFLApproveActivity)p).PlusApprove;
                    ((IFLApproveActivity)q).PlusApproveReturn = ((IFLApproveActivity)p).PlusApproveReturn;
                    ((IFLApproveActivity)q).DelayAutoApprove = ((IFLApproveActivity)p).DelayAutoApprove;

                    List<IFLApproveBranchActivity> list = p.GetApproveRights();
                    foreach (IFLApproveBranchActivity a in list)
                    {
                        FLApproveBranchActivity approveBranch = new FLApproveBranchActivity();
                        approveBranch.Grade = a.Grade;
                        approveBranch.Expression = a.Expression;
                        approveBranch.Name = activity.Name + "-" + a.Name;

                        approveBranch.Description = m.Description;
                        approveBranch.ExpTime = m.ExpTime;
                        approveBranch.FLNavigatorMode = m.FLNavigatorMode;
                        approveBranch.FormName = m.FormName;
                        approveBranch.WebFormName = m.WebFormName;
                        approveBranch.NavigatorMode = m.NavigatorMode;
                        approveBranch.Parameters = m.Parameters;
                        approveBranch.SendToField = m.SendToField;
                        approveBranch.SendToKind = m.SendToKind;
                        approveBranch.SendToRole = m.SendToRole;
                        approveBranch.SendToUser = m.SendToUser;
                        approveBranch.TimeUnit = m.TimeUnit;
                        approveBranch.UrgentTime = m.UrgentTime;
                        approveBranch.SendEmail = m.SendEmail;
                        approveBranch.AllowSendBack = m.AllowSendBack;

                        approveBranch.ParentActivity = activity.Name;
                        activity.AddFLActivity(approveBranch);
                    }
                }
            }
            else if (wfActivity is IfElseActivity)
            {
                IFLIfElseActivity m = (IFLIfElseActivity)activity;
                IfElseActivity n = (IfElseActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;
            }
            else if (wfActivity is IfElseBranchActivity)
            {
                IFLIfElseBranchActivity m = (IFLIfElseBranchActivity)activity;
                IfElseBranchActivity n = (IfElseBranchActivity)wfActivity;

                m.Name = n.Name;
                m.Condition = n.Description == null ? string.Empty : n.Description.ToString();
                m.Description = n.Description;
                m.Enabled = n.Enabled;
                //m.Condition = n.Condition == null ? string.Empty : n.Condition.ToString();
            }
            else if (wfActivity is ParallelActivity)
            {
                IFLParallelActivity m = (IFLParallelActivity)activity;
                ParallelActivity n = (ParallelActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;
            }
            else if (wfActivity is SequenceActivity)
            {
                IFLSequenceActivity m = (IFLSequenceActivity)activity;
                SequenceActivity n = (SequenceActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;
            }
            else if (wfActivity is IFLNotifyActivity)
            {
                IFLNotifyActivity m = (IFLNotifyActivity)activity;
                IFLNotifyActivity n = (IFLNotifyActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.ExpTime = n.ExpTime;
                m.FLNavigatorMode = n.FLNavigatorMode;
                m.FormName = n.FormName;
                m.WebFormName = n.WebFormName;
                m.NavigatorMode = n.NavigatorMode;
                m.Parameters = n.Parameters;
                m.SendToField = n.SendToField;
                m.SendToKind = n.SendToKind;
                m.SendToRole = n.SendToRole;
                m.SendToUser = n.SendToUser;
                m.TimeUnit = n.TimeUnit;
                m.UrgentTime = n.UrgentTime;
                m.SendEmail = n.SendEmail;
            }
            else if (wfActivity is IFLProcedureActivity)
            {
                IFLProcedureActivity m = (IFLProcedureActivity)activity;
                IFLProcedureActivity n = (IFLProcedureActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.ErrorLog = n.ErrorLog;
                m.ErrorToRole = n.ErrorToRole;
                m.MethodName = n.MethodName;
                m.ModuleName = n.ModuleName;
            }
            else if (wfActivity is IFLValidateActivity)
            {
                IFLValidateActivity m = (IFLValidateActivity)activity;
                IFLValidateActivity n = (IFLValidateActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.Expression = n.Expression;
                m.Message = n.Message;
            }
            else if (wfActivity is IFLHyperLinkActivity)
            {
                IFLHyperLinkActivity m = (IFLHyperLinkActivity)activity;
                IFLHyperLinkActivity n = (IFLHyperLinkActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.Parameters = n.Parameters;
            }
            else if (wfActivity is IFLQueryActivity)
            {
                IFLQueryActivity m = (IFLQueryActivity)activity;
                IFLQueryActivity n = (IFLQueryActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.Parameters = n.Parameters;
            }
            else if (wfActivity is IFLRejectActivity)
            {
                IFLRejectActivity m = (IFLRejectActivity)activity;
                IFLRejectActivity n = (IFLRejectActivity)wfActivity;

                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;

                m.ExpTime = n.ExpTime;
                m.FLNavigatorMode = n.FLNavigatorMode;
                m.FormName = n.FormName;
                m.WebFormName = n.WebFormName;
                m.NavigatorMode = n.NavigatorMode;
                m.Parameters = n.Parameters;
                m.SendToField = n.SendToField;
                m.SendToKind = n.SendToKind;
                m.SendToRole = n.SendToRole;
                m.SendToUser = n.SendToUser;
                m.TimeUnit = n.TimeUnit;
                m.UrgentTime = n.UrgentTime;
                m.SendEmail = n.SendEmail;
            }
            else if (wfActivity is IFLGotoActivity)
            {
                IFLGotoActivity m = (IFLGotoActivity)activity;
                IFLGotoActivity n = (IFLGotoActivity)wfActivity;
                m.Name = n.Name;
                m.Description = n.Description;
                m.Enabled = n.Enabled;
                m.ActivityName = n.ActivityName;
            }
            else
            {
                String message = string.Format(SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(_clientInfo[0]))[0]), "FLRuntime", "FLInstance", "NotSupportActivityType"), wfActivity.GetType().Name);
                throw new FLException(message);
            }

            if (wfActivity is CompositeActivity)
            {
                CompositeActivity compositeActivity = (CompositeActivity)wfActivity;
                foreach (Activity child in compositeActivity.Activities)
                {
                    IFLActivity a = null;
                    if (child is IFLSubFlowActivity)
                    {
                        //a = new FLSequenceActivity();
                        a = new FLSubFlowActivity();
                    }
                    else if (child is IFLDetailsActivity)
                    {
                        //a = new FLSequenceActivity();
                        a = new FLDetailsActivity();
                    }
                    else if (child is IFLStandActivity)
                    {
                        a = new FLStandActivity();
                    }
                    else if (child is IFLApproveActivity)
                    {
                        a = new FLApproveActivity();
                    }
                    else if (child is IfElseActivity)
                    {
                        a = new FLIfElseActivity();
                    }
                    else if (child is IfElseBranchActivity)
                    {
                        a = new FLIfElseBranchActivity();
                    }
                    else if (child is ParallelActivity)
                    {
                        a = new FLParallelActivity();
                    }
                    else if (child is SequenceActivity)
                    {
                        a = new FLSequenceActivity();
                    }
                    else if (child is IFLNotifyActivity)
                    {
                        a = new FLNotifyActivity();
                    }
                    else if (child is IFLProcedureActivity)
                    {
                        a = new FLProcedureActivity();
                    }
                    else if (child is IFLValidateActivity)
                    {
                        a = new FLValidateActivity();
                    }
                    else if (child is IFLHyperLinkActivity)
                    {
                        a = new FLHyperLinkActivity();
                    }
                    else if (child is IFLQueryActivity)
                    {
                        a = new FLQueryActivity();
                    }
                    else if (child is IFLRejectActivity)
                    {
                        a = new FLRejectActivity();
                    }
                    else if (child is IFLGotoActivity)
                    {
                        a = new FLGotoActivity();
                    }
                    else
                    {
                        String message = string.Format(SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(_clientInfo[0]))[0]), "FLRuntime", "FLInstance", "NotSupportActivityType"), wfActivity.GetType().Name);
                        throw new FLException(message);
                    }

                    activity.AddFLActivity(a);
                    InitFLActivities(a, child);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 取消流程
        /// </summary>
        /// <param name="currentFLActivityName">当前节点</param>
        /// <param name="sendNotifyToAll">是否发送通知</param>
        /// <returns>通知Activity</returns>
        public FLNotifyActivity Reject(string currentFLActivityName, bool sendNotifyToAll)
        {
            _flflag = 'X';
            _v = true;

            if (!sendNotifyToAll)
            {
                return null;
            }

            FLActivity currentFLActivity = _rootFLActivity.GetFLActivityByName(currentFLActivityName);
            FLNotifyActivity notifyActivity = new FLNotifyActivity();
            notifyActivity.Name = "Notify_" + currentFLActivity.Name;
            notifyActivity.SendToKind = SendToKind.AllRoles;
            notifyActivity.FormName = ((IEventWaiting)currentFLActivity).FormName;
            notifyActivity.WebFormName = ((IEventWaiting)currentFLActivity).WebFormName;
            notifyActivity.UrgentTime = (int)((IEventWaiting)currentFLActivity).UrgentTime;
            notifyActivity.TimeUnit = ((IEventWaiting)currentFLActivity).TimeUnit;
            notifyActivity.NavigatorMode = ((IEventWaiting)currentFLActivity).NavigatorMode;
            notifyActivity.FLNavigatorMode = ((IEventWaiting)currentFLActivity).FLNavigatorMode;
            notifyActivity.UserId = ((IEventWaitingExecute)currentFLActivity).UserId;
            notifyActivity.RoleId = ((IEventWaitingExecute)currentFLActivity).RoleId;
            notifyActivity.SendEmail = ((IFLRootActivity)this.RootFLActivity).NotifySendMail;

            return notifyActivity;

            // OnReject(this, new __FLInstanceRejectEventArgs());
        }