public object GetSelectedItem() { var pms = (PmServiceInfo)pmserviceBindingSource.Current; _selectService = _context.PmServices.FirstOrDefault(ps => ps.PmServiceId == pms.PmServiceId); return(_selectService); }
private void gridControl1_DoubleClick(object sender, EventArgs e) { var pmsinfo = (PmServiceInfo)pmserviceBindingSource.Current; if (pmsinfo != null) { _selectService = _context.PmServices.FirstOrDefault(ps => ps.PmServiceId == pmsinfo.PmServiceId); OpenSelectedItem(); } }
private void gridControl1_Click(object sender, EventArgs e) { var pmsinfo = (PmServiceInfo)pmserviceBindingSource.Current; if (pmsinfo != null) { btnDelete.Enabled = true; _selectService = _context.PmServices.FirstOrDefault(ps => ps.PmServiceId == pmsinfo.PmServiceId); } AuthorizeForm(); }
public void ShowObject(object keyValue) { if (keyValue == null) { _pmService = new PmService(); pmserviceBindingSource.DataSource = _pmService; pmPartsBindingSource.DataSource = _pmService.Parts; _newMode = true; } else { _pmService = _context.PmServices.FirstOrDefault(p => p.PmServiceId == ((PmService)keyValue).PmServiceId); pmserviceBindingSource.DataSource = _pmService; pmPartsBindingSource.DataSource = _pmService.Parts; if (_pmService.RecurringDate != null || _pmService.FixedDate != null) { rgTrackingMode.EditValue = 1; if (_pmService.RecurringDate != null) { RGDateTracking.EditValue = 1; } else { RGDateTracking.EditValue = 2; } } else if (_pmService.RecurringHour != null || _pmService.FixedHour != null) { rgTrackingMode.EditValue = 2; if (_pmService.RecurringHour != null) { RGMileageTracking.EditValue = 1; } else { RGMileageTracking.EditValue = 2; } } _newMode = false; btnDelete.Enabled = true; } LoadLookups(); }