public static async Task <ZeroActivityDetailModel> FetchZeroActivityDetailAsync(int period) { var prefix = await RedisHelper.GetZeroActivityCacheKeyPrefix(GlobalConstant.ZeroActivityDetail); Logger.Info($"3缓存key前缀为{prefix}"); ZeroActivityDetailModel zeroActivity; ZeroActivityDetailModel zeroActivityResult = new ZeroActivityDetailModel(); using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var result = await client.GetOrSetAsync(prefix + period.ToString() + "/", () => DalZeroActivity.FetchZeroActivityDetailAsync(period), GlobalConstant.ZeroActivityDetailExpiration); Logger.Info($"3redis{result.RealKey};{result.Value?.PID}ProductName:{result.Value?.ProductName}"); if (result.Success) { zeroActivity = result.Value; } else { if (!result.Success) { Logger.Warn($"3缓存redis失败ZeroActivityDetail:{GlobalConstant.ZeroActivityDetail + period.ToString() + "/"};Error:{result.Message}", result.Exception); } zeroActivity = await DalZeroActivity.FetchZeroActivityDetailAsync(period); Logger.Info($"3数据库查询结果{zeroActivity?.PID}"); } if (zeroActivity != null) { var product = await FetchProductInfoOnPid(period, zeroActivity.PID); Logger.Info($"3产品详情具体为{product?.ProductId};{product?.DisplayName}"); if (product == null) { Logger.Warn($"PID为{zeroActivity.PID}的产品详情失败"); } var numOfApplies = await FetchNumOfAppliesOnPeriod(zeroActivity.Period); Logger.Info($"3第{zeroActivity.Period}期活动的申请次数是{numOfApplies}"); zeroActivityResult = new ZeroActivityDetailModel { Period = zeroActivity.Period, ProductName = product?.DisplayName, NumOfApplications = numOfApplies, NumOfWinners = zeroActivity.NumOfWinners, SingleValue = (product == null) ? 0 : (zeroActivity.Quantity / zeroActivity.NumOfWinners) * product.Price, StartDateTime = zeroActivity.StartDateTime, EndDateTime = zeroActivity.EndDateTime, StatusOfActivity = (DateTime.Now < zeroActivity.StartDateTime) ? 0 : ((DateTime.Now < zeroActivity.EndDateTime) ? 1 : ((DateTime.Now < zeroActivity.EndDateTime.AddDays(30)) ? 3 : 4)), Description = zeroActivity.Description, ImgUrl = zeroActivity.ImgUrl, PID = zeroActivity.PID, Quantity = zeroActivity.Quantity, ProductImages = product?.ImageUrls }; } Logger.Info($"3周期是{zeroActivityResult.Period.ToString()};获奖者人数是{zeroActivityResult.NumOfWinners.ToString()};申请次数是{zeroActivityResult.NumOfApplications.ToString()};产品PID是{zeroActivityResult.PID};产品名称是{zeroActivityResult.ProductName}"); return(zeroActivityResult); } }
private static async Task <int> FetchNumOfAppliesOnPeriod(int period, bool resetCache) { using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var key = ZeroActivityPeriodKey + "/" + period; if (resetCache) { var val = await DalZeroActivity.FetchNumOfApplicationsAsync(period); var setResult = await client.SetAsync(key, val, TimeSpan.FromMinutes(30)); if (!setResult.Success) { Logger.Error($"设置redis缓存({key})失败;Error:{setResult.Message}", setResult.Exception); } return(setResult.Value); } else { var getResult = await client.GetOrSetAsync(key, async() => await DalZeroActivity.FetchNumOfApplicationsAsync(period), TimeSpan.FromMinutes(30)); if (!getResult.Success) { Logger.Error($"获取redis缓存({key})失败;Error:{getResult.Message}", getResult.Exception); } return(getResult.Value); } } }
private static async Task <IEnumerable <ZeroActivityModel> > GetAllZeroActivityList(bool resetCache = false) { using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { if (resetCache) { var list = await DalZeroActivity.SelectUnfinishedZeroActivitiesForHomepageAsync(); var allZeroActivityList = list as ZeroActivityModel[] ?? list.ToArray(); var setResult = await client.SetAsync(ZeroActivityListKey, allZeroActivityList, TimeSpan.FromDays(1)); if (!setResult.Success) { Logger.Error($"设置redis缓存({ZeroActivityListKey})失败;Error:{setResult.Message}", setResult.Exception); } return(setResult.Value); } else { var getResult = await client.GetOrSetAsync(ZeroActivityListKey, async() => await DalZeroActivity.SelectUnfinishedZeroActivitiesForHomepageAsync() ?? new List <ZeroActivityModel>(), TimeSpan.FromDays(1)); if (!getResult.Success) { Logger.Error($"获取redis缓存({ZeroActivityListKey})失败;Error:{getResult.Message}", getResult.Exception); } return(getResult.Value); } } }
public static Tuple <bool, string> CreateProductComment(Guid userId, int orderId, int pkid, string title, string content, string imgStr) { var result = false; var msg = string.Empty; try { if (pkid > 0) { var info = DalZeroActivity.SelectZeroActivityDetail(pkid); if (info != null && info.UserID == userId && info.OrderId == orderId) { var orderList = OrderService.FetchOrderAndListByOrderId(orderId); var getResult = CommentService.CreateProductComment(new CreateProductCommentRequest() { ProductFamilyId = info.PID.Split('|').FirstOrDefault(), ProductId = info.PID, CommentImages = imgStr.TrimStart(';'), CommentContent = content, CommentType = 3, OrderListId = orderList?.OrderListModel?.FirstOrDefault()?.OrderListId ?? 0, OrderId = info.OrderId, CommentR1 = 5, CommentR2 = 5, CommentR3 = 5, CommentR4 = 5, CommentR5 = 5, CommentStatus = 1, UserName = info.UserName, UserId = userId, SingleTitle = title }); result = getResult.IsSuccess; msg = getResult.ErrorMessage; } else { msg = "信息异常"; } } } catch (Exception ex) { msg = "系统异常"; logger.Error(ex); } return(Tuple.Create(result, msg)); }
private static async Task <int> FetchNumOfAppliesOnPeriod(int period) { using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var numOfAppliesResult = await client.GetOrSetAsync(GlobalConstant.NumOfApplications + period + "/", () => DalZeroActivity.FetchNumOfApplicationsAsync(period), GlobalConstant.NumOfApplicationsExpiration); if (numOfAppliesResult.Success) { return(numOfAppliesResult.Value); } else { Logger.Warn($"缓存redis失败NumOfApplications:{GlobalConstant.NumOfApplications + period + "/"};Error:{numOfAppliesResult.Message}", numOfAppliesResult.Exception); return(await DalZeroActivity.FetchNumOfApplicationsAsync(period)); } } }
public static async Task <int> SubmitZeroActivityReminderAsync(Guid userId, int period) { var startTime = await DalZeroActivity.FetchStartTimeOfZeroActivityAsync(period); DateTime startDateTime; if (!DateTime.TryParse(startTime, out startDateTime)) { return(-2); } else if (DateTime.Now >= startDateTime) { return(-3); } if (await DalZeroActivity.HasZeroActivityReminderSubmittedAsync(userId, period)) { return(-1); } return(await DalZeroActivity.SubmitZeroActivityReminderAsync(userId, period)); }
public static async Task <IEnumerable <MyZeroActivityApplications> > SelectMyApplicationsAsync(Guid userId, int applicationStatus) { using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var userApplies = await client.GetOrSetAsync(GlobalConstant.MyZeroApplyApplications + userId.ToString("B") + "/" + applicationStatus + "/", () => DalZeroActivity.SelectMyApplicationsAsync(userId, applicationStatus), GlobalConstant.MyZeroApplyApplicationsExpiration); if (userApplies.Success && userApplies.Value != null) { return(await HandleMyApplicationInfo(userApplies.Value)); } else { if (!userApplies.Success) { Logger.Warn($"获取用户众测申请列表缓存redis失败MyZeroApplyApplications:{GlobalConstant.MyZeroApplyApplications + userId.ToString("B") + "/" + applicationStatus + "/"};Error:{userApplies.Message}", userApplies.Exception); } return(await HandleMyApplicationInfo(await DalZeroActivity.SelectMyApplicationsAsync(userId, applicationStatus))); } } }
private static async Task <IEnumerable <SelectedTestReport> > HandleUserReports(int period) { var testReports = (await DalZeroActivity.SelectChosenUserReportsAsync(period)).ToList(); if (testReports != null && testReports.Any()) { IEnumerable <User> users = new List <User>(); using (var uClient = new UserAccountClient()) { var result = await uClient.GetUsersByIdsAsync(testReports.Select(tr => tr.UserId).Distinct().ToList()); if (result.Success && result.Result != null && result.Result.Any()) { users = result.Result; } } if (users.Any()) { foreach (var tr in testReports) { var singleUser = users.FirstOrDefault(ur => Equals(ur.UserId, tr.UserId)); if (singleUser?.Profile != null) { if (!string.IsNullOrWhiteSpace(singleUser.Profile.HeadUrl)) { tr.HeadImage = ImageHelper.GetImageUrl(singleUser.Profile.HeadUrl); } tr.UserName = string.IsNullOrWhiteSpace(singleUser.Profile.UserName) ? singleUser.Profile.NickName : singleUser.Profile.UserName; tr.Gender = Convert.ToInt32(singleUser.Profile.Gender); } } } return(testReports); } return(new List <SelectedTestReport>()); }
public static int ZAConfigureDelete(int period) { return(DalZeroActivity.ZAConfigureDelete(period)); }
/// <summary> /// 0元购活动配置 /// </summary> /// <param name="Zadetail"></param> /// <returns></returns> public static int ZAConfigureAct(ZeroActivityDetail Zadetail) { return(DalZeroActivity.ZAConfigureAct(Zadetail)); }
/// <summary> /// 0元购活动申请详情 以及筛选 /// </summary> /// <param name="Period"></param> /// <param name="OrderQuantity"></param> /// <param name="Succeed"></param> /// <param name="ReportStatus"></param> /// <returns></returns> public static List <ZeroActivityApply> ZeroConditionFilter(ZeroActivityApply filtermodel, int CurrentPage, int PageSize, out int TotalCount) { return(DalZeroActivity.ZeroConditionFilter(filtermodel, CurrentPage, PageSize, out TotalCount)); }
/// <summary> /// 0元购活动申请 成功获得轮胎的处理 /// </summary> /// <param name="Period"></param> /// <param name="UserID"></param> /// <param name="UserMobileNumber"></param> /// <param name="OrderID"></param> /// <returns></returns> public static int ZeroAward(int Period, string UserID, string UserMobileNumber, int OrderID) { return(DalZeroActivity.ZeroAward(Period, UserID, UserMobileNumber, OrderID)); }
/// <summary> /// 审核通过试用报告 /// </summary> /// <param name="OrderID"></param> /// <param name="UserID"></param> /// <returns></returns> public static int UpdateZAAStatus(int OrderID, string UserID) { return(DalZeroActivity.UpdateZAAStatus(OrderID, UserID)); }
/// <summary> /// 选取所有的已申请0元购的详情 /// </summary> /// <returns></returns> public static List <ZeroActivityApply> SelectAllZeroActivity() { return(DalZeroActivity.SelectAllZeroActivityApply()); }
/// <summary> /// 查询0元购活动详情 /// </summary> /// <returns></returns> public static List <ZeroActivityDetail> SelectZeroActivityDetail() { return(DalZeroActivity.SelectZeroActivityDetail()); }
public static async Task <IEnumerable <ZeroActivityModel> > SelectFinishedZeroActivitiesForHomepageAsync(int pageNumber) { IEnumerable <ZeroActivityModel> zeroActivities; IList <ZeroActivityModel> zeroActivityResult = new List <ZeroActivityModel>(); var prefix = await RedisHelper.GetZeroActivityCacheKeyPrefix(GlobalConstant.FinishedZeroActivitiesForHomepage); Logger.Info($"2缓存key前缀为{prefix}"); using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var result = await client.GetOrSetAsync( prefix + pageNumber.ToString() + "/", () => DalZeroActivity.SelectFinishedZeroActivitiesForHomepageAsync(pageNumber), GlobalConstant.ZeroActivitiesForHomepageExpiration); Logger.Info($"2第{pageNumber}页redis{result.RealKey};{string.Join(";", result.Value?.Select(p => p.Period).ToList())};{string.Join(";", result.Value?.Select(p => p.PID).ToList())}ProductName:{string.Join(";", result.Value?.Select(p => p.ProductName).ToList())}"); if (result.Success && result.Value != null) { zeroActivities = result.Value; } else { if (!result.Success) { Logger.Warn($"获取已完成零元购活动列表缓存redis失败FinishedZeroActivitiesForHomepage:{GlobalConstant.FinishedZeroActivitiesForHomepage + pageNumber.ToString() + "/"};Error:{result.Message}", result.Exception); } zeroActivities = await DalZeroActivity.SelectFinishedZeroActivitiesForHomepageAsync(pageNumber); Logger.Info($"获取到的已完成零元购活动列表数据库查询结果{string.Join(";", zeroActivities?.Select(p => p.Period).ToList())};{string.Join(";", zeroActivities?.Select(p => p.PID).ToList())}"); } if (zeroActivities != null && zeroActivities.Any()) { foreach (var zeroActivity in zeroActivities.ToList()) { Logger.Info($"2第{pageNumber}页第{zeroActivity.Period}期活动的关联商品的pid是{zeroActivity.PID}"); } var products = new List <SkuProductDetailModel>(); var productInfoResult = await client.GetOrSetAsync( GlobalConstant.ProductInfoOfFinishedZeroActivities + pageNumber + "/", () => SelectProductInfoByPids(zeroActivities.Select(_ => _.PID).ToList()), GlobalConstant.productInfoExpiration); Logger.Info($"2第{pageNumber}页的产品信息redis{productInfoResult.RealKey};{string.Join(";", productInfoResult.Value?.Select(p => p.ProductId).ToList())};{string.Join(";", productInfoResult?.Value.Select(p => p.DisplayName).ToList())}"); if (productInfoResult.Success && productInfoResult.Value != null) { var needRenew = false; foreach (var zeroActivity in zeroActivities.ToList()) { if (!productInfoResult.Value.Any(_ => _.Pid == zeroActivity.PID)) { Logger.Warn($"2PID为{zeroActivity.PID}的产品详情获取失败获取失败,可能是产品信息出现更变引起的"); needRenew = true; break; } } if (needRenew) { var renewedProductInfoResult = await client.SetAsync(GlobalConstant.ProductInfoOfFinishedZeroActivities, await SelectProductInfoByPids(zeroActivities.Select(_ => _.PID).ToList()), GlobalConstant.productInfoExpiration); if (renewedProductInfoResult.Success && renewedProductInfoResult.Value != null) { products = renewedProductInfoResult.Value; } else { if (!renewedProductInfoResult.Success) { Logger.Warn($"2产品信息缓存redis设置失败ProductInfoOfFinishedZeroActivities:{GlobalConstant.ProductInfoOfFinishedZeroActivities};Error:{renewedProductInfoResult.Message}", renewedProductInfoResult.Exception); } products = await SelectProductInfoByPids(zeroActivities.Select(_ => _.PID).ToList()); } } else { products = productInfoResult.Value; } } else { if (!productInfoResult.Success) { Logger.Warn($"2缓存redis失败ProductInfoOfUnfinishedZeroActivities:{GlobalConstant.ProductInfoOfUnfinishedZeroActivities + pageNumber + "/"};Error:{productInfoResult.Message}", productInfoResult.Exception); } products = await SelectProductInfoByPids(zeroActivities.Select(_ => _.PID).ToList()); } Logger.Info($"2第{pageNumber}页的产品详情{products.Count()}条,应该为{zeroActivities.Count()}条,具体为{string.Join(";", products.Select(p => p.ProductId).ToList())};{string.Join(";", products.Select(p => p.DisplayName).ToList())}"); foreach (var zeroActivity in zeroActivities.ToList()) { var numOfApplies = await FetchNumOfAppliesOnPeriod(zeroActivity.Period); Logger.Info($"2第{pageNumber}页的第{zeroActivity.Period}期活动的申请次数是{numOfApplies}"); var product = products.FirstOrDefault(_ => _.Pid == zeroActivity.PID); if (product == null) { Logger.Warn($"2PID为{zeroActivity.PID}的产品详情失败"); } zeroActivityResult.Add(new ZeroActivityModel { Period = zeroActivity.Period, ProductName = product?.DisplayName, NumOfApplications = numOfApplies, NumOfWinners = zeroActivity.NumOfWinners, SingleValue = (product == null) ? 0 : (zeroActivity.Quantity / zeroActivity.NumOfWinners) * product.Price, StartDateTime = zeroActivity.StartDateTime, EndDateTime = zeroActivity.EndDateTime, StatusOfActivity = (DateTime.Now < zeroActivity.EndDateTime.AddDays(30)) ? 3 : 4, Description = zeroActivity.Description, ImgUrl = zeroActivity.ImgUrl, PID = zeroActivity.PID, Quantity = zeroActivity.Quantity }); } } Logger.Info($"2周期是{string.Join(";", zeroActivityResult.Select(p => p.Period).ToList())};获奖者人数是{string.Join(";", zeroActivityResult.Select(p => p.NumOfWinners).ToList())};申请次数是{string.Join(";", zeroActivityResult.Select(p => p.NumOfApplications).ToList())};产品PID是{string.Join(";", zeroActivityResult.Select(p => p.PID).ToList())};产品名称是{string.Join(";", zeroActivityResult.Select(p => p.ProductName).ToList())}"); return(zeroActivityResult); } }
public static int UpdateStatusByPeriod(int period) { return(DalZeroActivity.UpdateStatusByPeriod(period)); }
public static List <ZeroActivityApply> SelectZeroActivityApplyByPeriod(int period) { return(DalZeroActivity.SelectZeroActivityApplyByPeriod(period)); }
public static async Task <bool> HasZeroActivityReminderSubmittedAsync(Guid userId, int period) { return(await DalZeroActivity.HasZeroActivityReminderSubmittedAsync(userId, period)); }
public static async Task <int> SubmitZeroActivityApplicationAsync(ZeroActivityRequest requestModel) { try { var activityDetail = await FetchZeroActivityDetailAsync(requestModel.Period); if (activityDetail == null) { return(-2); } else if (activityDetail.StatusOfActivity != 1) { return(-3); } else if (activityDetail.PID == null || activityDetail.ProductName == null) { return(-4); } if (await DalZeroActivity.HasZeroActivityApplicationSubmittedAsync(requestModel.UserId, requestModel.Period)) { return(-1); } string userMobile = ""; using (var uClient = new UserAccountClient()) { var result = await uClient.GetUserByIdAsync(requestModel.UserId); if (result.Success && !string.IsNullOrWhiteSpace(result.Result?.MobileNumber) && result.Result.MobileNumber.Length <= 30) { userMobile = result.Result.MobileNumber; } } var count = await DalZeroActivity.SubmitZeroActivityApplicationAsync(requestModel, activityDetail, userMobile); if (count > 0) { var actionQueueDic = new Dictionary <string, string>(); actionQueueDic["UserId"] = requestModel.UserId.ToString("B"); actionQueueDic["ActionName"] = "12PublicTest"; TuhuNotification.SendNotification("notification.TaskActionQueue", actionQueueDic); using (var client = CacheHelper.CreateCacheClient(DefaultClientName)) { var existenceResult = await client.ExistsAsync(GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"); if (existenceResult.Success) { var removeResult = await client.RemoveAsync(GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"); if (!removeResult.Success) { Logger.Warn($"删除用户众测申请列表(申请中)缓存redis失败MyZeroApplyApplications:{GlobalConstant.MyZeroApplyApplications + requestModel.UserId.ToString("B") + "/0/"};Error:{removeResult.Message}", removeResult.Exception); } } } } return(count); } catch (Exception ex) { Logger.ErrorException("SubmitZeroActivityApplication逻辑进行中出现异常", ex); return(0); } }
private static async Task <SelectedTestReportDetail> HandleTestReportDetail(int commentId) { var testReport = await DalZeroActivity.FetchTestReportDetailAsync(commentId); if (testReport != null) { using (var uClient = new UserAccountClient()) { var result = await uClient.GetUserByIdAsync(testReport.UserId); if (result.Success && result.Result?.Profile != null) { if (!string.IsNullOrWhiteSpace(result.Result.Profile.HeadUrl)) { testReport.HeadImage = ImageHelper.GetImageUrl(result.Result.Profile.HeadUrl); } testReport.UserName = string.IsNullOrWhiteSpace(result.Result.Profile.UserName) ? result.Result.Profile.NickName : result.Result.Profile.UserName; testReport.Gender = Convert.ToInt32(result.Result.Profile.Gender); } } var structuredCommentAttrbute = new CommentExtenstionAttribute { CarTypeDes = string.Empty, InstallShop = string.Empty, TestEnvironment = new TestEnvironment { DriveSituation = string.Empty, Humidity = string.Empty, RoadSituation = string.Empty, WeatherSituation = string.Empty, Temperature = string.Empty }, TestUserInfo = new TestUserInfo { Cellphone = string.Empty, DriveDistance = string.Empty, DriveStyle = string.Empty, Name = string.Empty } }; if (testReport.TestReportExtenstionAttribute != null) { structuredCommentAttrbute.CarTypeDes = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.CarTypeDes) ? testReport.TestReportExtenstionAttribute.CarTypeDes : string.Empty; structuredCommentAttrbute.CarID = testReport.TestReportExtenstionAttribute.CarID; structuredCommentAttrbute.InstallShopID = testReport.TestReportExtenstionAttribute.InstallShopID; structuredCommentAttrbute.OrderDatetime = testReport.TestReportExtenstionAttribute.OrderDatetime; structuredCommentAttrbute.InstallShop = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.InstallShop) ? testReport.TestReportExtenstionAttribute.InstallShop : string.Empty; if (testReport.TestReportExtenstionAttribute.TestEnvironment != null) { structuredCommentAttrbute.TestEnvironment.DriveSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.DriveSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.DriveSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.Humidity = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.Humidity) ? testReport.TestReportExtenstionAttribute.TestEnvironment.Humidity : string.Empty; structuredCommentAttrbute.TestEnvironment.RoadSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.RoadSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.RoadSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.WeatherSituation = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.WeatherSituation) ? testReport.TestReportExtenstionAttribute.TestEnvironment.WeatherSituation : string.Empty; structuredCommentAttrbute.TestEnvironment.Temperature = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestEnvironment.Temperature) ? testReport.TestReportExtenstionAttribute.TestEnvironment.Temperature : string.Empty; } if (testReport.TestReportExtenstionAttribute.TestUserInfo != null) { structuredCommentAttrbute.TestUserInfo.Age = testReport.TestReportExtenstionAttribute.TestUserInfo.Age; structuredCommentAttrbute.TestUserInfo.Cellphone = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.Cellphone) ? testReport.TestReportExtenstionAttribute.TestUserInfo.Cellphone : string.Empty; structuredCommentAttrbute.TestUserInfo.DriveAge = testReport.TestReportExtenstionAttribute.TestUserInfo.DriveAge; structuredCommentAttrbute.TestUserInfo.DriveDistance = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.DriveDistance) ? testReport.TestReportExtenstionAttribute.TestUserInfo.DriveDistance : string.Empty; structuredCommentAttrbute.TestUserInfo.DriveStyle = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.DriveStyle) ? testReport.TestReportExtenstionAttribute.TestUserInfo.DriveStyle : string.Empty; structuredCommentAttrbute.TestUserInfo.Gender = testReport.TestReportExtenstionAttribute.TestUserInfo.Gender; structuredCommentAttrbute.TestUserInfo.Name = !string.IsNullOrWhiteSpace(testReport.TestReportExtenstionAttribute.TestUserInfo.Name) ? testReport.TestReportExtenstionAttribute.TestUserInfo.Name : string.Empty; } } testReport.TestReportExtenstionAttribute = structuredCommentAttrbute; return(testReport); } return(new SelectedTestReportDetail()); }