private Tuple<string, string> GetKeyInfoReturnReport(KeyInfoModel keySelected) { var lastReturnReport = keySelected.keyInfo.ReturnReportKeys .Select(k => k.ReturnReport) .Where(r => r.ReturnReportStatus == ReturnReportStatus.Completed) .OrderByDescending(r => r.ReturnDateUTC) .FirstOrDefault(); if (lastReturnReport != null) { return new Tuple<string, string>(lastReturnReport.ReturnNoCredit.ToString(), keySelected.keyInfo.ReturnReportKeys.Single(k => k.CustomerReturnUniqueId == lastReturnReport.CustomerReturnUniqueId).ReturnReasonCode); } return new Tuple<string, string>(string.Empty, string.Empty); }
/// <summary> /// Gets the Details By SelectedKeyId property /// </summary> /// <param name="keySelected"></param> private void GetKeyDetails(KeyInfoModel keySelected) { if (keySelected != null) { KeysDetailsValueCollection = new Dictionary<string, string>(); KeysDetailsValueCollection.Add(MergedResources.Common_ProductKeyID, keySelected.keyInfo.KeyId.ToString()); KeysDetailsValueCollection.Add(MergedResources.Common_ColumnProductKey, keySelected.keyInfo.ProductKey); KeysDetailsValueCollection.Add(ResourcesOfR6.Common_KeyType1, keySelected.keyInfo.KeyInfoEx.KeyType.ToString()); KeysDetailsValueCollection.Add(MergedResources.Common_LicensablePartNumber, keySelected.keyInfo.LicensablePartNumber); KeysDetailsValueCollection.Add(MergedResources.Common_OEMPartNumber, keySelected.keyInfo.OemPartNumber); KeysDetailsValueCollection.Add(MergedResources.Common_ColumnStatus, keySelected.keyInfo.KeyState.ToString()); KeysDetailsValueCollection.Add(MergedResources.Common_ColumnHardwareHash, keySelected.keyInfo.HardwareHash); KeysDetailsValueCollection.Add(MergedResources.Common_OEMPONumber, keySelected.keyInfo.OemPoNumber); KeysDetailsValueCollection.Add(MergedResources.Common_CallOffReferenceNumber, keySelected.keyInfo.CallOffReferenceNumber); KeysDetailsValueCollection.Add(MergedResources.Common_MSOrderNumber, keySelected.keyInfo.MsOrderNumber); KeysDetailsValueCollection.Add(MergedResources.Common_MSFulfilledDate, keySelected.keyInfo.FulfilledDate.ToString()); KeysDetailsValueCollection.Add(MergedResources.EditOptionalInfo_PcModelSku, keySelected.keyInfo.ZPC_MODEL_SKU); KeysDetailsValueCollection.Add(MergedResources.EditOptionalInfo_OemExtId, keySelected.keyInfo.ZOEM_EXT_ID); KeysDetailsValueCollection.Add(MergedResources.EditOptionalInfo_ManGeo, keySelected.keyInfo.ZMANUF_GEO_LOC); KeysDetailsValueCollection.Add(MergedResources.EditOptionalInfo_ProEligValue, keySelected.keyInfo.ZPGM_ELIG_VALUES); KeysDetailsValueCollection.Add(MergedResources.EditOptionalInfo_ChaRelId, keySelected.keyInfo.ZCHANNEL_REL_ID); KeysDetailsValueCollection.Add(MergedResources.Common_TrackingInfo, keySelected.keyInfo.TrackingInfo); KeysDetailsValueCollection.Add(MergedResources.UserManagement_CreatedDate, keySelected.keyInfo.CreatedDate.ToString()); KeysDetailsValueCollection.Add(ResourcesOfR6.ReturnKeysView_OEMRMANumber, keySelected.keyInfo.ReturnReportKeys.Count > 0 ? keySelected.keyInfo.ReturnReportKeys.Last().ReturnReport.OemRmaNumber : ""); KeysDetailsValueCollection.Add(ResourcesOfR6.ReturnKeysView_OEMRMADate, keySelected.keyInfo.ReturnReportKeys.Count > 0 ? keySelected.keyInfo.ReturnReportKeys.Last().ReturnReport.OemRmaDate.ToString() : ""); var returnKeyResult = GetKeyInfoReturnReport(keySelected); KeysDetailsValueCollection.Add(ResourcesOfRTMv1_4.Common_ColumnWithoutCredit, returnKeyResult.Item1); KeysDetailsValueCollection.Add(ResourcesOfRTMv1_4.Common_ColumnReturnReasonCode, returnKeyResult.Item2); keysDetailsValueCollection.Add(ResourcesOfRTMv1_4.Common_ColumnTags, keySelected.keyInfo.Tags); keysDetailsValueCollection.Add(ResourcesOfRTMv1_4.Common_ColumnDescription, keySelected.keyInfo.Description); } }