本文整理汇总了C#中Student.getAllCourses方法的典型用法代码示例。如果您正苦于以下问题:C# Student.getAllCourses方法的具体用法?C# Student.getAllCourses怎么用?C# Student.getAllCourses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student.getAllCourses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
//\ gets userName and UserID
String currentUserName = HttpContext.Current.User.Identity.Name;
userId = Membership.GetUser(currentUserName).ProviderUserKey.ToString();
student = new Student(userId);
comment = new Comment(userId);
allCourses = student.getAllCourses();
allCourses.Sort();
foreach(String s in allCourses)
{
courseDropBox.Items.Add(s);
}
//\sets currentcourse to whats selected in dropbox on load
strCurrentCourse = courseDropBox.SelectedValue;
currentCourse = student.getCourseName(strCurrentCourse);
}
else
{
Response.Redirect("NotLoggedIn.aspx");
Server.Transfer("NotLoggedIn.aspx");
}
if (!IsPostBack)
{
BindComment();
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!(HttpContext.Current.User.Identity.IsAuthenticated))
{
FormsAuthentication.SignOut();
Session.Clear();
Response.Redirect("~/Default");
}
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
//\ gets userName and UserID
String userName = HttpContext.Current.User.Identity.Name;
String userId = Membership.GetUser(userName).ProviderUserKey.ToString();
student = new Student(userId);
strTakenList = student.getTakenCourses();
takenList = student.getTakenInt();
strAllList = student.getAllCourses();
allList = student.getCourseName(strAllList);
//\ creates need list and Creates resultbuilder object
needList = student.getNeededInt();
ResultsBuilder rs = new ResultsBuilder(needList, takenList);
//\ finds possible courses and inits possible list
rs.findPossible();
possibleList = rs.getPossible();
rs.findRecommended();
//recIntList = rs.getRecommended();
int[][] recArray = rs.getRecommended();
String currentCourseName;
//\ gets course name for possible courses
SqlConnection conGetName = new SqlConnection(myDatabase);
SqlCommand cmdGetName = new SqlCommand("getCourseName", conGetName);
cmdGetName.CommandType = CommandType.StoredProcedure;
foreach (int c in possibleList)
{
cmdGetName.Parameters.AddWithValue("@courseID", c);
conGetName.Open();
currentCourseName = Convert.ToString(cmdGetName.ExecuteScalar());
formattedList.Add(currentCourseName);
cmdGetName.Parameters.Clear();
conGetName.Close();
}
//\ gets course name for recommended courses
SqlConnection conGetRec = new SqlConnection(myDatabase);
SqlCommand cmdGetRec = new SqlCommand("getCourseName", conGetRec);
cmdGetRec.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < 5; i++)
{
cmdGetRec.Parameters.AddWithValue("@courseID", recArray[i][0]);
conGetRec.Open();
currentCourseName = Convert.ToString(cmdGetRec.ExecuteScalar());
recList[i] = currentCourseName;
cmdGetRec.Parameters.Clear();
conGetRec.Close();
}
rec1.Text = " 1. " + recList[0];
rec2.Text = " 2. " + recList[1];
rec3.Text = " 3. " + recList[2];
rec4.Text = " 4. " + recList[3];
rec5.Text = " 5. " + recList[4];
formattedList.Sort();
foreach (String i in formattedList)
{
allPosListBox.Items.Add(i.ToString());
}
foreach (String i in formattedList)
{
//allPosListBox.Items.Add(i);
}
}
else
{
Response.Redirect("NotLoggedIn.aspx");
Server.Transfer("NotLoggedIn.aspx");
}
}