public void LogActionAddsRecordToDatabase() { var options = new DbContextOptionsBuilder <ActionDbContext>() .UseInMemoryDatabase(databaseName: "ActionTestDb") .Options; int numberOfActionsBeforeLogging; using (var context = new ActionDbContext(options)) { context.AddRange(ActionMemoryDb.GetTestActions()); context.SaveChanges(); numberOfActionsBeforeLogging = context.Actions.ToList().Count; } int numberOfActionsAfterLogging; using (var context = new ActionDbContext(options)) { ActionRepository actionRepository = new ActionRepository(context); var logger = new DatabaseLogger(actionRepository); logger.LogAction("TestAction", "TestInput", "TestOutput"); numberOfActionsAfterLogging = actionRepository.GetActions().Count; } Assert.Equal(numberOfActionsBeforeLogging + 1, numberOfActionsAfterLogging); }
private void RefreshUSDConfigurationDataTree() { WorkAsync(new WorkAsyncInfo { Message = "Retrieving USD Configuration...", Work = (w, e) => { Helpers.GlobalProperties.WebApplicationUrl = ConnectionDetail.WebApplicationUrl; usdConfigData = new USDConfigurationData(); w.ReportProgress(0, "Retrieving Hosted Controls"); usdConfigData.HostedControls = HostedControlRepository.GetHostedControls(Service); w.ReportProgress(0, "Retrieving Events"); usdConfigData.Events = EventRepository.GetEvents(Service); w.ReportProgress(0, "Retrieving Actions"); usdConfigData.Actions = ActionRepository.GetActions(Service); w.ReportProgress(0, "Retrieving Event-Action Connections"); usdConfigData.EventActionConnections = EventActionConnectionRepository.GetEventActionConnections(Service); w.ReportProgress(0, "Retrieving Action-SubAction Connections"); usdConfigData.ActionSubActionConnections = ActionSubActionRepository.GetActionSubActionConnections(Service); w.ReportProgress(0, "Drawing Tree"); DrawTreeView(usdConfigData); tabControl1.Invoke((MethodInvoker) delegate { tabControl1.Enabled = true; }); e.Result = "Done"; }, ProgressChanged = e => { SetWorkingMessage(e.UserState.ToString()); }, PostWorkCallBack = e => { //MessageBox.Show($"You are { e.Result}"); }, AsyncArgument = null, IsCancelable = true, MessageWidth = 340, MessageHeight = 150 }); }
public static void Main(string[] args) { try { IOrganizationService Service = CreateIOrganizationService(@"*****@*****.**", @"-HXIAA#S0a#k!m\P", @"https://bdlabx-lmes-25-dev.api.crm4.dynamics.com/XRMServices/2011/Organization.svc"); var usdConfigData = new USDConfigurationData(); usdConfigData.HostedControls = HostedControlRepository.GetHostedControls(Service); usdConfigData.Events = EventRepository.GetEvents(Service); usdConfigData.Actions = ActionRepository.GetActions(Service); usdConfigData.EventActionConnections = EventActionConnectionRepository.GetEventActionConnections(Service); usdConfigData.ActionSubActionConnections = ActionSubActionRepository.GetActionSubActionConnections(Service); var usdTree = USDTree.GenerateUSDTree(usdConfigData); PrintUSDTree(usdTree); Console.ReadKey(); } catch (Exception ex) { string message = ex.Message; throw; } }
public USDConfiguration GetUSDConfiguration(CrmServiceClient crmService, string configurationName) { CRMEntity configurationCE = _configurationRepository.GetConfigurationEntity(crmService, configurationName); if (configurationCE == null) { return(null); } AddToCollection(configurationCE); EntityReference configurationER = configurationCE.CRMRecords[0].ToEntityReference(); CRMEntity hostedControlsCE = _hostedControlRepository.GetHostedControls(crmService, configurationER); AddToCollection(hostedControlsCE); CRMEntity entityTypesCE = _entityTypeRepository.GetEntityTypes(crmService); AddToCollection(entityTypesCE); CRMEntity eventsCE = _eventrepository.GetEvents(crmService, configurationER); AddToCollection(eventsCE); CRMEntity scriptletsCE = _scriptletRepository.GetScriptlets(crmService, configurationER); AddToCollection(scriptletsCE); CRMEntity entitySearchesCE = _entitySearchRepository.GetEntitySearches(crmService, configurationER); AddToCollection(entitySearchesCE); CRMEntity sessionLinesCE = _sessionLineRepository.GetSessionLines(crmService, configurationER); AddToCollection(sessionLinesCE); CRMEntity optionCE = _optionRepository.GetOptions(crmService, configurationER); AddToCollection(optionCE); CRMEntity actionCE = _actionRepository.GetActions(crmService, configurationER); AddToCollection(actionCE); CRMEntity actionCallCE = _actionCallrepository.GetActionCalls(crmService, configurationER); AddToCollection(actionCallCE); CRMEntity subActionCallsCE = _subActionCallsRepository.GetSubActionCalls(crmService, actionCallCE); AddToCollection(subActionCallsCE); CRMEntity eventActionCallsCE = _eventActionCallRepository.GetEventActionCalls(crmService, eventsCE, actionCallCE); AddToCollection(eventActionCallsCE); CRMEntity toolbarsCE = _toolbarRepository.GetToolbars(crmService, configurationER); AddToCollection(toolbarsCE); CRMEntity toolbarButtonsCE = _toolbarButtonRepository.GetToolbarButtons(crmService, configurationER); AddToCollection(toolbarButtonsCE); CRMEntity toolbarButtonActionCallsCE = _toolbarButtonActionCallRepository.GetToolbarButtonActionCalls(crmService, toolbarButtonsCE, actionCallCE); AddToCollection(toolbarButtonActionCallsCE); CRMEntity toolbarHostedControlsCE = _toolbarHostedControlRepository.GetToolbarHostedControls(crmService, toolbarsCE, hostedControlsCE); AddToCollection(toolbarHostedControlsCE); CRMEntity windowNavigationRulesCE = _wnrRepository.GetWindowNavigationRules(crmService, configurationER); AddToCollection(windowNavigationRulesCE); CRMEntity navigationRulesActionCallsCE = _wnrActionCallrepository.GetWNRActionCalls(crmService, windowNavigationRulesCE, actionCallCE); AddToCollection(navigationRulesActionCallsCE); CRMEntity agentScriptTasksCE = _agentScriptTaskRepository.GetAgentScriptTasks(crmService, configurationER); AddToCollection(agentScriptTasksCE); CRMEntity taskActionCallsCE = _taskActionCallRepository.GetTaskActionCalls(crmService, agentScriptTasksCE, actionCallCE); AddToCollection(taskActionCallsCE); CRMEntity taskAnswersCE = _taskAnswerRepository.GetTaskAnswers(crmService, agentScriptTasksCE); AddToCollection(taskAnswersCE); CRMEntity agentScriptAnswersCE = _agentScriptAnswerRepository.GetAgentScriptAnswers(crmService, taskAnswersCE); AddToCollection(agentScriptAnswersCE); CRMEntity answerActionCallsCE = _answerActionCallRepository.GetAnswerActionCalls(crmService, agentScriptAnswersCE, actionCallCE); AddToCollection(answerActionCallsCE); USDConfiguration usdConfiguration = new USDConfiguration { CRMEntities = _crmEntities, Name = configurationName }; return(usdConfiguration); }