private ChatItem GetChatItem(TaskAnswer answer, TaskStateCode stateCode) { TrainBookingState taskState = answer.TaskState as TrainBookingState; if (taskState == null) { return null; } string question; if (!_chatItemMap.TryGetValue(stateCode, out question)) { question = "Some Error. it shouldn't"; } ChatItem item = new ChatItem(); item.Id = "Cortana"; item.ChatText = question; return item; }
private bool TryGetNextPassengerState(PassangerInfo passanger, out TaskStateCode nextState) { nextState = TaskStateCode.ExceptionState; if (string.IsNullOrEmpty(passanger.Name)) { nextState = TaskStateCode.PassengerNameState; return true; } if (passanger.Gender.Equals(Gender.None)) { nextState = TaskStateCode.PassengerGenderState; return true; } if (passanger.Age == 0) { nextState = TaskStateCode.PassengerAgeState; return true; } if (passanger.BerthChoice.Equals(BerthChoice.None)) { nextState = TaskStateCode.PassengerSeatPreferenceState; return true; } return false; }