本文整理汇总了C#中Course.getCreditValue方法的典型用法代码示例。如果您正苦于以下问题:C# Course.getCreditValue方法的具体用法?C# Course.getCreditValue怎么用?C# Course.getCreditValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course.getCreditValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!(HttpContext.Current.User.Identity.IsAuthenticated))
{
FormsAuthentication.SignOut();
Session.Clear();
Response.Redirect("~/Default");
}
//\ authenticates user
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
//\ gets userName and UserID
String userName = HttpContext.Current.User.Identity.Name;
String userId = Membership.GetUser(userName).ProviderUserKey.ToString();
//\ Create student object
Student student = new Student(userId);
studentName = student.getName(); //\ returns student's name
lblStudentName.Text = studentName; //\ sets student's name to label
completeCourses = student.getTakenCourses(); //\ returns a list of completed courses
remainingCourses = student.getNeededCourses();
completeCourses.Sort();
remainingCourses.Sort();
//\ adds taken courses to listbox
foreach (String s in completeCourses)
{
completeListBox.Items.Add(s);
}
//\ adds taken courses to listbox
foreach (String s in remainingCourses)
{
remainingListBox.Items.Add(s);
}
//\ Calculates % of all courses complete
compCourses = student.getCountComplete();
totalCourses = student.getCountAll();
// System.Diagnostics.Debug.Write("compCount = " + compCourses + " all count = " + totalCourses);
if (totalCourses < 1)
{
myProg = 0;
}
else
{
myProg = (compCourses * 100) / totalCourses; //\ status bar updater
}
//\ sets labels
lblCourseComplete.Text = compCourses.ToString();
lblCourseRemaining.Text = (totalCourses - compCourses).ToString();
int allCredits = 108;
int takenCredits = 0;
foreach(String s in completeCourses)
{
//System.Diagnostics.Debug.Write("course = " + s);
Course course = new Course(s);
takenCredits += course.getCreditValue();
//System.Diagnostics.Debug.Write("takenCredits = " + takenCredits.ToString());
}
lblCreditComplete.Text = takenCredits.ToString();
lblCreditRemaining.Text = (allCredits - takenCredits).ToString();
}
else
{
Response.Redirect("NotLoggedIn.aspx");
Server.Transfer("NotLoggedIn.aspx");
}
}