예제 #1
0
        private CodeStatementCollection GenerateCoreGroupMethod(GroupActivity groupActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();

            invocationCodeCollection.AddRange(this.coreProcessBuilder.GenerateStartCodeStatement(groupActivity.Transitions, "start", null, this.activityNameToServiceNameDictionnary));
            return invocationCodeCollection;
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("GoupActivityId,GroupId,Description,ActivityDate,Isrecurring,FrequencyId,OwnerId")] GroupActivity groupActivity)
        {
            if (id != groupActivity.GoupActivityId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(groupActivity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GroupActivityExists(groupActivity.GoupActivityId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GroupId"] = new SelectList(_context.Groups, "GroupId", "GroupId", groupActivity.GroupId);
            ViewData["OwnerId"] = new SelectList(_context.UniversityUsers, "UniversityId", "UniversityId", groupActivity.OwnerId);
            return(View(groupActivity));
        }
예제 #3
0
        private CodeIterationStatement GenerateForRepeat(GroupActivity groupActivity, bool isRepeat)
        {
            var coreGroupMethodStatement = new CodeStatementCollection();

            // get the core loop code
            coreGroupMethodStatement.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            var coreOfTheLoop = new CodeStatement[coreGroupMethodStatement.Count];

            coreGroupMethodStatement.CopyTo(coreOfTheLoop, 0);

            string outCondition;

            if (isRepeat)
            {
                outCondition = "!(" + this.xpathBuilder.Build(groupActivity.RepeatCondition) + ")";
            }
            else
            {
                outCondition = this.xpathBuilder.Build(groupActivity.RepeatCondition);
            }

            var whileLoop = new CodeIterationStatement(
                new CodeSnippetStatement(string.Empty),
                new CodeSnippetExpression(outCondition),
                new CodeSnippetStatement(string.Empty),
                coreOfTheLoop);

            return(whileLoop);
        }
        public void SetUp()
        {
            this.groupActivityBuilder = new GroupActivityBuilder();
            this.activity             = new GroupActivity("My Activity Name", ActivityType.loopGroupActivityType);

            this.activity.Activities = new List <Activity>
            {
                new Activity("myNullActivity", ActivityType.nullActivityType),
            };
            this.activity.Transitions = new List <Transition>
            {
                new Transition
                {
                    FromActivity  = "start",
                    ToActivity    = "myNullActivity",
                    ConditionType = ConditionType.always
                },
                new Transition
                {
                    FromActivity  = "myNullActivity",
                    ToActivity    = "end",
                    ConditionType = ConditionType.always
                }
            };
        }
예제 #5
0
        private CodeIterationStatement GenerateForLoop(GroupActivity groupActivity)
        {
            var coreGroupMethodStatement = new CodeStatementCollection();

            // put the current element in the declare variable
            // TODO convert the $Variable in variable like in Xpath
            var iterationElementSlotDeclaration = new CodeVariableDeclarationStatement("var", groupActivity.IterationElementSlot, new CodeVariableReferenceExpression(this.xpathBuilder.Build(groupActivity.Over) + "[" + groupActivity.IndexSlot + "]"));

            coreGroupMethodStatement.Add(iterationElementSlotDeclaration);

            // Get the core loop code
            coreGroupMethodStatement.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            var coreOfTheLoop = new CodeStatement[coreGroupMethodStatement.Count];

            coreGroupMethodStatement.CopyTo(coreOfTheLoop, 0);

            // put it then in the loop
            var forLoop = new CodeIterationStatement(
                new CodeVariableDeclarationStatement(typeof(int), groupActivity.IndexSlot, new CodePrimitiveExpression(0)),
                new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.LessThan, new CodeVariableReferenceExpression(this.xpathBuilder.Build(groupActivity.Over) + ".Length")),
                new CodeAssignStatement(new CodeVariableReferenceExpression(groupActivity.IndexSlot), new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.Add, new CodePrimitiveExpression(1))),
                coreOfTheLoop);

            return(forLoop);
        }
예제 #6
0
        public async Task <IActionResult> Create(GroupActivity groupActivity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupActivity);
                await _context.SaveChangesAsync();

                int groupActivityId   = groupActivity.GoupActivityId;
                var studentIdsInGroup = _context.GroupMemberships.Where(g => g.GroupId == groupActivity.GroupId).Select(m => m.StudentId).ToList();

                foreach (var studentId in studentIdsInGroup)
                {
                    GroupActivityMembership groupActivityMembership = new GroupActivityMembership();
                    groupActivityMembership.GroupId        = groupActivity.GroupId;
                    groupActivityMembership.GoupActivityId = groupActivityId;
                    groupActivityMembership.StudentId      = studentId;
                    groupActivityMembership.StatusId       = groupActivity.OwnerId == studentId ? (int)Status.Accepted : (int)Status.Invited;
                    _context.Add(groupActivityMembership);
                    await _context.SaveChangesAsync();
                }

                return(RedirectToAction("Index", new { groupId = groupActivity.GroupId, studentId = groupActivity.OwnerId }));
            }

            return(View(groupActivity));
        }
