Ejemplo n.º 1
0
 public AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
 {
     if (participant.Answers.ContainsKey(participant.LastQuestion))
     {
         participant.Answers[participant.LastQuestion] = request.Message;
     }
     else
     {
         participant.Answers.Add(participant.LastQuestion, request.Message);
     }
     if (string.IsNullOrWhiteSpace(request.Message))
     {
         return(new AnswerResponse("گرایش نمی تواند خالی باشد", true));
     }
     if (request.Message.Contains(@"\") || request.Message.Contains(@"/") || request.Message.Contains(@"*") || request.Message.Contains(@"#") || request.Message.Contains(@"@"))
     {
         return(new AnswerResponse(@"'گرایش نمی تواند دارای کاراکتر های /\*#@ باشد", true));
     }
     if (Configure.MajorTypeString.All(it => it.Value.Trim() != request.Message.Trim()))
     {
         return(new AnswerResponse(@"'گرایش مورد نظر یافت نشد", true));
     }
     participant.Major = (MajorType)Configure.MajorTypeString.First(it => it.Value.Trim() == request.Message.Trim()).Key;
     return(new AnswerResponse());
 }
Ejemplo n.º 2
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(!string.IsNullOrWhiteSpace(participant.Name) &&
            participant.Major.HasValue &&
            participant.EnglishPercent.HasValue &&
            participant.MathPercent == null);
 }
Ejemplo n.º 3
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.SignalPercent;
     return(new QuestionRequest()
     {
         Message = "درصد سیگنال:"
     });
 }
Ejemplo n.º 4
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.MagneticPercent;
     return(new QuestionRequest()
     {
         Message = "درصد الکترومغناطیس:"
     });
 }
Ejemplo n.º 5
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.CircutePercent;
     return(new QuestionRequest()
     {
         Message = "ÏÑÕÏ ãÏÇÑ:"
     });
 }
Ejemplo n.º 6
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.EnglishPercent;
     return(new QuestionRequest()
     {
         Message = "درصد زبان:"
     });
 }
Ejemplo n.º 7
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.ControllPercent;
     return(new QuestionRequest()
     {
         Message = "ÏÑÕÏ ˜äÊÑá:"
     });
 }
Ejemplo n.º 8
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.Name;
     return(new QuestionRequest()
     {
         Message = "نام و نام خانوادگی:"
     });
 }
Ejemplo n.º 9
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.RateAmount;
     return(new QuestionRequest()
     {
         Message = "معدل:"
     });
 }
Ejemplo n.º 10
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.MachinePercent;
     return(new QuestionRequest()
     {
         Message = "درصد ماشین:"
     });
 }
Ejemplo n.º 11
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.ElectronicsPercent;
     return(new QuestionRequest()
     {
         Message = "درصد الکترونیک:"
     });
 }
Ejemplo n.º 12
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.PhoneNumber;
     return(new QuestionRequest()
     {
         Message = "ÔãÇÑå ÊãÇÓ:"
     });
 }
Ejemplo n.º 13
0
 public QuestionRequest Handle(ParticipatingInfo participant)
 {
     participant.LastQuestion = Questions.Major;
     return(new QuestionRequest()
     {
         ResponceType = ResponceType.Choose,
         SelectionList = Configure.MajorTypeString.Select(it => it.Value).ToList(),
         Message = "گرایش:"
     });
 }
Ejemplo n.º 14
0
        public override AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
        {
            var result = base.Handle(participant, request);

            if (!result.HasError)
            {
                participant.CircutePercent = decimal.Parse(request.Message);
                return(result);
            }
            return(result);
        }
Ejemplo n.º 15
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(!string.IsNullOrWhiteSpace(participant.Name) &&
            participant.Major.HasValue &&
            participant.EnglishPercent.HasValue &&
            participant.MathPercent.HasValue &&
            participant.CircutePercent.HasValue &&
            participant.ElectronicsPercent.HasValue &&
            participant.SignalPercent.HasValue &&
            participant.ControllPercent == null);
 }
Ejemplo n.º 16
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(!string.IsNullOrWhiteSpace(participant.Name) &&
            participant.Major.HasValue &&
            participant.EnglishPercent.HasValue &&
            participant.MathPercent.HasValue &&
            participant.CircutePercent.HasValue &&
            participant.ElectronicsPercent.HasValue &&
            participant.SignalPercent.HasValue &&
            participant.ControllPercent.HasValue &&
            participant.MachinePercent.HasValue &&
            participant.MagneticPercent.HasValue &&
            participant.RateAmount.HasValue &&
            string.IsNullOrWhiteSpace(participant.PhoneNumber));
 }
