///<summary> /// Returns a String that represents the current object. ///</summary> public override string ToString() { string retval = string.Empty; retval = string.Format("Position Description ID:{0}, Total Points:{1}, Grade: GS-{2}", PositionDescriptionID.ToString(), TotalPoints.ToString(), Grade.ToString()); return(retval); }
static void Main2() { TotalPoints points = new TotalPoints(); p.Tpoints(); }
public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound) { switch (strPropertyName.ToLower()) { case "flightid": // Int return(FlightId.ToString(strFormat, formatProvider)); case "portalid": // Int return(PortalId.ToString(strFormat, formatProvider)); case "userid": // Int return(UserId.ToString(strFormat, formatProvider)); case "category": // Int return(Category.ToString(strFormat, formatProvider)); case "takeoffdescription": // NVarChar return(PropertyAccess.FormatString(TakeoffDescription, strFormat)); case "takeofftime": // DateTime return(TakeoffTime.ToString(strFormat, formatProvider)); case "takeoffcoords": // NVarChar if (TakeoffCoords == null) { return(""); } ; return(PropertyAccess.FormatString(TakeoffCoords, strFormat)); case "takeofflatitude": // Float return(TakeoffLatitude.ToString(strFormat, formatProvider)); case "takeofflongitude": // Float return(TakeoffLongitude.ToString(strFormat, formatProvider)); case "takeoffaltitude": // Int if (TakeoffAltitude == null) { return(""); } ; return(((int)TakeoffAltitude).ToString(strFormat, formatProvider)); case "landingdescription": // NVarChar if (LandingDescription == null) { return(""); } ; return(PropertyAccess.FormatString(LandingDescription, strFormat)); case "landingtime": // DateTime return(LandingTime.ToString(strFormat, formatProvider)); case "landingcoords": // NVarChar if (LandingCoords == null) { return(""); } ; return(PropertyAccess.FormatString(LandingCoords, strFormat)); case "landinglatitude": // Float return(LandingLatitude.ToString(strFormat, formatProvider)); case "landinglongitude": // Float return(LandingLongitude.ToString(strFormat, formatProvider)); case "landingaltitude": // Int if (LandingAltitude == null) { return(""); } ; return(((int)LandingAltitude).ToString(strFormat, formatProvider)); case "landingbeaconid": // Int if (LandingBeaconId == null) { return(""); } ; return(((int)LandingBeaconId).ToString(strFormat, formatProvider)); case "maxheight": // Int if (MaxHeight == null) { return(""); } ; return(((int)MaxHeight).ToString(strFormat, formatProvider)); case "maxvario": // Float if (MaxVario == null) { return(""); } ; return(((double)MaxVario).ToString(strFormat, formatProvider)); case "maxspeed": // Float if (MaxSpeed == null) { return(""); } ; return(((double)MaxSpeed).ToString(strFormat, formatProvider)); case "averagespeed": // Float if (AverageSpeed == null) { return(""); } ; return(((double)AverageSpeed).ToString(strFormat, formatProvider)); case "durationmins": // Int return(DurationMins.ToString(strFormat, formatProvider)); case "distance": // Int return(Distance.ToString(strFormat, formatProvider)); case "status": // Int return(Status.ToString(strFormat, formatProvider)); case "totalpoints": // Int return(TotalPoints.ToString(strFormat, formatProvider)); case "entrymethod": // Int return(EntryMethod.ToString(strFormat, formatProvider)); case "summary": // NVarChar if (Summary == null) { return(""); } ; return(PropertyAccess.FormatString(Summary, strFormat)); case "validatedbyuserid": // Int if (ValidatedByUserID == null) { return(""); } ; return(((int)ValidatedByUserID).ToString(strFormat, formatProvider)); case "validatedondate": // DateTime if (ValidatedOnDate == null) { return(""); } ; return(((DateTime)ValidatedOnDate).ToString(strFormat, formatProvider)); default: propertyNotFound = true; break; } return(Null.NullString); }
public IActionResult TotalPoints(int courseId) { var testsAndExams = _testsAndExamsRepository.GetTestsAndExamsByCourseId(courseId).ToList(); var allScores = new List <List <Scores> >(); int courseTotal = 0; foreach (var item in testsAndExams) { var scores = _scoresRepository.GetScoreByTestOrExamId(item.Id).ToList(); courseTotal += item.Total; allScores.Add(scores); } var trainees = new List <string>(); foreach (var item in allScores) { foreach (var scoreSet in item) { if (!trainees.Contains(scoreSet.TraineeId)) { trainees.Add(scoreSet.TraineeId); } else { continue; } } } var traineePoints = new List <TotalPoints>(); foreach (var item in trainees) { double total = 0; foreach (var scoreSet in testsAndExams) { var score = _scoresRepository.GetScoreByTestAndExamIdAndTraineeId(scoreSet.Id, item); if (score == null) { total += 0; } else { total += score.Score; } } var average = (total / courseTotal) * 100; var totalTraineePoint = new TotalPoints { TraineeId = item, TotalPoint = Math.Round(average, 2) }; traineePoints.Add(totalTraineePoint); } var model = new TotalPointsViewModel { CourseId = courseId, Points = traineePoints }; return(View(model)); }