예제 #7
0
        // GET: GroupActivities/Create
        public IActionResult Create(int groupId, int studentId)
        {
            var groupActivity = new GroupActivity();

            groupActivity.GroupId = groupId;
            groupActivity.OwnerId = studentId;
            return(View(groupActivity));
        }
        public List <Activity> ParseGroupActivities(XElement allFileElement)
        {
            IEnumerable <XElement> groupElements = from element in allFileElement.Elements(XmlnsConstant.tibcoProcessNameSpace + "group")
                                                   select element;
            var activities = new List <Activity> ();

            foreach (XElement element in groupElements)
            {
                var activity = new GroupActivity
                {
                    Name = element.Attribute("name").Value,
                    Type = (ActivityType)element.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value
                };
                var configElement = element.Element("config");

                var groupTypeString =
                    XElementParserUtils.GetStringValue(
                        configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "groupType"));
                try
                {
                    activity.GroupType = (GroupType)Enum.Parse(typeof(GroupType), groupTypeString.ToUpper());
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine("An error occurred:--", ex);
                }

                if (activity.GroupType == GroupType.INPUTLOOP)
                {
                    activity.Over = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "over"));
                    activity.IterationElementSlot = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "iterationElementSlot"));
                    activity.IndexSlot            = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "indexSlot"));
                }
                else if (activity.GroupType == GroupType.REPEAT)
                {
                    activity.IndexSlot       = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "indexSlot"));
                    activity.RepeatCondition = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "repeatCondition"));
                }
                else if (activity.GroupType == GroupType.WHILE)
                {
                    activity.RepeatCondition = XElementParserUtils.GetStringValue(configElement.Element(XmlnsConstant.tibcoProcessNameSpace + "whileCondition"));
                }

                if (element.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings") != null)
                {
                    activity.InputBindings = element.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Nodes();
                }

                activity.Transitions = this.ParseTransitions(element);
                activity.Activities  = this.ParseStandardActivities(element);
                activities.Add(activity);
            }

            return(activities);
        }
예제 #9
0
        private CodeStatementCollection GenerateForCriticalSection(GroupActivity groupActivity)
        {
            // TODO ADD the myLock object as a field in the process
            var invocationCodeCollection = new CodeStatementCollection();

            invocationCodeCollection.Add(
                new CodeSnippetStatement("lock (" + VariableHelper.ToVariableName(groupActivity.Name) + "Lock){"));
            invocationCodeCollection.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            invocationCodeCollection.Add(new CodeSnippetStatement("}"));

            return(invocationCodeCollection);
        }
예제 #10
0
        private CodeStatementCollection GenerateCoreGroupMethod(GroupActivity groupActivity)
        {
            var invocationCodeCollection = new CodeStatementCollection();

            try
            {
                invocationCodeCollection.AddRange(this.coreProcessBuilder.GenerateMainCodeStatement(groupActivity.Transitions, "start", null, this.activityNameToServiceNameDictionnary));
            }
            catch (Exception e)
            {
                invocationCodeCollection.Add(new CodeSnippetStatement("// TODO : Unable to Generate code for this Group"));
                Log.Error("################ Unable to Generate code for this Group :" + groupActivity.Name, e);
            }

            return(invocationCodeCollection);
        }
예제 #11
0
        /// <summary>
        /// 开启活动并返回自增id
        /// </summary>
        /// <param name="group">群组</param>
        /// <param name="type">活动类型</param>
        /// <param name="endTime">结束时间(预计)</param>
        /// <returns></returns>
        public async Task <int> OpenActivityAsync(string group, ActivityTypes type, DateTime endTime)
        {
            var info = new GroupActivity()
            {
                ActivityStateType = ActivityStateTypes.Open,
                Group             = group,
                ActivityType      = type,
                PredictEndTime    = endTime,
            };

            PikachuDataContext.GroupActivities.Add(info);

            await PikachuDataContext.SaveChangesAsync();

            return(info.Id);
        }
