Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. public async Task<UserLiveScores> GetUserProgressScreenScoresAsync(string userID)
  2.         {
  3.             UserLiveScores result;
  4.             using (var connection = new SqlConnection(_connectionString))
  5.             {
  6.                 await connection.OpenAsync();
  7.  
  8.                 var p = new DynamicParameters();
  9.                 p.Add("@organizerUserId", userID);
  10.  
  11.                 p.Add("@feedbackScore", dbType: DbType.Int32, direction: ParameterDirection.Output);
  12.                 p.Add("@genderSplitScore", dbType: DbType.Int32, direction: ParameterDirection.Output);
  13.  
  14.                 p.Add("@organizationFeedbackScore", dbType: DbType.Int32, direction: ParameterDirection.Output);
  15.                 p.Add("@organizationGenderSplitScore", dbType: DbType.Int32, direction: ParameterDirection.Output);
  16.  
  17.  
  18.                 await connection.ExecuteAsync(GetUserOrganizationScoreSp, p, commandType: CommandType.StoredProcedure);
  19.  
  20.                 result = new UserLiveScores
  21.                 {
  22.                     GenderFitnessScore = (p.Get<int?>("@feedbackScore") ?? 0) + (p.Get<int?>("@genderSplitScore") ?? 0),
  23.                     FeedbackScore = p.Get<int?>("@feedbackScore") ?? 0,
  24.                     GenderSplitScore = p.Get<int?>("@genderSplitScore") ?? 0,
  25.                     OrganizationGenderFitnessScore = p.Get<int>("@organizationFeedbackScore") + p.Get<int>("@organizationGenderSplitScore"),
  26.                     OrganizationFeedbackScore = p.Get<int>("@organizationFeedbackScore"),
  27.                     OrganizationGenderSplitScore = p.Get<int>("@organizationGenderSplitScore")
  28.                 };
  29.  
  30.             }
  31.  
  32.             return result;
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement