//Initialize FlightRecordViewModel Properties public void SetFlightRecordDetailViewModelProperties(int flightRecordId) { //if (!flightRecordId.HasValue) //return; var currentGroup = _httpContext.HttpContext.User.FindFirst(ClaimTypes.GroupSid).Value; FlightRecord flightRecord; FlightData flightData; AircraftType aircraftType; Approval approval; ApprovalDetail approvalDetail; Spanner spanner; flightRecord = _flightSpannersData.GetFlightRecordByFlightRecordId(flightRecordId); flightData = _flightSpannersData.GetFlightDataByFlightDataId(flightRecord.FlightDataId); aircraftType = _flightSpannersData.GetAircraftTypeByAircraftTypeId(flightRecord.AircraftTypeId); if (flightRecord.ApprovalId.HasValue) { approval = _flightSpannersData.GetApprovalByApprovalId(flightRecord.ApprovalId); approvalDetail = _flightSpannersData.GetApprovalDetailByApprovalDetailId(approval.ApprovalDetailId); spanner = _flightSpannersData.GetSpannerByCode(approval.SpannerCode); SpannerCode = spanner.SpannerCode; SpannerName = spanner.SpannerFName + " " + spanner.SpannerM1Name; ApprovalRating = approvalDetail.ApprovalRating; ApprovalCategory = approvalDetail.ApprovalCategory; ApprovalDetailSummary = SpannerName + " ," + SpannerCode + " ," + ApprovalRating + " ," + ApprovalCategory; ApprovalConstant = approvalDetail.ApprovalConstant; } RecordId = flightRecord.FlightRecordId; RecordDate = flightRecord.RecordDate; RecordTime = flightRecord.RecordTime; FlightDate = flightRecord.FlightDate; FlightTime = flightRecord.FlightTime; IsRecordSetteled = flightRecord.IsRecordSettled; IsRecordAutoSelected = flightRecord.IsRecordAutoSelected; AirportOrigin = flightData.AirportOrigin; AirportDestination = flightData.AirportDestination; DefaultSectorTime = flightData.DefaultSectorTime; FlightDataConstant = flightData.FlightDataConstant; IsFlightLocal = flightData.IsFlightLocal; IsFlightCargo = flightData.IsFlightCargo; FlightBonusCard = flightData.FlightBonusCard; FlightInfo = AirportOrigin + "/" + AirportDestination + " ," + DefaultSectorTime + "hrs" + " ," + FlightBonusCard + "Bonus"; AircraftModel = aircraftType.AircraftModel; EngineModel = aircraftType.EngineModel; AircraftTypeSummary = AircraftModel + " ," + EngineModel; AircraftTypeConstant = aircraftType.AircraftTypeConstant; GroupName = currentGroup; FlightCompanyName = flightRecord.FlightCompanyName; OriginTypeName = flightRecord.OriginTypeName; EligibilityTypeName = flightRecord.EligibilityTypeName; DestinationTypeName = flightRecord.DestinationTypeName; }