public List <ApiDashboard> GetDashboards(ApiUser user, List <ApiFilter> filters) { DashboardMapper.Update(user); var dashboards = DashboardMapper.ConvertToApiEntitiesCollection(DashboardAdapter.GetAll($"user_id={user.Id}")).ToList(); var filter = ""; foreach (var dashboard in dashboards) { filter += $"dashboard_id={dashboard.Id} OR "; } if (filter.Length > 4) { filter = filter.Substring(0, filter.Length - 4); } DashboardFilterMapper.Update(filters, dashboards); var tmp = DashboardFilterRelationAdapter.GetAll(filter).GroupBy(t => t.DashboardId); foreach (var group in tmp) { dashboards.Where(t => t.Id == group.Key).FirstOrDefault().UpdateRelations(DashboardFilterMapper.ConvertToApiEntitiesCollection(group)); } return(dashboards.OrderBy(o => o.Order).ToList()); }
public ProcessResult <List <DashboardResponse> > Buscar(DashboardRequest filtro) { ProcessResult <List <DashboardResponse> > resultado = new ProcessResult <List <DashboardResponse> >(); try { List <DashboardLogic> lista = LogicRepository.Buscar( filtro.CodigoIdioma, filtro.CodigoIndicador, filtro.TipoDashboard, filtro.Anio, filtro.Fecha, filtro.TipoPeriodicidad, filtro.CodigoSubTipoPeriodicidad); resultado.Result = new List <DashboardResponse>(); foreach (DashboardLogic item in lista) { DashboardResponse Response = DashboardAdapter.ObtenerListado(item); resultado.Result.Add(Response); } } catch (Exception ex) { resultado.IsSuccess = false; resultado.Exception = new ApplicationLayerException <DashboardService>(ex); } return(resultado); }
public void GetAttemptedQuizCountByUserTest() { var response = new List <StoryTellingForImpactQuizAttempts> { new StoryTellingForImpactQuizAttempts { attemptcount = 1 } }; _curiousQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <CuriousQuizAttempts> >(), It.IsAny <string>())).Returns(1); _growthMindsetQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <GrowthMindsetQuizAttempts> >(), It.IsAny <string>())).Returns(1); _makingTimeForMeQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <MakingTimeForMeQuizAttempts> >(), It.IsAny <string>())).Returns(1); _cultureObservationToolQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <CultureObservationToolQuizAttempts> >(), It.IsAny <string>())).Returns(1); _blindSpotQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <BlindSpotQuizAttempts> >(), It.IsAny <string>())).Returns(1); _continuousLearningQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <ContinuousLearningAssessmentQuizAttempts> >(), It.IsAny <string>())).Returns(1); _learningMythsQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <LearningMythsQuizAttempts> >(), It.IsAny <string>())).Returns(1); _productivityZoneQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <ProductivityZoneQuizAttempts> >(), It.IsAny <string>())).Returns(1); _storyTellingForImpactQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <StoryTellingForImpactQuizAttempts> >(), It.IsAny <string>())).Returns(1); _reflectionToolQuizAttempts.Setup(a => a.GetDocumentCount(It.IsAny <FilterDefinition <ReflectionToolQuizAttempt> >(), It.IsAny <string>())).Returns(1); _dashboardAdapter = new DashboardAdapter(_curiousQuizAttempts.Object, _blindSpotQuizAttempts.Object, _continuousLearningQuizAttempts.Object, _cultureObservationToolQuizAttempts.Object, _growthMindsetQuizAttempts.Object, _learningMythsQuizAttempts.Object, _makingTimeForMeQuizAttempts.Object, _productivityZoneQuizAttempts.Object, _reflectionToolQuizAttempts.Object, _storyTellingForImpactQuizAttempts.Object, _settings.Object); var result = _dashboardAdapter.GetAttemptedQuizCountByUser(""); Assert.AreEqual(10, result); }
private void DeleteDashboard(ApiDashboard dashboard) { var tmp = DashboardMapper.ConvertToDALEntity(dashboard); foreach (var relation in tmp.Relations) { DashboardFilterRelationAdapter.Delete(relation.Id); } DashboardAdapter.Delete(tmp.Dashboard.Id); }
private void InsertDashboard(ref ApiDashboard dashboard) { var tmp = DashboardMapper.ConvertToDALEntity(dashboard); var idx = DashboardAdapter.Insert(tmp.Dashboard); dashboard.UpdateId(idx); foreach (var relation in tmp.Relations) { relation.UpdateDashboardId(idx); DashboardFilterRelationAdapter.Insert(relation); } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Dashboard); _dashboardRecylerView = FindViewById <RecyclerView>(Resource.Id.dashboardRecyclerView); _dashboardLayoutManager = new LinearLayoutManager(this); _dashboardRecylerView.SetLayoutManager(_dashboardLayoutManager); _dashboardAdapter = new DashboardAdapter(); await _dashboardAdapter.RetrieveDashboardValues(); _dashboardRecylerView.SetAdapter(_dashboardAdapter); }
public ApiAdapter(IDataBaseManagerFactory dbEngine, string address, string port, string table, string login, string password) { DbManager = new DatabaseManager(dbEngine, address, port, table, login, password); DbConnector = new DbConnector(DbManager); LanguageAdapter = new LanguageAdapter(DbConnector); UserAdapter = new UserAdapter(DbConnector); UserDetailsAdapter = new UserDetailsAdapter(DbConnector); TransactionTypeAdapter = new TransactionTypeAdapter(DbConnector); TransferTypeAdapter = new TransferTypeAdapter(DbConnector); FrequencyAdapter = new FrequencyAdapter(DbConnector); ImportanceAdapter = new ImportanceAdapter(DbConnector); TagAdapter = new TagAdapter(DbConnector); OperationAdapter = new OperationAdapter(DbConnector); OperationDetailsAdapter = new OperationDetailsAdapter(DbConnector); OperationTagRelationAdapter = new OperationTagAdapter(DbConnector); OperationsGroupAdapter = new OperationsGroupAdapter(DbConnector); OperationsGroupRelationAdapter = new OperationsGroupTagAdapter(DbConnector); FilterAdapter = new FilterAdapter(DbConnector); DashboardAdapter = new DashboardAdapter(DbConnector); DashboardFilterRelationAdapter = new DashboardFilterRelationAdapter(DbConnector); BankAdapter = new BankAdapter(DbConnector); SettingsAdapter = new SettingsAdapter(DbConnector); SchematicTypeAdapter = new SchematicTypeAdapter(DbConnector); SchematicAdapter = new SchematicAdapter(DbConnector); LanguageMapper = new LanguageMapper(); UserMapper = new UserMapper(); UserDetailsMapper = new UserDetailsMapper(); TransactionTypeMapper = new TransactionTypeMapper(); TransferTypeMapper = new TransferTypeMapper(); FrequencyMapper = new FrequencyMapper(); ImportanceMapper = new ImportanceMapper(); TagMapper = new TagMapper(); TagRelationMapper = new RelationTagMapper(); OperationMapper = new OperationMapper(); OperationsGroupMapper = new OperationsGroupMapper(); FilterMapper = new FilterMapper(); DashboardMapper = new DashboardMapper(); DashboardFilterMapper = new DashboardFilterMapper(); BankMapper = new BankMapper(); SettingsMapper = new SettingsMapper(); SchematicTypeMapper = new SchematicTypeMapper(); SchematicMapper = new SchematicMapper(); }
public void GetAttemptCountForGrowthMindsetQuizTest() { var response = new List <GrowthMindsetQuizAttempts> { new GrowthMindsetQuizAttempts { answer = true } }; _growthMindsetQuizAttempts.Setup(a => a.GetData(It.IsAny <FilterDefinition <GrowthMindsetQuizAttempts> >(), It.IsAny <string>())).Returns(response); _dashboardAdapter = new DashboardAdapter(_curiousQuizAttempts.Object, _blindSpotQuizAttempts.Object, _continuousLearningQuizAttempts.Object, _cultureObservationToolQuizAttempts.Object, _growthMindsetQuizAttempts.Object, _learningMythsQuizAttempts.Object, _makingTimeForMeQuizAttempts.Object, _productivityZoneQuizAttempts.Object, _reflectionToolQuizAttempts.Object, _storyTellingForImpactQuizAttempts.Object, _settings.Object); var result = _dashboardAdapter.GetAttemptCountForGrowthMindsetQuiz(""); Assert.IsInstanceOf <int>(result); }
public void GetAllContinuousLearningSomewhatCountTest() { var response = new List <ContinuousLearningAssessmentQuizAttempts> { new ContinuousLearningAssessmentQuizAttempts { attemptcount = 1 } }; _continuousLearningQuizAttempts.Setup(a => a.GetData(It.IsAny <FilterDefinition <ContinuousLearningAssessmentQuizAttempts> >(), It.IsAny <string>())).Returns(response); _dashboardAdapter = new DashboardAdapter(_curiousQuizAttempts.Object, _blindSpotQuizAttempts.Object, _continuousLearningQuizAttempts.Object, _cultureObservationToolQuizAttempts.Object, _growthMindsetQuizAttempts.Object, _learningMythsQuizAttempts.Object, _makingTimeForMeQuizAttempts.Object, _productivityZoneQuizAttempts.Object, _reflectionToolQuizAttempts.Object, _storyTellingForImpactQuizAttempts.Object, _settings.Object); var result = _dashboardAdapter.GetContinuousLearningSomewhatCount(); _continuousLearningQuizAttempts.Verify(a => a.GetData(It.IsAny <FilterDefinition <ContinuousLearningAssessmentQuizAttempts> >(), It.IsAny <string>())); }
public void Start() { var siteUrl = Settings.Default.SiteUrl; var portNumber = Settings.Default.PortNumber; var uri = string.Format("http://*:{0}{1}", portNumber, siteUrl); const string url = "http://localhost:11000"; SmartDBEntities.SetConnection(Settings.Default.DBServer, Settings.Default.DBName, Settings.Default.DBUser, Encryption.Decrypt(Settings.Default.DBPassword)); Program.ProcessLog.Write("Database connection string to " + Settings.Default.DBServer + " has successfully been made."); if (SmartDBEntities.IsDBAvailable) Program.ProcessLog.Write("Database connection " + Settings.Default.DBServer + " has successfully been made."); else Program.ProcessLog.Write("Database connection " + Settings.Default.DBServer + " has failed."); StartOptions options = new StartOptions(); options.Urls.Add(string.Format("http://{0}:11000", Environment.MachineName)); options.Urls.Add("http://localhost:11000/"); options.Urls.Add(uri); dashboardAdapter = new DashboardAdapter(Settings.Default.ImageBrokerAddress, $"Dashboard:{Guid.NewGuid()}"); //dashboardAdapter = new DashboardAdapter(Settings.Default.ImageBrokerAddress, // string.Format("Dashboard:{0}", Guid.NewGuid())); dashboardAdapter.Register(); Console.WriteLine(string.Format("Image Broker Configured At: {0}", Settings.Default.ImageBrokerAddress)); Program.ProcessLog.Write("Image broker has been configured to connect to " + Settings.Default.ImageBrokerAddress); Console.WriteLine(string.Format("Trying to connect to Image Broker: {0}", Settings.Default.ImageBrokerAddress)); if (dashboardAdapter.IsConnected) { Console.WriteLine(string.Format("Connected to Image Broker: {0}", Settings.Default.ImageBrokerAddress)); Program.ProcessLog.Write("The image broker is connected"); } else { Console.WriteLine(string.Format("Not connected to image broker")); Program.ProcessLog.Write("The image broker is not connected"); } host = WebApp.Start<Startup>(options); var hubConnection = new HubConnection(url); var hubProxy = hubConnection.CreateHubProxy("MyHub"); hubConnection.Start().ContinueWith(task => { }).Wait(); var timer = new Timer(x => { if (ConnectionMapping.Count <= 1) return; hubProxy.Invoke("Send").Wait(); }, null, 0, 2000); }
public async override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); (this.Activity as MainActivity).SetCustomTitle("Dashboard"); _employeeDictionary = new Dictionary <string, List <Core.Models.Employee> >(); _items = new List <DashboardItem>(); _pbLoadingIndicator.Visibility = ViewStates.Visible; var employees = await _employeeService.GetAllEmployeesAsync(AccessToken); if (employees == null) { ShowErrorDialog(); return; } var firstName = UserProfileSingleton.Instance.GetUserProfile().User.FirstName; var lastName = UserProfileSingleton.Instance.GetUserProfile().User.LastName; _tvFullname.Text = $"Hello {firstName} {lastName}"; var birthdays = await _employeeService.GetBirthdays(employees); var males = await _employeeService.GetEmployeeByGender(employees, "M"); var females = await _employeeService.GetEmployeeByGender(employees, "F"); var frontEnds = await _employeeService.GetEmployeePosition(employees, "Front-end Developer"); var backEnds = await _employeeService.GetEmployeePosition(employees, "Back-end Developer"); var projectManagers = await _employeeService.GetEmployeePosition(employees, "Project Manager"); _employeeDictionary.Add("Employees", employees.ToList()); _employeeDictionary.Add("Birthdays", birthdays.ToList()); _employeeDictionary.Add("Project Managers", projectManagers.ToList()); _employeeDictionary.Add("Front-end Developers", frontEnds.ToList()); _employeeDictionary.Add("Back-end Developers", backEnds.ToList()); _employeeDictionary.Add("Males", males.ToList()); _employeeDictionary.Add("Females", females.ToList()); for (int i = 0; i < _employeeDictionary.Count; i++) { string _key = _employeeDictionary.ElementAt(i).Key; _items.Add(new DashboardItem() { Name = _employeeDictionary.ElementAt(i).Key, Value = _employeeDictionary[_key].Count.ToString() }); } _items.Add(new DashboardItem { Name = "Reviews", Value = UserProfileSingleton.Instance.GetUserProfile().Review.Count.ToString() }); _pbLoadingIndicator.Visibility = ViewStates.Gone; _adapter = new DashboardAdapter(_items); _gridView.Adapter = _adapter; _gridView.ItemClick += GridView_ItemClick; }
public DashboardService(DashboardAdapter dashboardAdapter) { _dashboardAdapter = dashboardAdapter; }