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()); }
public bool Accept(ParticipatingInfo participant) { return(!string.IsNullOrWhiteSpace(participant.Name) && participant.Major.HasValue && participant.EnglishPercent.HasValue && participant.MathPercent == null); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.SignalPercent; return(new QuestionRequest() { Message = "درصد سیگنال:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.MagneticPercent; return(new QuestionRequest() { Message = "درصد الکترومغناطیس:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.CircutePercent; return(new QuestionRequest() { Message = "ÏÑÕÏ ãÏÇÑ:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.EnglishPercent; return(new QuestionRequest() { Message = "درصد زبان:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.ControllPercent; return(new QuestionRequest() { Message = "ÏÑÕÏ ˜äÊÑá:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.Name; return(new QuestionRequest() { Message = "نام و نام خانوادگی:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.RateAmount; return(new QuestionRequest() { Message = "معدل:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.MachinePercent; return(new QuestionRequest() { Message = "درصد ماشین:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.ElectronicsPercent; return(new QuestionRequest() { Message = "درصد الکترونیک:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.PhoneNumber; return(new QuestionRequest() { Message = "ÔãÇÑå ÊãÇÓ:" }); }
public QuestionRequest Handle(ParticipatingInfo participant) { participant.LastQuestion = Questions.Major; return(new QuestionRequest() { ResponceType = ResponceType.Choose, SelectionList = Configure.MajorTypeString.Select(it => it.Value).ToList(), Message = "گرایش:" }); }
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); }
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); }
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)); }
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()); }
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()); }
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()); }
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()); }
public abstract bool Accept(ParticipatingInfo participant);
public bool Accept(ParticipatingInfo participant) { return(participant.LastQuestion == Questions.PhoneNumber); }
public bool Accept(ParticipatingInfo participant) { return(string.IsNullOrWhiteSpace(participant.Name)); }
public bool Accept(ParticipatingInfo participant) { return(!string.IsNullOrWhiteSpace(participant.Name) && participant.Major == null); }
public bool Accept(ParticipatingInfo participant) { return(participant.LastQuestion == Questions.RateAmount); }
public bool Accept(ParticipatingInfo participant) { return(participant.LastQuestion == Questions.Major); }
public override bool Accept(ParticipatingInfo participant) { return(participant.LastQuestion == Questions.CircutePercent); }
public override bool Accept(ParticipatingInfo participant) { return(participant.LastQuestion == Questions.ElectronicsPercent); }