private async void Init() { try { DashboardGridView.ShowLoadingPanel(); UnitOfWork unitOfWork = new UnitOfWork(); var documents = unitOfWork.DocumentActionsRepo.Fetch(x => x.RoutedToUsers.Any(m => m.Id == User.UserId) && x.IsSend == true && x.isDone != true, includeProperties: "RoutedToUsers"); this.cboUsers.Properties.DataSource = await unitOfWork.UsersRepo.Fetch(x => x.OfficeId == staticSettings.OfficeId).ToListAsync(); DashboardGridControl.DataSource = await documents.ToListAsync(); this.documentActionsBindingSource.DataSource = await documents.ToListAsync(); this.cboUsers.EditValue = User.UserId; if (!User.UsersInRole("Super Administrator")) { this.DashboardGridView.Columns[0].VisibleIndex = -1; } this.lblTotalCount.Text = $@"Total Count {documents.Count()}"; // this.Detail(await documents.FirstOrDefaultAsync()); DashboardGridView.HideLoadingPanel(); } catch (Exception e) { } }
private async void Init() { try { DashboardGridView.ShowLoadingPanel(); var docs = await httpClient.GetAsync("api/dashboard/GetDocumentActions"); var userscontent = await httpClient.GetAsync("api/dashboard/GetUsers"); var docContent = await docs.Content.ReadAsStringAsync(); var documents = Newtonsoft.Json.JsonConvert.DeserializeObject <List <DocumentActionsVM> >(docContent); this.cboUsers.Properties.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Users> >(await userscontent.Content.ReadAsStringAsync()); this.documentActionsBindingSource.DataSource = documents; //txtSearchKey.Properties.DataSource = await Task.Run(() => // { // var userIds = unitOfWork.UsersRepo.Fetch(x => x.OfficeId == staticSettings.OfficeId) // .Select(x => x.Id); // return unitOfWork.DocumentActionsRepo.Fetch(x => x.RoutedToUsers.Any(m => userIds.Contains(m.Id))).Distinct() // .ToList(); // }); this.documentActionsBindingSource.DataSource = documents; this.cboUsers.EditValue = User.UserId; if (!User.UsersInRole("Super Administrator")) { this.DashboardGridView.Columns[0].VisibleIndex = -1; } this.lblTotalCount.Text = $@"Total Count {documents.Count()}"; this.Detail(documents.FirstOrDefault()); DashboardGridView.HideLoadingPanel(); } catch (Exception e) { } }