//加载页面,显示用户的基本信息 protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["usr"] == null) { Response.Redirect("~/Student/Login.aspx"); } //check longin HttpCookie cookie = Request.Cookies["usr"]; StudentInfo student = new StudentInfo(); student.Stu_ID = Convert.ToInt32(cookie.Values["ID"]); student.Stu_Password = cookie.Values["pass"].Trim(); if (!bllStudent.CheckLogin(student)) { Response.Redirect("~/Student/Login.aspx"); } student = bllStudent.Get(student.Stu_ID); Mailbox.Text = bllStudent.Get(Convert.ToInt32(cookie.Values["ID"])).Stu_Email; Mailbox.Attributes["ContentEditable"] = "false"; Image7.ImageUrl = student.Stu_Image; Std_Name.Text = student.Stu_UserName; Std_ID.Text = Convert.ToString(student.Stu_ID); }
//加载页面,验证用户登录信息,显示个人信息 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Cookies["usr"] == null) { Response.Redirect("~/Student/Login.aspx"); } //check longin HttpCookie cookie = Request.Cookies["usr"]; StudentInfo student = new StudentInfo(); student.Stu_ID = Convert.ToInt32(cookie.Values["ID"]); student.Stu_Password = cookie.Values["pass"].Trim(); if (!bllStudent.CheckLogin(student)) { Response.Redirect("~/Student/Login.aspx"); } //set the value of personal information StudentInfo student2 = bllStudent.Get(student.Stu_ID); Name.Text = student2.Stu_UserName; Mailbox.Text = student2.Stu_Email; Telephone.Text = student2.Stu_Tel; Image7.ImageUrl = student2.Stu_Image; Std_Name.Text = student2.Stu_UserName; Std_ID.Text = Convert.ToString(student2.Stu_ID); if (student2.Stu_Sex != null) { Radio.Items.FindByValue(student2.Stu_Sex.Trim()).Selected = true; } } }
protected void Delete_Click(object sender, EventArgs e) { var button = sender as Button; GridViewRow gvr = (GridViewRow)button.Parent.Parent; var lab = (Label)this.StudentList.Rows[gvr.RowIndex].FindControl("AdminID"); int id = Int32.Parse(lab.Text.ToString()); bllStudent.Remove(bllStudent.Get(id)); Bind(); }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["usr"]; if (null != cookie) { try { stdID = Convert.ToInt32(cookie.Values["ID"]); StudentInfo student = stu.Get(stdID); Image7.ImageUrl = student.Stu_Image; Std_Name.Text = student.Stu_UserName; Std_ID.Text = Convert.ToString(student.Stu_ID); getData(); //调用获取绑定数据 } catch { Response.Redirect("~/Student/Login.aspx"); } } else { Response.Redirect("~/Student/Login.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["usr"]; IBLL.IStudent stu = BLLFactory.DataAccess.CreateStudent(); int ID = -1; if (null != cookie) { ID = Convert.ToInt32(cookie.Values["ID"]); } if (ID != -1) { try { Model.StudentInfo stuInfo = stu.Get(ID); HyperLink1.Text = stuInfo.Stu_UserName + "的个人中心"; HyperLink1.NavigateUrl = "~/Purchase/AccountInfo.aspx"; HyperLink2.Text = "退出登录"; } catch { Request.Cookies.Remove("usr"); HyperLink1.NavigateUrl = "~/Student/Login.aspx"; HyperLink1.Text = "点击这里登录"; HyperLink2.Text = "没有账号,注册"; } } else { HyperLink1.NavigateUrl = "~/Student/Login.aspx"; HyperLink1.Text = "点击这里登录"; HyperLink2.Text = "没有账号,注册"; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["usr"]; if (null != cookie) { try { //赋值 stdID = Convert.ToInt32(cookie.Values["ID"]); StudentInfo student = stu.Get(stdID); Image7.ImageUrl = student.Stu_Image; Std_Name.Text = student.Stu_UserName; Std_ID.Text = student.Stu_ID.ToString(); string teaid = Request.QueryString["TeaID"]; TeacherInfo teacher = bllTeacher.Get(Convert.ToInt32(teaid)); ImageT.ImageUrl = teacher.Tea_SImage; LabelID.Text = teacher.Tea_ID.ToString(); LabelName.Text = teacher.Tea_Name; LabelSkill.Text = teacher.Tea_Skill; LabelNation.Text = teacher.Tea_Nation; LabelDes.Text = teacher.Tea_Describe; } catch { //未找到所传学生id Response.Redirect("~/Student/Login.aspx"); } } else //未登录 { Response.Redirect("~/Student/Login.aspx"); } }
//加载页面的时候验证 //此处userName 其实是student.Stu_ID protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { StudentInfo student = new StudentInfo(); if (Request.QueryString["userName"] != null) { student = bllStudent.Get(Convert.ToInt32(Request.QueryString["userName"])); if (Request.QueryString["validateCode"] != null && student.Stu_Validation.Equals(Request.QueryString["validateCode"])) { student.Stu_Validation = "success"; bllStudent.Modify(student); Validate.Text = "验证成功!"; Response.Redirect("~/Student/Login.aspx"); } else { Validate.Text = "验证失败"; } } else { Validate.Text = "ao"; } } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["usr"]; if (null != cookie) { try { //找到所传学生id stdID = Convert.ToInt32(cookie.Values["ID"]); StudentInfo student = stu.Get(stdID); Image7.ImageUrl = student.Stu_Image; Std_Name.Text = student.Stu_UserName; Std_ID.Text = Convert.ToString(student.Stu_ID); GridBind(Convert.ToInt32(stdID)); } catch { //未找到所传学生id Response.Redirect("~/Student/Login.aspx"); } } else //未登录 { Response.Redirect("~/Student/Login.aspx"); } }
private void LoadInfo() { if (Request.QueryString["id"] != null) { StuNo.Value = Request.QueryString["id"].ToString(); } else { return; } StudentInfo student = bllStudent.Get(Int32.Parse(StuNo.Value)); StuNoShow.Text = student.Stu_ID.ToString(); StuNickName.Text = student.Stu_UserName; StuEmail.Text = student.Stu_Email; //头像 //余额 //StuDuration.Text= }
//下载完整版 点击事件 protected void DownloadAll_Command(object sender, CommandEventArgs e) { object[] arguments = e.CommandArgument.ToString().Split(','); string viewUrl = Convert.ToString(arguments[0]); int teaId = Convert.ToInt32(arguments[1]); BalanceInfo balance = bllBalance.GetbyTidSid(teaId, Convert.ToInt32(stuId)); if (null != cookie) { stuId = cookie.Values["ID"]; } else { Response.Redirect("~/Student/Login.aspx"); //未登录时点击,跳转带登录页面 } if (!stuId.Equals("-1")) { try { StudentInfo stuInfo = bllStudent.Get(Convert.ToInt32(stuId)); } catch { Response.Redirect("~/Student/Login.aspx"); //未找到该学生id时,跳转到登录界面 } } //余额不足时,跳转到购买界面 if (null == balance || System.DateTime.Now > balance.Bal_Time) { Response.Redirect(String.Format("../Purchase/TeachersPurchase.aspx?tid={0}", teaId)); } //有余额时,下载完整版 else { string filename = MapPath(viewUrl); Response.Clear(); Response.ContentType = "application/octet-stream "; Response.AppendHeader("Content-Disposition ", "attachment; Filename = " + System.Convert.ToChar(34) + filename + System.Convert.ToChar(34)); Response.Charset = " "; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Flush(); Response.WriteFile(viewUrl); } }