Ejemplo n.º 17
0
 public AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
 {
     if (participant.Answers.ContainsKey(participant.LastQuestion))
     {
         participant.Answers[participant.LastQuestion] = request.Message;
     }
     else
     {
         participant.Answers.Add(participant.LastQuestion, request.Message);
     }
     if (!Regex.IsMatch(request.Message, @"(0|\+98)?([ ]|,|-|[()]){0,2}9[1|2|3|4]([ ]|,|-|[()]){0,2}(?:[0-9]([ ]|,|-|[()]){0,2}){8}"))
     {
         return(new AnswerResponse("الگوی شماره تماس صحیح نمی باشد", true));
     }
     participant.PhoneNumber = request.Message;
     return(new AnswerResponse());
 }
Ejemplo n.º 18
0
 public AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
 {
     if (participant.Answers.ContainsKey(participant.LastQuestion))
     {
         participant.Answers[participant.LastQuestion] = request.Message;
     }
     else
     {
         participant.Answers.Add(participant.LastQuestion, request.Message);
     }
     if (string.IsNullOrWhiteSpace(request.Message))
     {
         return(new AnswerResponse("نام و نام خانوادگی نمی تواند خالی باشد", true));
     }
     if (request.Message.Contains(@"\") || request.Message.Contains(@"/") || request.Message.Contains(@"*") || request.Message.Contains(@"#") || request.Message.Contains(@"@"))
     {
         return(new AnswerResponse(@"نام و نام خانوادگی نمی تواند دارای کاراکتر های /\*#@ باشد", true));
     }
     participant.Name = request.Message;
     return(new AnswerResponse());
 }
Ejemplo n.º 19
0
        public AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
        {
            if (participant.Answers.ContainsKey(participant.LastQuestion))
            {
                participant.Answers[participant.LastQuestion] = request.Message;
            }
            else
            {
                participant.Answers.Add(participant.LastQuestion, request.Message);
            }
            decimal val;

            if (!decimal.TryParse(request.Message, out val))
            {
                return(new AnswerResponse("معدل بین 0 تا 20 می باشد!!!", true));
            }
            if (val < 0 || val > 20)
            {
                return(new AnswerResponse("معدل بین 0 تا 20 می باشد!!!", true));
            }
            participant.RateAmount = decimal.Parse(request.Message);
            return(new AnswerResponse());
        }
Ejemplo n.º 20
0
        public virtual AnswerResponse Handle(ParticipatingInfo participant, AnswerRequest request)
        {
            log.InfoFormat("answer {0} {1} {2} {3} {4} {5}", request.ChatId, request.UserName, request.Message, request.FirstName, request.LastName, request.ChatType.ToString());
            if (participant.Answers.ContainsKey(participant.LastQuestion))
            {
                participant.Answers[participant.LastQuestion] = request.Message;
            }
            else
            {
                participant.Answers.Add(participant.LastQuestion, request.Message);
            }
            decimal val;

            if (!decimal.TryParse(request.Message, out val))
            {
                return(new AnswerResponse(Message, true));
            }
            if (val < -33 || val > 100)
            {
                return(new AnswerResponse(Message, true));
            }
            return(new AnswerResponse());
        }
Ejemplo n.º 21
0
 public abstract bool Accept(ParticipatingInfo participant);
Ejemplo n.º 22
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(participant.LastQuestion == Questions.PhoneNumber);
 }
Ejemplo n.º 23
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(string.IsNullOrWhiteSpace(participant.Name));
 }
Ejemplo n.º 24
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(!string.IsNullOrWhiteSpace(participant.Name) && participant.Major == null);
 }
Ejemplo n.º 25
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(participant.LastQuestion == Questions.RateAmount);
 }
Ejemplo n.º 26
0
 public bool Accept(ParticipatingInfo participant)
 {
     return(participant.LastQuestion == Questions.Major);
 }
Ejemplo n.º 27
0
 public override bool Accept(ParticipatingInfo participant)
 {
     return(participant.LastQuestion == Questions.CircutePercent);
 }
Ejemplo n.º 28
0
 public override bool Accept(ParticipatingInfo participant)
 {
     return(participant.LastQuestion == Questions.ElectronicsPercent);
 }