protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string code = Request.QueryString["code"]; var pp = new System.Data.IDbDataParameter[1]; pp[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <TeacherInfo>("code=@code", pp).FirstOrDefault(); if (data == null) { this.ShowAlert("用户信息不存在", "Default.aspx"); return; } //姓名 name.Text = data.name; age.Text = ""; //年龄 if (data.age != null) { age.Text = data.age.Value.ToString(); } if (data.sex == "男") { sex.SelectedValue = "男"; } else { sex.SelectedValue = "女"; } kemu.Text = data.kemu; lxfs.Text = data.lxfs; Image1.ImageUrl = data.photoUrl; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; if (string.IsNullOrEmpty(id)) { this.ShowAlert("未传入有效的预约号", "OrderInfo.aspx"); return; } var data = Sql.Query <TeacherORDER>("id=@id", new System.Data.IDbDataParameter[] { Sql.CreateParameter("@id", id.AsInt()) }).FirstOrDefault(); if (data == null) { this.ShowAlert("未查询到预约信息,无法预约", "OrderInfo.aspx"); return; } if (data.yyzt != "已预约") { this.ShowAlert("状态不是已预约,无法操作", "OrderInfo.aspx"); return; } data.yyzt = "已完成"; Sql.Edit(data); this.ShowAlert("成功完成预约", "OrderInfo.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string code = Request.QueryString["code"]; var pp = new System.Data.IDbDataParameter[1]; pp[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <AdminInfo>("code=@code", pp).FirstOrDefault(); if (data == null) { this.ShowAlert("用户信息不存在", "Default.aspx"); return; } //姓名 name.Text = data.name; lxfs.Text = data.lxfs; Image1.ImageUrl = data.photoUrl; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; var pp = new System.Data.IDbDataParameter[2]; pp[0] = Sql.CreateParameter("@id", id); pp[1] = Sql.CreateParameter("@stu_code", Session["login_code"].AsString()); var data = Sql.Query <StuAsk>("id=@id and stu_code=@stu_code", pp).FirstOrDefault(); if (data == null) { this.ShowAlert("问题信息不存在", "Default.aspx"); return; } title.Text = data.title; content.Text = data.content; catagory.Text = data.catagory; Image1.ImageUrl = data.imageUrl; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (string.IsNullOrEmpty(Session["login_code"].AsString())) { this.ShowAlert("请先登录本系统", "Login.aspx"); return; } string code = Request.QueryString["code"]; var pp = new System.Data.IDbDataParameter[1]; pp[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <StuInfo>("code=@code", pp).FirstOrDefault(); if (data == null) { this.ShowAlert("用户信息不存在", "Default.aspx"); return; } //姓名 name.Text = data.name; age.Text = ""; //年龄 if (data.age != null) { age.Text = data.age.Value.ToString(); } if (data.sex == "男") { sex.Text = "男"; } else { sex.Text = "女"; } grade.Text = data.grade; lxfs.Text = data.lxfs; Image1.ImageUrl = data.photoUrl; } }
protected void btnConfirmClicked(object sender, EventArgs e) { string code = Session["login_code"].AsString(); var pp = new System.Data.IDbDataParameter[1]; pp[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <StuInfo>("code=@code", pp).FirstOrDefault(); if (data == null) { this.ShowAlert("学生信息不存在", "Default.aspx"); return; } data.needs = needs.Text; data.pubDate = DateTime.Now; Sql.Edit(data); this.ShowAlert("发布成功"); }
protected void btnLoginClicked(object sender, EventArgs e) { try { string code = Request.Form["code"]; string pwd = Request.Form["pwd"]; string role = Request.Form["role"]; System.Data.IDbDataParameter[] parms = new System.Data.IDbDataParameter[1]; switch (role) { case "管理员": { parms[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <AdminInfo>("code=@code", parms).FirstOrDefault(); if (data != null) { Session["login_photo"] = data.photoUrl; Session["login_name"] = data.name; Session["login_pwd"] = data.pwd; } } break; case "教员": { parms[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <TeacherInfo>("code=@code", parms).FirstOrDefault(); if (data != null) { Session["login_photo"] = data.photoUrl; Session["login_name"] = data.name; Session["login_sex"] = data.sex; Session["login_age"] = data.age; Session["login_pwd"] = data.pwd; } } break; case "学员": { parms[0] = Sql.CreateParameter("@code", code); var data = Sql.Query <StuInfo>("code=@code", parms).FirstOrDefault(); if (data != null) { Session["login_photo"] = data.photoUrl; Session["login_name"] = data.name; Session["login_sex"] = data.sex; Session["login_age"] = data.age; Session["login_pwd"] = data.pwd; } } break; } if (string.IsNullOrEmpty(Session["login_name"].AsString())) { //用户信息不存在 Page.ShowAlert("用户信息不存在"); return; } if (Session["login_pwd"].AsString() != pwd) { //密码输入有误 Page.ShowAlert("密码输入有误"); return; } Session["login_code"] = code; Session["login_role"] = role; //跳转到指定页面 Response.RedirectToPage("Default.aspx"); } catch (Exception ex) { Page.ShowAlert("登录异常,错误信息:" + ex.Message); return; } }