public static int GetUserCourseCompletedPercentage(int courseid, string userid)
{
int percent = 0;
string connstring = ConfigurationManager.ConnectionStrings["umbracodb"].ConnectionString;
SqlConnection conn = new SqlConnection(connstring);
SqlCommand command = new SqlCommand("GetUserCourseCompletedPercent", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@UserEmail", userid);
command.Parameters.AddWithValue("@CourseId", courseid);
SqlParameter returnedvalue = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
returnedvalue.Direction = ParameterDirection.ReturnValue;
command.Parameters.Add(returnedvalue);
conn.Open();
SqlDataReader dr = command.ExecuteReader();
percent = Convert.ToInt16(returnedvalue.Value);
conn.Close();
return percent;
}
No comments:
Post a Comment