本文整理汇总了C#中DBFunctions.getcourselist方法的典型用法代码示例。如果您正苦于以下问题:C# DBFunctions.getcourselist方法的具体用法?C# DBFunctions.getcourselist怎么用?C# DBFunctions.getcourselist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBFunctions
的用法示例。
在下文中一共展示了DBFunctions.getcourselist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string pagename = Path.GetFileName(Request.PhysicalPath);
if (Session["admin"] != null)
{
string action = Request.QueryString["action"];
id = int.Parse(Request.QueryString["Datesheetid"]);
if (!IsPostBack)
{
DBFunctions db = new DBFunctions();
if (action == "update")
{
CourseList.DataSource = db.getcourselist();
CourseList.DataValueField = "ID";
CourseList.DataTextField = "Course";
CourseList.DataBind();
// Courses_tbl course = db.getcourses(id);
DateSheet_tbl ds = db.getDateSheet(id);
ExamTypeList.SelectedValue = ds.ExamType;
StartTime.Text = ds.StartTime;
EndTime.Text = ds.EndTime;
}
else
{
}
}
}
else
{
Response.Redirect("Login.aspx?Redirecturl=" + pagename);
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if(Session["userid"]!=null)
{
if (!IsPostBack)
{
DBFunctions db = new DBFunctions();
List<Enroll_Course> cr = db.getcourselist(int.Parse(Session["userid"].ToString()));
List<Courses_tbl> temp = new List<Courses_tbl>();
//foreach (var cf in cr)
//{
// temp = db.getcoursesList(int.Parse(cf.CourseID.ToString()));
//}
DropDownCourses.Items.Add("Select course");
foreach (var cf in cr)
{
int id = int.Parse(cf.CourseID.ToString());
temp = db.getcoursesList(id);
DropDownCourses.DataSource = temp;
DropDownCourses.DataTextField = "Course";
DropDownCourses.DataValueField = "ID";
DropDownCourses.DataBind();
}
}
}
}
示例3: Page_Load
//.........这里部分代码省略.........
literalStart.Text = "";
}
literalTotal.Text = pageEnd.ToString();
literalEnd.Text = pageEnd.ToString();
}
string tmpUrl = string.Empty;
tmpUrl = "AddDateSheet.aspx?" + Request.QueryString.ToString();
if (tmpUrl.Contains("?page"))
{
tmpUrl = tmpUrl.Remove(tmpUrl.IndexOf("?page"));
}
StringBuilder listingString = new StringBuilder();
if (ds != null)
{
loadDateSheet(ds);
}
if (pageEnd > 10)
{
StringBuilder paging = new StringBuilder();
int counterPage = 1;
int totalPages = 1;
totalPages = (pageEnd / 10) + 1;
string urlMain = string.Empty;
urlMain = Request.Url.ToString();
if (urlMain.Contains("?page"))
{
urlMain = urlMain.Remove(urlMain.IndexOf("?page"));
}
for (int i = 1; i <= totalPages; i++)
{
string newPageString = string.Empty;
if (i == 1)
{
newPageString = "<li><a aria-label=\"First\" href=\"" + urlMain + "\" ><<</a></li>";
if (page == i)
{
newPageString += "<li><a style=\"color:#000000;background: #f0f0f0;\" href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
else
{
newPageString += "<li><a href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
}
else if (i == totalPages)
{
if (page == i)
{
newPageString += "<li><a style=\"color:#000000;background: #f0f0f0;\" href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
else
{
newPageString += "<li><a href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
newPageString += "<li><a aria-label=\"Last\" href=\"" + urlMain + "?page=" + totalPages + "\" >>></a></li>";
}
else
{
if (page == i)
{
newPageString += "<li><a style=\"color:#000000;background: #f0f0f0;\" href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
else
{
newPageString += "<li><a href=\"" + urlMain + "?page=" + i + "\" >" + i + "</a></li>";
}
}
counterPage++;
paging.Append(newPageString);
}
literalPaging.Text = paging.ToString();
}
CourseList.DataSource = db.getcourselist();
CourseList.Items.Add("----------");
CourseList.DataTextField = "Course";
CourseList.DataValueField = "ID";
CourseList.DataBind();
}
}
else
{
Response.Redirect("Login.aspx?Redirecturl=" + pagename);
}
}
示例4: btnaddprogramme_Click
protected void btnaddprogramme_Click(object sender, EventArgs e)
{
DBFunctions db = new DBFunctions();
var checkcourse= db.getcourselist().Where(x => x.CourseCode == CourseCode.Text).FirstOrDefault();
if (checkcourse == null)
{
//Program_tbl prgram = new Program_tbl { ProgramName = ProgrammeNametxt.Text, SecondChoice = int.Parse(dropdownSecondChoise.SelectedValue), HasCampus = int.Parse(dropdownCampus.SelectedValue), ApplicationFee = txtApplicationFee.Text, FormNumber = txtFormCh.Text, ProgrameType = dropdownPrograms.SelectedValue, HasJambData = int.Parse(dropdownJamb.SelectedValue), HasBioDataSection = int.Parse(dropdownBioData.SelectedValue), HasPreviousRecord = int.Parse(dropdownPreviousRecord.SelectedValue), HasCBTSchedule = int.Parse(dropdownCbtSchedule.SelectedValue), HasOlevelResult = int.Parse(dropdownOlevel.SelectedValue), Enable = true, DeptID = int.Parse(DropDownDept.SelectedValue), CutoffPoints = Cuttofpointstxt.Text, DateCreated = DateTime.Now.Date, AcceptenceFee = txtAcceptenceFee.Text, FormCh = txtFormCh.Text };
Courses_tbl course = new Courses_tbl { Course = coursename.Text, Fee = Feetxt.Text, Marks = Markstxt.Text, Credit_Hours = int.Parse(CreditHours.Text), CourseCode = CourseCode.Text };
int cid = db.addcourse(course);
foreach (ListItem chck in CheckBoxPrgramlist.Items)
{
if (chck.Selected)
{
ProgrammeCourses_tbl prgcrs = new ProgrammeCourses_tbl { ProgramID = int.Parse(chck.Value), CourseID = cid };
db.addprogrammecourse(prgcrs);
}
}
messagae.Text = "Course Successfully Added";
messagae.Visible = true;
// Response.Redirect("ManageCourses.aspx");
}
else
{
messagae.Text = "Course Code Already Exist";
messagae.Visible = true;
}
}