public void LoadWorkOrderDetails(int row) { if (WorkOrderGrid.GetRow(row) is WorkOrders item) { cboEmployeeId.EditValue = item.Employees?.Id; txtPosition.Text = item.Employees?.Position; txtOffice.Text = item.Employees?.Offices?.OfficeName; txtPropNo.EditValue = item.PPEs?.PropertyNo; dtRequestedDate.EditValue = item.RequestedDate; cboEquipmentType.EditValue = item.PPEs?.EquipmentTypeId; txtDescription.Text = item.PPEs?.Description; lblPODescription.Text = item.WorkOrderId + " - " + item.PPEs?.PPEId + " - " + item.PPEs?.EquipmentTypes?.EquipmentType; txtFindings.Text = item.Findings; txtProblems.Text = item.Problem; txtRecommendation.Text = item.Recommendation; lblBox.Text = item.Box?.ToString(); this.WOId = item.Id; this.WorkOrders = item; lblFolderNo.Text = item.FolderNo; txtDeliveredDescription.Text = item.DeliveredDescription; cboDeliveredBy.EditValue = item.DeliveredBy; this.DocumentBindingSource.DataSource = new UnitOfWork().DocumentsRepo.Get(m => m.RefId == item.Id && m.TableName == "WorkOrders"); backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += (a, b) => { this.Invoke(new Action(() => { LoadActions(); LoadTechEvalSheet(); })); }; backgroundWorker.RunWorkerAsync(); } }
private void WorkOrderGrid_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.Name == "WorkOrderId") { if (WorkOrderGrid.GetRow(e.RowHandle) is WorkOrders item) { // if (item.WOActions.OrderByDescending(m => m.Id)?.FirstOrDefault()?.Status == "") var status = item.DocActions.OrderByDescending(m => m.Id)?.FirstOrDefault()?.Status; var customValue = new UnitOfWork().StatusesRepo.Find(m => m.Value == status && m.TableName == "Status")?.CustomValue; var color = System.Drawing.ColorTranslator.FromHtml(customValue); e.Appearance.BackColor = color; } } }