public AskForRest SomeOneRejectTheRequest(AskForRest request)
        {
            var name = request.CheckingPerson;

            request.CheckingStatus = RequestStatus.Reject;
            Console.WriteLine($"{name} reject request:{request.key}");

            return(request);
        }
        public AskForRest SomeOnePassTheRequest(AskForRest request)
        {
            var name = request.CheckingPerson;

            request.CheckingStatus = RequestStatus.Pass;
            Console.WriteLine($"{name} pass request:{request.key}");

            return(request);
        }
        /// <summary>
        /// 通知申請人假單被拒絕
        /// </summary>
        public override void Define()
        {
            AskForRest request = null;

            When()
            .Match <AskForRest>(() => request, x => x.CheckingStatus == RequestStatus.Reject);

            Then()
            .Do(_ => MessageService.SendMessageToPerson(
                    request.Name, $"{request.key} reject by {request.CheckingPerson}"));
        }
Example #4
0
        /// <summary>
        /// 通知對象審核假單
        /// </summary>
        public override void Define()
        {
            AskForRest request = null;

            When()
            .Match <AskForRest>(() => request,
                                x => x.CheckingStatus == RequestStatus.Checking);

            Then()
            .Do(_ => MessageService.SendMessageToPerson(request.CheckingPerson, $"有一張{request.Name}的假單待批"));
        }
        /// <summary>
        /// 通知申請人假單完成
        /// </summary>
        public override void Define()
        {
            AskForRest    request = null;
            RequestStatus status  = RequestStatus.Init;

            When()
            .Match <AskForRest>(() => request, x => x.IsFinish, x => x.CheckingStatus == RequestStatus.Checking);

            Then()
            .Do(_ => MessageService.SendMessageToPerson(request.Name, $"{request.key} has finish"))
            .Do(_ => SetCheckingStatusToFinish(request))
            .Do(ctx => ctx.Update(request));
        }
Example #6
0
        /// <summary>
        /// 通知申請人假單被通過
        /// </summary>
        public override void Define()
        {
            AskForRest request = null;

            When()
            .Match <AskForRest>(() => request, x => x.CheckingStatus == RequestStatus.Pass);

            Then()
            .Do(_ => MessageService.SendMessageToPerson(
                    request.Name, $"{request.key} pass by {request.CheckingPerson}"))
            .Do(_ => SetCheckingStatusToPass(request))
            .Do(_ => request.CheckList.Dequeue())
            .Do(ctx => ctx.Update(request));
        }
        public AskForRest SendAskForRestRequest()
        {
            var request = new AskForRest(
                "皓之",
                "遠松",
                new DateTime(2020, 2, 10),
                new DateTime(2020, 2, 13));

            //SendRequest
            request.CheckingStatus = RequestStatus.Checking;

            Console.WriteLine($"{request.Name}新增了一張假單 代理人{request.Proxy}" +
                              $" 時間{request.StartTime}到{request.EndTime}");

            return(request);
        }
        public override void Define()
        {
            AskForRest request       = null;
            AskForRest requestFinish = null;
            string     person        = null;

            When()
            .Match <AskForRest>(() => request, x => !x.IsFinish)
            .Exists <AskForRest>(
                x => x.Name == request.Proxy && x.IsFinish,
                x => CheckRestTime(x, request));

            Then()
            .Do(_ => SetCheckingStatusToInit(request))
            .Do(_ => MessageService.SendMessageToPerson(request.Name, $"假單:{request.key} 代理人{request.Proxy}在時間內有假,無法代理"))
            .Do(ctx => ctx.Update(request));
        }
        public AskForRest GetPorxyAlreadyRestThatDay(string name, string proxy)
        {
            var request = new AskForRest(
                name,
                proxy,
                new DateTime(2020, 2, 10),
                new DateTime(2020, 2, 13));

            //SendRequest
            request.CheckingStatus = RequestStatus.Finish;
            request.CheckList      = new Queue <string>();

            Console.WriteLine($"{request.Name}新增了一張假單 代理人{request.Proxy}" +
                              $" 時間{request.StartTime}到{request.EndTime}");

            return(request);
        }
 private static void SetCheckingStatusToInit(AskForRest request)
 {
     request.CheckingStatus = RequestStatus.Init;
 }
 public static bool CheckRestTime(AskForRest x, AskForRest y)
 {
     return(true);
 }
 private static void SetCheckingStatusToFinish(AskForRest request)
 {
     request.CheckingStatus = RequestStatus.Finish;
 }
Example #13
0
 public AskForRest ReSendToContinueRequest(AskForRest request)
 {
     request.CheckingStatus = RequestStatus.Checking;
     Console.WriteLine($"{request.Name}重新送出未通過的假單:{request.key}");
     return(request);
 }
Example #14
0
 private static void SetCheckingStatusToPass(AskForRest request)
 {
     request.CheckingStatus = RequestStatus.Checking;
 }