Ejemplo n.º 1
0
 //观看视频
 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());
     }
 }
Ejemplo n.º 2
0
    //发言
    protected void Button3_Click(object sender, EventArgs e)
    {
        string spokesman;

        if (Session["UserName"] != null)
        {
            spokesman = Session["UserName"].ToString();
        }
        else
        {
            spokesman = "游客";
        }
        string speakContent = this.txtCont.Text;
        string tutorialType = "Sound";
        string tutorialID   = Request.QueryString["SoundID"];
        string insertSql    = "insert into tb_Speak([Spokesman],[TutorialType],[TutorialID],[SpeakContent]) values('" + spokesman + "','" + tutorialType + "'," + tutorialID + ",'" + speakContent + "')";

        if (Session["CheckCode"].ToString().Equals(this.txtYzm.Text.ToString()))
        {
            bool bo = mydo.adlData(insertSql);
            if (bo)
            {
                seekSpeak();
                Page.RegisterStartupScript("true", "<script>alert('发言成功!');</script>");
            }
            else
            {
                Page.RegisterStartupScript("false", "<script>alert('发言失败!')</script>");
            }
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('验证码错误')</script>");
        }
    }
Ejemplo n.º 3
0
    protected void grvVideo_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string sql = "delete from tb_Sound where SoundID=" + grvSound.DataKeys[e.RowIndex].Value.ToString();

        if (mydo.adlData(sql))
        {
            string ssql = "delete from tb_Speak where TutorialType='Sound' and TutorialID=" + grvSound.DataKeys[e.RowIndex].Value.ToString();
            mydo.adlData(ssql);
            Page.RegisterStartupScript("true", "<script>alert('删除成功!')</script>");
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('删除失败!')</script>");
        }
        createSound();
    }
Ejemplo n.º 4
0
    protected void grvVideo_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string vsql     = "delete from tb_Video where VideoID=" + grvVideo.DataKeys[e.RowIndex].Value.ToString();
        bool   delVideo = mydo.adlData(vsql);

        if (delVideo)
        {
            string ssql = "delete from tb_Speak where TutorialType='Video' and TutorialID=" + grvVideo.DataKeys[e.RowIndex].Value.ToString();
            mydo.adlData(ssql);
            Page.RegisterStartupScript("true", "<script>alert('删除成功!')</script>");
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('删除失败!')</script>");
        }
        createVideo();
    }
Ejemplo n.º 5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string vsname = TextBoxVname.Text;
        string isVS;

        if (RadioButtonSound.Checked)
        {
            isVS = "tb_Sound";
        }
        else
        {
            isVS = "tb_Video";
        }
        string typ      = this.DropDownListType.SelectedValue;
        string content  = TextBoxContent.Text;
        string name     = "校长";
        int    clicksum = 0;

        string Path;

        try
        {
            string sql;
            if (isVS == "tb_Sound")
            {
                sql  = "insert into tb_Sound(SoundType,SoundName,SoundUrl,ClickSum,SoundContent,Name) values('" + typ + "','" + vsname + "','" + this.FileUpload1.FileName + "','" + clicksum + "','" + content + "','" + name + "')";
                Path = Server.MapPath("~/") + "Sound" + "\\" + this.FileUpload1.FileName;
            }
            else
            {
                sql  = "insert into tb_Video(VideoType,VideoName,VideoUrl,ClickSum,VideoContent,Name) values(" + typ + ",'" + vsname + "','" + this.FileUpload1.FileName + "'," + clicksum + ",'" + content + "','" + name + "')";
                Path = Server.MapPath("~/") + "Video" + "\\" + this.FileUpload1.FileName;
            }


            if (mydo.adlData(sql))
            {
                FileUpload1.PostedFile.SaveAs(Path);
                Page.RegisterStartupScript("true", "<script>alert('上传成功!')</script>");
                TextBoxVname.Text   = "";
                TextBoxContent.Text = "";
            }
            else
            {
                Page.RegisterStartupScript("false", "<script>alert('上传是彼岸 ')</script>");
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }
Ejemplo n.º 6
0
    protected void grvBulletin_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string sql = "delete from tb_Bulletin where ID=" + grvBulletin.DataKeys[e.RowIndex].Value.ToString();

        if (mydo.adlData(sql))
        {
            Page.RegisterStartupScript("true", "<script>alert('删除成功!')</script>");
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('删除失败!')</script>");
        }
        createBulletin();
    }
Ejemplo n.º 7
0
    protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)
    {
        string id  = this.DataList1.DataKeys[e.Item.ItemIndex].ToString();
        string sql = "delete from tb_Speak where SpeakID=" + id;

        if (mydo.adlData(sql))
        {
            Page.RegisterStartupScript("true", "<script>alert('删除成功!')</script>");
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('删除失败!')</script>");
        }
        this.seeSpeak();
    }
Ejemplo n.º 8
0
    protected void btnFB_Click(object sender, EventArgs e)
    {
        string title   = this.tebTitle.Text;
        string content = this.tebContent.Text;
        string name    = this.tebName.Text;
        string sql     = "insert into tb_Bulletin(Title,Content,Name) values('" + title + "','" + content + "','" + name + "')";
        bool   bl      = mydo.adlData(sql);

        if (bl)
        {
            Page.RegisterStartupScript("true", "<script>alert('发布成功!')</script>");
            tebContent.Text = "";
            tebTitle.Text   = "";
            tebName.Text    = "";
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('发布失败!')</script>");
        }
    }
Ejemplo n.º 9
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        string spokesman;

        spokesman = "校长";
        string speakContent = this.TextBox2.Text;
        string tutorialType = "Sound";
        string tutorialID   = Request.QueryString["SoundID"];
        string insertSql    = "insert into tb_Speak([Spokesman],[TutorialType],[TutorialID],[SpeakContent]) values('" + spokesman + "','" + tutorialType + "'," + tutorialID + ",'" + speakContent + "')";
        bool   bo           = mydo.adlData(insertSql);

        if (bo)
        {
            Page.RegisterStartupScript("true", "<script>alert('发言成功!');localhost=seeVideo.aspx</script>");
        }
        else
        {
            Page.RegisterStartupScript("false", "<script>alert('发言失败!')</script>");
        }
    }
Ejemplo n.º 10
0
    //添加用户

    //自定义方法
    protected bool  add()
    {
        string name = txtName.Text;
        string pass = Operate.Encrypting(txtPass.Text);
        string sex;

        //获取性别
        if (RadioButtonMan.Checked)
        {
            sex = "男";
        }
        else
        {
            sex = "女";
        }
        string trueName     = txtTrueName.Text;       //获取真实姓名
        string idCard       = this.txtIDCard.Text;    //获取电话
        string passQuestion = this.txtPassQuestion.Text;
        string passSolution = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassSolution.Text, "MD5");
        string email        = txtEmail.Text;   //获取电子邮件
        string sql          = "insert into tb_login(Name,Pass,ZName,Sex,Email,IDCard,PassQuestion,PassSolution) values('" + name + "','" + pass + "','" + trueName + "','" + sex + "','" + email + "','" + idCard + "','" + passQuestion + "','" + passSolution + "')";

        return(mydo.adlData(sql));
    }