private async Task Detail(DocumentActions document) { if (document == null) { return; } UnitOfWork unitOfWork = new UnitOfWork(); ActionTakenGridView.ShowLoadingPanel(); var list = await new UnitOfWork().DocumentActionsRepo.Fetch(x => x.RefId == document.RefId && x.TableName == document.TableName, orderBy: x => x.OrderByDescending(m => m.DateCreated), includeProperties: "RoutedToUsers").ToListAsync(); if (document.TableName == "PurchaseRequests") { var po = await unitOfWork.PurchaseOrdersRepo.GetAsync(x => x.PRId == document.RefId); foreach (var i in po) { foreach (var obr in i.Obligations) { list.AddRange(unitOfWork.DocumentActionsRepo.Get(x => x.RefId == obr.Id && x.TableName == "Obligations")); } } } this.ActionTakenGridControl.DataSource = list; ActionTakenGridView.HideLoadingPanel(); }
private void btnDeleteRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { if (!User.UserInAction("Delete Action Taken")) { return; } if (MessageBox.Show("Do you want to submit this?", "Submit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (ActionTakenGridView.GetFocusedRow() is ActionTakens item) { UnitOfWork unitOfWork = new UnitOfWork(); unitOfWork.ActionTakensRepo.Delete(x => x.Id == item.Id); unitOfWork.Save(); Init(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async void Detail(DocumentActionsVM document) { if (document == null) { return; } ActionTakenGridView.ShowLoadingPanel(); var list = await httpClient.PostAsync("api/dashboard/GetDetails", new FormUrlEncodedContent( new Dictionary <string, string>() { { "RefId", document.RefId?.ToString() }, { "TableName", document.TableName }, })); var _list = await list.Content.ReadAsStringAsync(); ActionTakenGridControl.DataSource = JsonConvert.DeserializeObject <List <DocumentActionsVM> >(_list); ActionTakenGridView.HideLoadingPanel(); }