Пример #1
0
    protected void BtncreateOne_Click(object sender, EventArgs e)
    {
        string tgrade = TextBoxGrade.Text.Trim();
        string tclass = TextBoxClass.Text.Trim();

        if (tgrade != "" && tclass != "")
        {
            if (LearnSite.Common.WordProcess.IsNum(tgrade) && LearnSite.Common.WordProcess.IsNum(tclass))
            {
                int rgrade = Int32.Parse(tgrade);
                int rclass = Int32.Parse(tclass);
                LearnSite.BLL.Room rbll = new LearnSite.BLL.Room();
                if (!rbll.ExistsGC(rgrade, rclass))
                {
                    rbll.AddRoom(rgrade, rclass);//如果不存在则添加该班级
                    Labelmsg.Text = "添加" + tgrade + "年级" + tclass + "班成功,请查看!";
                    System.Threading.Thread.Sleep(500);
                    ShowAllRoom();
                }
                else
                {
                    Labelmsg.Text = "该班级已经存在,不能再添加!";
                }
            }
            else
            {
                Labelmsg.Text = "年级、班级请输入数字表示";
            }
        }
        else
        {
            Labelmsg.Text = "年级、班级为空,请输入!";
        }
    }