本文整理汇总了C#中WebApplication1.List.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# List.Concat方法的具体用法?C# List.Concat怎么用?C# List.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebApplication1.List
的用法示例。
在下文中一共展示了List.Concat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fillDegreeInfo
//fills in degree info from server, stores data in global vars
protected void fillDegreeInfo()
{
//clear previous data
ReqIDNumberNeeded = new Dictionary<int, int>();
ReqIDClassesNeeded = new Dictionary<int, List<string>>();
introReqID = new List<int>();
mainReqID = new List<int>();
introNeeded = false;
SqlDataReader rdr;
//queries tbl_opt_req_relationship for all reqIDs for selected degree option
string sql = "SELECT ReqID, IsIntroductory FROM wi.tbl_opt_req_relationship " +
"WHERE OptionID = " + ddlOption.SelectedValue.ToString();
MyConnection.Open();
SqlCommand cmd = new SqlCommand(sql, MyConnection);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int ReqID = Convert.ToInt32(rdr.GetValue(0));
bool isIntro = Convert.ToBoolean(rdr.GetValue(1));
if (isIntro)
{
introNeeded = true;
introReqID.Add(ReqID);
} else
{
mainReqID.Add(ReqID);
}
}
rdr.Close();
MyConnection.Close();
//queries tbl_requirement number of classes needed for each reqID
foreach (int ReqID in introReqID.Concat(mainReqID))
{
sql = "SELECT NumRequired FROM wi.tbl_requirement " +
"WHERE ReqID = @ReqID;";
cmd = new SqlCommand(sql, MyConnection);
cmd.Parameters.Add("@ReqID", System.Data.SqlDbType.VarChar);
cmd.Parameters["@ReqID"].Value = ReqID;
MyConnection.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
ReqIDNumberNeeded[ReqID] = Convert.ToInt32(rdr.GetValue(0));
}
rdr.Close();
MyConnection.Close();
//ensures ReqID entries with an empty list exist in ReqIdClassesNeeded
ReqIDClassesNeeded[ReqID] = new List<string>();
}
//queries tbl_req_course_relationship and loads all classes with same ReqID into Dictionary
foreach (int ReqID in introReqID.Concat(mainReqID))
{
sql = "SELECT CourseNumber FROM wi.tbl_req_course_relationship " +
"WHERE ReqID = @ReqID;";
cmd = new SqlCommand(sql, MyConnection);
cmd.Parameters.Add("@ReqID", System.Data.SqlDbType.VarChar);
cmd.Parameters["@ReqID"].Value = ReqID;
MyConnection.Open();
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
//adds each class for given ReqID
ReqIDClassesNeeded[ReqID].Add(rdr.GetValue(0).ToString());
}
rdr.Close();
MyConnection.Close();
}
MyConnection.Close();
//allows you to make sure classes are actually added
/*
foreach (int ReqID in introReqID.Concat(mainReqID))
{
resultsBox.Items.Add(new ListItem(ReqID.ToString(), "alal"));
foreach(string cl in ReqIDClassesNeeded[ReqID])
{
resultsBox.Items.Add(new ListItem(cl, cl));
}
}
*/
}