public MailingDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, IEmailSender emailSender, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, StuddyBotContext db ) : base(nameof(MailingDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; EmailSender = emailSender; _db = db; _dialogInfoStateProperty = dialogInfoStateProperty; _subscriptionManager = SubscriptionManager; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new TextPrompt("email", EmailFormValidator)); AddDialog(new ChoicePrompt("validation", CodeValidator)); AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new FinishDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { CheckForEmailStepAsync, AskEmailStepAsync, SendDialogStepAsync, FinalStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public CoursesDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, IEmailSender emailSender, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(CoursesDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; //_DialogInfo = dialogInfo; //_conversationReferences = conversationReferences; _db = db; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); //AddDialog(new ChooseOptionDialog(DecisionMaker, _myLogger, dialogInfo, conversationReferences)); AddDialog(new FinishDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, //dialogInfo, //conversationReferences, db )); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { AskCourseStepAsync, SendInfoAboutCourseStepAsync, AskForNotifyStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public SubscriptionDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, IEmailSender emailSender, ISubscriptionManager subscriptionManager, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(SubscriptionDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; _subscriptionManager = subscriptionManager; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ChooseOptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, subscriptionManager, _myLogger, //dialogInfo, //conversationReferences, db )); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { FirstStepAsync, UnsubStepAsync, DeleteSubscriptionStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public AddQuestionDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, IEmailSender emailSender, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(AddQuestionDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; //_DialogInfo = dialogInfo; //_conversationReferences = conversationReferences; _db = db; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new TextPrompt(nameof(TextPrompt))); //AddDialog(new FinishDialog(DecisionMaker, _myLogger, dialogInfo, conversationReferences)); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { AskForQuestionStepAsync, FinalStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public NotificationController(IBotFrameworkHttpAdapter adapter, ICredentialProvider credentials, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db, IEmailSender emailSender, ISubscriptionManager subscriptionManager, IDecisionMaker decisionMaker) { _adapter = adapter; //_conversationReferences = conversationReferences; _appId = ((SimpleCredentialProvider)credentials).AppId; _db = db; _emailSender = emailSender; _decisionMaker = decisionMaker; _subscriptionManager = subscriptionManager; // If the channel is the Emulator, and authentication is not in use, // the AppId will be null. We generate a random AppId for this case only. // This is not required for production, since the AppId will have a value. if (string.IsNullOrEmpty(_appId)) { _appId = Guid.NewGuid().ToString(); //if no AppId, use a random Guid } // _appId = "123"; }
public PlannedEventsDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(PlannedEventsDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; //_DialogInfo = dialogInfo; //_conversationReferences = conversationReferences; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { AskSelectEventStepAsync, FinalStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public LocationDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, IEmailSender emailSender, StuddyBotContext db) : base(nameof(LocationDialog))//, dialogInfoStateProperty) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; //_DialogInfo = dialogInfo; //_conversationReferences = conversationReferences; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new MainMenuDialog(dialogInfoStateProperty, DecisionMaker, SubscriptionManager, _myLogger, //_DialogInfo, //_conversationReferences, db, emailSender)); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { GetCountryStepAsync, GetCityStepAsync, CallMenuDialogStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public FinishDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, IEmailSender emailSender, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(FinishDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; //_DialogInfo = dialogInfo; //_conversationReferences = conversationReferences; _db = db; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new ChooseOptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, //dialogInfo, //conversationReferences, db )); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { DidWeFinishStepAsync, LeaveFeedbackStepAsync, //testStepAsync, FinalStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public HelpDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, IEmailSender emailSender, StuddyBotContext db) : base(nameof(HelpDialog))//, dialogInfoStateProperty) { _Logger = _myLogger; DecisionMaker = decisionMaker; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new ChooseOptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new MainMenuDialog(dialogInfoStateProperty, DecisionMaker, SubscriptionManager, _myLogger, db, emailSender)); AddDialog(new CoursesDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new PlannedEventsDialog(dialogInfoStateProperty, DecisionMaker, _myLogger, db )); AddDialog(new QAsDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new SubscriptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new MailingDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new FinishDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { ShowHelpAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public MainMenuDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, ISubscriptionManager SubscriptionManager, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db, IEmailSender emailSender) : base(nameof(MainMenuDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new CoursesDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new ChooseOptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new PlannedEventsDialog(dialogInfoStateProperty, DecisionMaker, _myLogger, db )); AddDialog(new QAsDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new SubscriptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new MailingDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new FinishDialog(dialogInfoStateProperty, DecisionMaker, emailSender, SubscriptionManager, _myLogger, db )); AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { GetMenuItemsStepAsync, StartSelectedDialogStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public EmailDialog(IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IDecisionMaker decisionMaker, ISubscriptionManager subscriptionManager, IEmailSender emailSender, ThreadedLogger _myLogger, //DialogInfo dialogInfo, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) : base(nameof(EmailDialog)) { this._myLogger = _myLogger; DecisionMaker = decisionMaker; _subscriptionManager = subscriptionManager; EmailSender = emailSender; //_DialogInfo = dialogInfo; _db = db; _dialogInfoStateProperty = dialogInfoStateProperty; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new TextPrompt("email", EmailFormValidator)); AddDialog(new ChoicePrompt("validation", CodeValidator)); AddDialog(new SubscriptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, subscriptionManager, _myLogger, //dialogInfo, //conversationReferences, db )); AddDialog(new ChooseOptionDialog(dialogInfoStateProperty, DecisionMaker, emailSender, subscriptionManager, _myLogger, //dialogInfo, //conversationReferences, db )); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { FirstStepAsync, ChoiceStepAsync, PreFinalStepAsync, FinalStepAsync })); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
/// <summary> /// Gets courses in selected city from the json file. /// </summary> /// <returns></returns> public List <Course> GetCourses(string lang) { var json = Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(System.IO.File.ReadAllText(_pathSettings.PathCourses))); var rss = JArray.Parse(json); var courses = new List <Course>(); // Taking array of all tokens. var tokens = rss.Children(); // Searching in array token with given topic foreach (var item in tokens) { if (item["lang"].ToObject <string>() == lang) { var items = item["courses"]; courses = items.ToObject <List <Course> >(); } } // ToDo check this !!!!! // Insert into db studdyBotContext = new StuddyBotContext(); if (!studdyBotContext.Courses.Any()) { var coursesDB = new List <Course>(); foreach (var item in tokens) { if (item["lang"].ToObject <string>().ToLower() == "en-us") { var items = item["courses"]; coursesDB = items.ToObject <List <Course> >(); } } studdyBotContext.PushCoursesToDB(coursesDB); studdyBotContext.SaveChanges(); } return(courses); }
/// <summary> /// Initializes a new instance of the <see cref="DecisionMaker"/> class. /// </summary> public DecisionMaker(IOptions <PathSettings> pathSettings, IOptions <PathSettingsLocal> localPathSettings, StuddyBotContext studdyBotContext) { this.studdyBotContext = studdyBotContext; var lPathSettings = localPathSettings.Value; var tmpPathSettings = pathSettings.Value; var props = tmpPathSettings.GetType().GetProperties(); if (lPathSettings.IsLocalStart) { foreach (PropertyInfo prop in props) { //var oldPropValue = prop.GetValue(tmpPathSettings) ??null; //if (oldPropValue!=null) //{ //var newPropValue = oldPropValue.ToString().Insert(2, lPathSettings.RootForLocalStart); //prop.GetValue(tmpPathSettings).ToString().Insert(2, lPathSettings.RootForLocalStart); prop.SetValue(tmpPathSettings, prop.GetValue(tmpPathSettings).ToString() .Insert(2, lPathSettings.RootForLocalStart)); //} } } else { foreach (PropertyInfo prop in props) { prop.SetValue(tmpPathSettings, prop.GetValue(tmpPathSettings).ToString() .Insert(2, lPathSettings.RootForRemoteStart)); } } _pathSettings = tmpPathSettings; //_pathSettings = pathSettings.Value; DialogsMUI = new Dictionary <string, DialogsMUI>(); LoadDialogsMUI(); }
public QuestionsController(StuddyBotContext context) { _context = context; }
public GetCoursesHelper(StuddyBotContext dbContext) { _db = dbContext; }
public UnitOfWork(StuddyBotContext studdyBotContext) { db = studdyBotContext; }
public DialogRepository(StuddyBotContext context) { db = context; }
public SubscriptionManager(StuddyBotContext db) { _db = db; }
public FeedbacksController(StuddyBotContext context) { _context = context; }
public CoursesController(StuddyBotContext db, IPathSettings ps) { _db = db; _pathCourses = ps.PathCourses; }
/// <summary> /// conversations with users which subscribed to notifications /// TODO: possible renaming needed /// </summary> //private readonly ConcurrentDictionary<string, ConversationReference> _conversationReferences; public MainDialog(UserState state, IStatePropertyAccessor <DialogInfo> dialogInfoStateProperty, IConfiguration configuration, IDecisionMaker decisionMaker, ISubscriptionManager subscriptionManager, IEmailSender emailSender, ThreadedLogger Logger, //ConcurrentDictionary<string, ConversationReference> conversationReferences, StuddyBotContext db ) // DialogInfo dialogInfo, StuddyBotContext db : base(nameof(MainDialog), dialogInfoStateProperty, Logger) { Configuration = configuration; this._Logger = Logger; DecisionMaker = decisionMaker; EmailSender = emailSender; //_conversationReferences = conversationReferences; _QuestionAndAnswerModel = new QuestionAndAnswerModel(); _QuestionAndAnswerModel.QuestionModel = new QuestionModel(); _QuestionAndAnswerModel.QuestionModel.Questions = new List <Question>(); _QuestionAndAnswerModel.QuestionModel.Decisions = new List <DecisionModel>(); _QuestionAndAnswerModel.Answers = new List <string>(); _DecisionModel = new DecisionModel(); //_DialogInfo = new DialogInfo(); //dialogInfo; _dialogInfoStateProperty = dialogInfoStateProperty; //state.CreateProperty<DialogInfo>(nameof(DialogInfo)); //_DialogInfo = _dialogInfoState.GetAsync(); _db = db; AddDialog(new TextPrompt(nameof(TextPrompt))); AddDialog(new ChoicePrompt(nameof(ChoicePrompt))); AddDialog(new LanguageDialog(_dialogInfoStateProperty, DecisionMaker, subscriptionManager, _Logger, EmailSender, db, Configuration)); AddDialog(new LocationDialog(_dialogInfoStateProperty, DecisionMaker, subscriptionManager, _Logger, EmailSender, db)); AddDialog(new MailingDialog(_dialogInfoStateProperty, DecisionMaker, emailSender, subscriptionManager, _Logger, db)); AddDialog(new EmailDialog(_dialogInfoStateProperty, decisionMaker, subscriptionManager, emailSender, Logger, //_DialogInfo, //conversationReferences, db )); AddDialog(new HelpDialog(_dialogInfoStateProperty, DecisionMaker, subscriptionManager, _Logger, EmailSender, db)); AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[] { StartLanguageDialogAsync })); StartServices(); // The initial child Dialog to run. InitialDialogId = nameof(WaterfallDialog); }
public UserRepository(StuddyBotContext context) { db = context; }