예제 #1
0
파일: PathDone.cs 프로젝트: hebert26/NRules
        private void CompletePath(IContext ctx, Context context, Seating seating)
        {
            seating.SetPathDone();
            ctx.Update(seating);

            context.SetState(ContextState.CheckDone);
            ctx.Update(context);
        }
예제 #2
0
        private void AssignSeat(IContext ctx, Context context, Guest guest, Count count)
        {
            var cnt = count.Value;

            var seating = new Seating(cnt, 0, true, 1, guest.Name, 1, guest.Name);
            ctx.Insert(seating);

            var path = new Path(cnt, 1, guest.Name);
            ctx.Insert(path);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.AssignSeats);
            ctx.Update(context);
        }
예제 #3
0
        private void AssignSeat(IContext ctx, Context context, Seating seating, Guest guest1, Guest guest2, Count count)
        {
            int rightSeat = seating.RightSeatId;
            int seatId = seating.Id;
            int cnt = count.Value;

            var newSeating = new Seating(cnt, seatId, false, rightSeat, seating.RightGuestName, rightSeat + 1, guest2.Name);
            ctx.Insert(newSeating);

            var path = new Path(cnt, rightSeat + 1, guest2.Name);
            ctx.Insert(path);

            var chosen = new Chosen(seatId, guest2.Name, guest1.Hobby);
            ctx.Insert(chosen);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.MakePath);
            ctx.Update(context);
        }