//观看视频 protected void seeVi() { try { string sql = "select * from tb_Video where VideoID=" + Convert.ToInt32(Request.QueryString["VideoID"]); OleDbDataReader odr = mydo.row(sql); //调用数据库操作类中的row方法 odr.Read(); //前进一条记录 VUrl = "Video" + "\\" + odr["VideoUrl"].ToString(); //存储视频教程的路径 if (!File.Exists(Server.MapPath(".") + "\\" + VUrl)) //判断此教程是否存在 { string dlsql = "delete from tb_Video where VideoID=" + Convert.ToInt32(Request.QueryString["VideoID"]); mydo.adlData(dlsql); Page.RegisterStartupScript("true", "<script>alert('文件不存在!请返回!');location='index.aspx'</script>"); } VideoTitle = odr["VideoName"].ToString(); Content = odr["VideoContent"].ToString(); Name = odr["Name"].ToString(); FBDate = odr["FBDate"].ToString(); ClickSum = odr["ClickSum"].ToString(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void Button1_Click(object sender, EventArgs e) { string userName = txtName.Text; string question = txtPassQuestion.Text; string solution = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassSolution.Text, "MD5"); string sql = "select * from tb_login where Name='" + userName + "' and PassQuestion ='" + question + "' and PassSolution='" + solution + "'"; try { OleDbDataReader sdr = mydo.row(sql); sdr.Read(); txtPass.Text = Operate.Decrypting(sdr["Pass"].ToString()); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
//绑定图标 public string ImgUrl(string id) { string sql = "select Lock from tb_login where ID=" + id; OleDbDataReader odr = mydo.row(sql); //调用数据库操作类的Row方法查找用户的详细信息 odr.Read(); int i = Convert.ToInt32(odr["Lock"]); //判断用户是否被锁定 if (i == 0) { return("../images/kaisuo.gif"); //返回未锁定的图标 } else { return("../images/suo.gif"); //返回锁定的图标 } }
protected void createCon() { try { string sql = "select * from tb_Bulletin where ID=" + Request.QueryString["ID"]; OleDbDataReader odr = mydo.row(sql); odr.Read(); lbTitle.InnerText = odr["Title"].ToString(); Content = odr["Content"].ToString(); this.labDate.Text = Convert.ToDateTime(odr["Date"]).ToLongDateString(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
protected void imgbtnLanding_Click(object sender, ImageClickEventArgs e) { string name = txtName.Text; string pass = Operate.Encrypting(txtPass.Text); string yzm = txtYzm.Text; if (Session["CheckCode"].ToString().Equals(yzm)) { try { string sql = "select count(*) from tb_login where Name='" + name + "' and Pass ='******'"; int i = mydo.isData(sql); if (i > 0) { sql = "select * from tb_login where Name='" + name + "'"; OleDbDataReader odr = mydo.row(sql); odr.Read(); if (odr["lock"].ToString() == "0") { Session["UserName"] = name; Response.Redirect("index.aspx"); } else { Page.RegisterStartupScript("false", "<script>alert('此用户已被锁定!')</script>"); } } else { Response.Write("<script>alert('密码或用户名错误!')</script>"); } } catch (Exception ex) { Response.Write(ex.Message.ToString()); } } else { Page.RegisterStartupScript("false", "<script>alert('验证码错误!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); string sql = "select Lock from tb_login where ID=" + id; OleDbDataReader odr = mydo.row(sql); odr.Read(); int i = Convert.ToInt32(odr["Lock"]); if (i == 0) { string upsql = "update tb_Login set Lock=1 where ID=" + id; mydo.updateData(upsql); } else { string upsql = "update tb_Login set Lock=0 where ID=" + id; mydo.updateData(upsql); } Response.Redirect("manage_user.aspx"); }
//播放语音 protected void PlaySound() { try { string sql = "select * from tb_Sound where SoundID=" + Convert.ToInt32(Request.QueryString["SoundID"]); OleDbDataReader odr = mydo.row(sql); odr.Read(); SUrl = "Sound" + "\\" + odr["SoundUrl"].ToString(); if (!File.Exists(Server.MapPath(".") + "\\" + SUrl)) { Page.RegisterStartupScript("true", "<script>alert('文件不存在!请返回!');location='index.aspx'</script>"); } SoundTitle = odr["SoundName"].ToString(); Content = odr["SoundContent"].ToString(); Name = odr["Name"].ToString(); FBDate = odr["FBDate"].ToString(); ClickSum = odr["ClickSum"].ToString(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }
//观看视频 protected void seeVi() { try { string sql = "select * from tb_Video where VideoID=" + Convert.ToInt32(Request.QueryString["VideoID"]); OleDbDataReader odr = mydo.row(sql); odr.Read(); VUrl = "../Video" + "\\" + odr["VideoUrl"].ToString(); if (!File.Exists(Server.MapPath(".") + "\\" + VUrl)) { Page.RegisterStartupScript("true", "<script>alert('文件不存在!请返回!')</script>"); } VideoTitle = odr["VideoName"].ToString(); Content = odr["VideoContent"].ToString(); Name = odr["Name"].ToString(); FBDate = odr["FBDate"].ToString(); ClickSum = odr["ClickSum"].ToString(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }