Example #1
0
        public Activity(int id)
        {
            m_ActivityId = id;

            F_ACTIVITY activity = DAL.WorkFlow.Activity.Get(m_ActivityId);

            this.Type         = activity.Type;
            this.JoinType     = activity.JoinType;
            this.SplitType    = activity.SplitType;
            this.FlowDefine   = new FlowDefine(activity.FlowID);
            this.CompleteType = activity.CompleteType;
            this.ReturnType   = activity.ReturnType;
            this.Name         = activity.Name;
            this.IsSign       = activity.IsSignature;
            this.IsSms        = activity.IsSMS;
        }
Example #2
0
        public static bool Save(F_ACTIVITY entity)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                var model = dbContext.F_ACTIVITY.FirstOrDefault(t => t.ID == entity.ID);

                model.AutoByPass   = entity.AutoByPass;
                model.CompleteType = entity.CompleteType;
                model.Description  = entity.Description;
                model.FlowID       = entity.FlowID;
                model.JoinType     = entity.JoinType;
                model.Name         = entity.Name;
                model.SplitType    = entity.SplitType;
                model.Type         = entity.Type;

                dbContext.SubmitChanges();
            }

            return(true);
        }
Example #3
0
        /// <summary>
        /// 得到下一关卡集合
        /// </summary>
        /// <param name="activityInstanceId">关卡实例id</param>
        /// <returns>关卡集合</returns>
        public List <F_ACTIVITY> GetNextActivitys(int activityInstId)
        {
            List <F_ACTIVITY> listActivity = new List <F_ACTIVITY>();

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
            {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                //获得关卡的发散Transation
                ActivityInstance activityInst = new ActivityInstance(activityInstId);

                List <Transation> listTransation = activityInst.Activity.SplitTransations;

                List <TransationInstance> listTransationInstance = new List <TransationInstance>();

                //实例化Transation并解析
                foreach (Transation trans in listTransation)
                {
                    //解析Transation条件
                    TransationInstance transInst = new TransationInstance();
                    transInst.Create(activityInst.ID, trans.ID);
                    transInst.Parse();

                    if (transInst.Value)
                    {
                        //关卡集合
                        F_ACTIVITY activity = new F_ACTIVITY();

                        activity.ID   = transInst.Transation.ToActivity.ID;
                        activity.Name = transInst.Transation.ToActivity.Name;

                        listActivity.Add(activity);
                    }
                }

                scope.Complete();

                return(listActivity);
            }
        }
Example #4
0
        public static decimal Insert(F_ACTIVITY entity)
        {
            using (MainDataContext dbContext = new MainDataContext())
            {
                var list = from a in dbContext.F_INST_FLOW select a.ID;

                long total = list.LongCount();

                if (total == 0)
                {
                    entity.ID = 1;
                }
                else
                {
                    entity.ID = dbContext.F_ACTIVITY.Max(a => a.ID) + 1;
                }

                dbContext.F_ACTIVITY.InsertOnSubmit(entity);

                dbContext.SubmitChanges();

                return(entity.ID);
            }
        }