示例#1
0
    protected void ButtonClearStudent_Click(object sender, EventArgs e)
    {
        if (CheckBoxDel.Checked)
        {
            string cip = Page.Request.UserHostAddress;            //客户端IP
            string sip = LearnSite.Common.Computer.GetServerIp(); //服务器IP
            if (cip == sip)
            {
                string countstu = TextBoxcount.Text;
                if (countstu != "" && countstu != "0")
                {
                    int sgrade = Int32.Parse(DDLgrade.SelectedValue);
                    int sclass = Int32.Parse(DDLclass.SelectedValue);
                    LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy();
                    wbll.DelWebClass(sgrade, sclass);
                    LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                    int delcount = sbll.DeleteClassMate(sgrade, sclass);//清空该班级学生
                    Labelmsg.Text = "您请空了" + DDLgrade.SelectedValue + "年级" + DDLclass.SelectedValue + "班所有学生共" + delcount.ToString() + "位!";

                    int syear = sbll.GetYear(sgrade, sclass);
                    LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
                    gbll.DelSignClass(sgrade, sclass, syear);
                    //清空签到
                    LearnSite.BLL.Works kbll = new LearnSite.BLL.Works();
                    kbll.DelClass(sgrade, sclass, syear);
                    //清空作品
                    LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback();
                    fbll.DelClass(sgrade, sclass, syear);
                    //清空调查
                    LearnSite.BLL.TopicReply rbll = new LearnSite.BLL.TopicReply();
                    rbll.DelClass(sgrade, sclass, syear);
                    //清空讨论
                }
                else
                {
                    Labelmsg.Text = "无学生记录可清空!";
                }
            }
            else
            {
                Labelmsg.Text = "此操作只能在服务器上浏览该页面才能执行,谢谢!";
            }
        }
        else
        {
            Labelmsg.Text = "请在确认操作选项上打勾!";
        }
    }