예제 #12
0
        /// <summary>
        /// 关闭活动
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int CloseActivity(int id, string description, out GroupActivity info)
        {
            info = PikachuDataContext.GroupActivities.FirstOrDefault(u => u.Id == id);

            if (info == null || info.ActivityStateType == ActivityStateTypes.Close)
            {
                return(0);
            }

            if (info.ActivityStateType == ActivityStateTypes.Close)
            {
                return(0);
            }

            info.ActivityStateType = ActivityStateTypes.Close;
            info.EndTime           = DateTime.Now;
            info.Description       = description;

            return(PikachuDataContext.SaveChanges());
        }
예제 #13
0
        private CodeIterationStatement GenerateForLoop(GroupActivity groupActivity)
        {
            var coreGroupMethodStatement = new CodeStatementCollection();

            // put the current element in the declare variable
            // TODO convert the $Variable in variable like in Xpath
            CodeVariableDeclarationStatement iterationElementSlotDeclaration = new CodeVariableDeclarationStatement("var", groupActivity.IterationElementSlot, new CodeVariableReferenceExpression(groupActivity.Over + "[" + groupActivity.IndexSlot + "]"));
            coreGroupMethodStatement.Add(iterationElementSlotDeclaration);
            // get the core loop code
            coreGroupMethodStatement.AddRange(this.GenerateCoreGroupMethod(groupActivity));
            var array = new CodeStatement[coreGroupMethodStatement.Count];
            coreGroupMethodStatement.CopyTo(array, 0);

            // put it then in the loop
            CodeIterationStatement forLoop = new CodeIterationStatement(new CodeVariableDeclarationStatement(typeof(int), groupActivity.IndexSlot, new CodePrimitiveExpression(0)),
                new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.LessThan, new CodeVariableReferenceExpression(groupActivity.Over + ".Lenght")),
                new CodeAssignStatement(new CodeVariableReferenceExpression(groupActivity.IndexSlot), new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(groupActivity.IndexSlot), CodeBinaryOperatorType.Add, new CodePrimitiveExpression(1))),
                array);
            return forLoop;
        }
예제 #14
0
        public void SetUp()
        {
            this.groupActivityBuilder = new GroupActivityBuilder(new XslBuilder(new XpathBuilder()));
            this.activity = new GroupActivity( "My Activity Name",ActivityType.groupActivityType);

            this.activity.Activities = new List<Activity>{
                new Activity("myNullActivity",ActivityType.nullActivityType),
            };
            this.activity.Transitions = new List<Transition>{
                new Transition{
                    FromActivity="start",
                    ToActivity="myNullActivity",
                    ConditionType=ConditionType.always
                },
                new Transition{
                    FromActivity="myNullActivity",
                    ToActivity="end",
                    ConditionType=ConditionType.always
                }
            };
        }
예제 #15
0
        public static string GetEventDetails(GroupActivity groupActivity)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("BEGIN:VEVENT");
            sb.AppendLine("DTSTART:" + groupActivity.StartTime.ToString("yyyyMMddTHHmm00"));
            sb.AppendLine("DTEND:" + groupActivity.EndTime.ToString("yyyyMMddTHHmm00"));
            if (groupActivity.Isrecurring)
            {
                sb.AppendLine(String.Concat("RRULE:", "FREQ=", groupActivity.FrequencyName.ToUpper(), ";", "UNTIL=20210731T000000Z"));
            }
            sb.AppendLine("UID:" + (Guid.NewGuid().ToString() + DateTime.Now.ToString("yyyyMMddTHHmm00")));
            sb.AppendLine("DTSTAMP:" + DateTime.Now.ToString("yyyyMMddTHHmm00"));
            sb.AppendLine("SUMMARY:" + groupActivity.Summary + "");
            sb.AppendLine("LOCATION:" + groupActivity.Location + "");
            sb.AppendLine("DESCRIPTION:" + groupActivity.Description + "");
            sb.AppendLine("PRIORITY:3");
            sb.AppendLine("END:VEVENT");

            return(sb.ToString());
        }
예제 #16
0
    void OnMouseDown()
    {
        if (Var.OnTutorial == false || Var.Mng.Tutorial.Page == 43)
        {
            Var.Mng.AudioSources[0].Play();
            if (Var.MenuActivated == true)
            {
                Group = Instantiate(GroupPrefab) as GroupActivity;
            }
            else
            {
                Notice            = Instantiate(NoticePf) as NoticeMessage;
                Notice.NoticeType = NoticeMessage.NoticeTypes.AlreadyGroupActivity;
            }

            if (Var.OnTutorial == true)
            {
                Var.Mng.Tutorial.Page += 1;
            }
        }
    }
        /// <summary>
        /// select Query to ReleaseChecklistAnswerView
        /// </summary>
        /// <param name="Expression"></param>
        /// <returns></returns>
        private IQueryable <ReleaseChecklistAnswerView> SelectReleaseChecklistAnswerView(Expression <Func <ReleaseChecklistAnswerView, bool> > Expression = null, string Sorting = null)
        {
            int ReleaseChecklistAnswerTableID = StaticResources.GetTableID(typeof(ReleaseChecklistAnswer).Name);
            //select
            IQueryable <ReleaseChecklistAnswerView> Query =
                from Tbl in DbSet
                .Include(p => p.Release)                    //
                .Include(p => p.SubArea)                    //
                .Include(p => p.SubArea.Area)               //
                .Include(p => p.QuestionOwner)              //
                .Include(p => p.Question.Stakeholder)       //
                .Include(p => p.Question.Milestone)         //
                join activity in (
                    Context.Set <History>()
                    .Include(a => a.ActivityLog)
                    .Where(a => a.TableID == ReleaseChecklistAnswerTableID)                            // && a.Employee.UserName=="System")
                    .GroupBy(c => c.ItemID)
                    .Select(g => new { Key = g.Key, MaxDate = g.Max(x => x.ActivityLog.Date) })

                    ) on Tbl.ReleaseChecklistAnswerID equals activity.Key into GroupActivity
                from activityLastDate in GroupActivity.DefaultIfEmpty()
                select new ReleaseChecklistAnswerView
            {
                ReleaseChecklistAnswerID = Tbl.ReleaseChecklistAnswerID,
                ReleaseID             = Tbl.ReleaseID,
                ReleaseName           = Tbl.Release.Name,
                QuestionID            = Tbl.QuestionID,
                QuestionCode          = Tbl.Question.QuestionCode,
                SubAreaID             = Tbl.SubArea.SubAreaID,
                SubAreaName           = Tbl.SubArea.Name,
                AreaID                = Tbl.AreaID,
                AreaName              = Tbl.Area.Name,
                QuestionMilestoneID   = Tbl.Question.MilestoneID,
                QuestionMilestoneName = Tbl.Question.Milestone.Name,
                QuestionText          = Tbl.QuestionText,
                QuestionInfo          = Tbl.QuestionInfo,
                QuestionOwnerID       = Tbl.QuestionOwnerID,
                QuestionOwnerName     = Tbl.QuestionOwner == null ? (Tbl.Question.QuestionOwnerID == null?Tbl.Area.Name:Tbl.Question.Stakeholder.Name) : ((Tbl.QuestionOwner.FirstName ?? "") + " " + (Tbl.QuestionOwner.LastName ?? "")),


                //: Tbl.Release.ReleaseAreaOwners.Where(a=>a.AreaID==Tbl.SubArea.AreaID).FirstOrDefault().AmdocsFocalPoint1.FirstName+" "+ Tbl.Release.ReleaseAreaOwners.Where(a => a.AreaID == Tbl.SubArea.AreaID).FirstOrDefault().AmdocsFocalPoint1.LastName,
                HandlingStartDate       = Tbl.HandlingStartDate,
                ActualComplation        = Tbl.ActualComplation,
                RiskLevelID             = Tbl.RiskLevelID,
                ExtrenalFocalPoint      = Tbl.ExtrenalFocalPoint,
                Responsibility          = Tbl.Responsibility,
                Comments                = Tbl.Comments,
                QuestionOrder           = Tbl.Question.Order,
                IsEdited                = Tbl.IsEdited,
                LastAutomaticUpdateDate = Tbl.LastAutomaticUpdateDate,
                //LastModifiedDate = activityLastDate.MaxDate
                LastModifiedDate = DateTime.MaxValue
            };

            //filter
            if (Expression != null)
            {
                Query = Query.Where(Expression);
            }
            //Sorting
            if (Sorting != null)
            {
                Query = Query.GetOrderByQuery(Sorting);
            }

            return(Query);
        }
예제 #18
0
 private void LaunchGroup()
 {
     GroupActivity.Launch(_groupBaseActivity, _pwGroup, _groupBaseActivity.AppTask, new ActivityLaunchModeRequestCode(0));
     //_groupBaseActivity.OverridePendingTransition(Resource.Animation.anim_enter, Resource.Animation.anim_leave);
 }