protected void DataBinds()
        {
            LabMS.BLL.TeachMission Mission = new LabMS.BLL.TeachMission();
            LabMS.Model.TeachMission model = new LabMS.Model.TeachMission();

            model = Mission.GetModel(QueryString);
            tb_CourseCode.Text = model.Ms_CourseCode;
            tb_CourseName.Text = model.Ms_CourseName;
            tb_ExpHouse.Text = model.Ms_CourseHourse.ToString();

            tb_StartWeek.Text = model.Ms_StartWeek.ToString();
            tb_EndWeek.Text = model.Ms_EndWeek.ToString();
            tb_ComputerTime.Text = model.Ms_ComputerHourse.ToString();
            if (model.Ms_Teacher != null)
            {
                tb_TeacherID.Text = model.Ms_Teacher.ToString();
                LabMS.BLL.Teacher Teacher = new LabMS.BLL.Teacher();
                LabMS.Model.Teacher teachermodel = Teacher.GetModel(model.Ms_Teacher.Value);
                if (teachermodel != null)
                {
                    tb_Teacher.Text = teachermodel.Teacher_Name;
                }
            }
            YearBind(model.Ms_Year);
            LabMS.BLL.Lab Lab = new LabMS.BLL.Lab();
            List<LabMS.Model.Lab> ParentLab = new List<LabMS.Model.Lab>();
            ParentLab = Lab.GetModelList("Lab_ParentID is null");
            List<LabMS.Model.Lab> SonLab = new List<LabMS.Model.Lab>();
            SonLab = Lab.GetModelList("Lab_ParentID is not null");

            for (int i = 0; i < ParentLab.Count; i++)
            {
                ddl_Lab.Items.Add(new ListItem(ParentLab[i].Lab_Name, ParentLab[i].ID.ToString()));
                for (int j = 0; j < SonLab.Count; j++)
                {
                    if (SonLab[j].Lab_ParentID == ParentLab[i].ID)
                    {
                        ddl_Lab.Items.Add(new ListItem("--|" + SonLab[j].Lab_Name, SonLab[j].ID.ToString()));
                    }
                }
            }
            ddl_Lab.Items.Insert(0, new ListItem("--��ѡ��--", "0"));

            if (model.LabID != null)
            {
                ddl_Lab.Items.FindByValue(model.LabID.ToString()).Selected = true;
            }

            LabMS.BLL.DictionaryClass DicClass = new LabMS.BLL.DictionaryClass();
            LabMS.BLL.Dictionary Dic = new LabMS.BLL.Dictionary();
            LabMS.Model.DictionaryClass ds = new LabMS.Model.DictionaryClass();
            List<LabMS.Model.Dictionary> ls = new List<LabMS.Model.Dictionary>();
            if (DicClass.GetModelList("Code='Conflict'").Count != 0)
            {
                ds = DicClass.GetModelList("Code='Conflict'")[0];
                ls = Dic.GetModelList("DClass='" + ds.Code + "'");
                if (ls.Count != 0)
                {
                    rbl_Conflict.DataSource = ls;
                    rbl_Conflict.DataTextField = "Name";
                    rbl_Conflict.DataValueField = "Code";
                    rbl_Conflict.DataBind();
                    if (model.Ms_Conflict != "")
                    {
                        rbl_Conflict.Items.FindByValue(model.Ms_Conflict).Selected = true;
                    }
                }

            }
        }
        protected void Save_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_CourseCode.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "�γ̱�Ų���Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(tb_CourseName.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "���������");
                return;
            }
            if (ddl_Lab.SelectedValue == "0")
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "��ѡ��е��γ̵�ʵ����");
                return;
            }
            if (string.IsNullOrEmpty(tb_ExpHouse.Text))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", " ʵ��ѧʱ����Ϊ��");
                return;
            }
            if (string.IsNullOrEmpty(tb_StartWeek.Text))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "��ʼ�ܴβ���Ϊ����ӦΪ����");
                return;
            }
            if (!IsNumber(tb_StartWeek.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "��ʼ�ܴβ���Ϊ����ӦΪ����");
                return;
            }
            if (!IsNumber(tb_EndWeek.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "�����ܴβ���Ϊ����ӦΪ����");
                return;
            }
            int Num1 = 0;
            int Num2 = 0;
            if (int.TryParse(tb_StartWeek.Text, out Num1) && int.TryParse(tb_EndWeek.Text, out Num2))
            {
                if (Num2 < Num1)
                {
                    LabMS.Common.JShelper.JSAlert(this, "error", "��ʼ�ܴδ��ڽ����ܴ�");
                }
            }
            else
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "�ܴβ���Ϊ�գ���Ӧ��Ϊ����");
                return;
            }

            if (!IsNumber(tb_ComputerTime.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "�ϻ�����Ϊ����ӦΪ����");
                return;
            }
            if (string.IsNullOrEmpty(tb_Teacher.Text))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "��ʦ����Ϊ����ӦΪ����");
                return;
            }
            if (!(Gv_Class.Rows.Count > 0))
            {
                LabMS.Common.JShelper.JSAlert(this, "error", "��ѡ��γ̶�Ӧ�İ༶");
                return;
            }

            try
            {
                LabMS.BLL.TeachMission TeachMission = new LabMS.BLL.TeachMission();
                LabMS.Model.TeachMission model = new LabMS.Model.TeachMission();

                model = TeachMission.GetModel(QueryString);
                if (model != null)
                {
                    model.LabID = Convert.ToInt32(ddl_Lab.SelectedValue.Trim());
                    model.Ms_CourseCode = (tb_CourseCode.Text);
                    model.Ms_CourseName = tb_CourseName.Text;
                    model.Ms_SubmitTime = DateTime.Now;
                    model.Ms_Teacher = Convert.ToInt32(tb_TeacherID.Text);
                    model.Ms_Conflict = rbl_Conflict.SelectedValue.Trim();
                    model.Ms_StartWeek = Convert.ToInt32(tb_StartWeek.Text.Trim().ToString());
                    model.Ms_EndWeek = Convert.ToInt32(tb_EndWeek.Text.Trim().ToString());
                    model.Ms_CourseHourse = Convert.ToInt32(tb_ExpHouse.Text.Trim());
                    model.Ms_ComputerHourse = Convert.ToInt32(tb_ComputerTime.Text.Trim());
                    model.Ms_Term = ddl_Season.SelectedValue;
                    model.Ms_Year = ddl_Year.SelectedValue;
                    TeachMission.Update(model);
                }
            }
            catch (Exception ex)
            {
                lb_Error.Text = ex.Message;
            }

            string[] array = tb_ClassIDs.Text.Split(',');
            if (array.Length == 1 && array[0] == "")
            {
                return;
            }
            List<string> lsIDs = new List<string>();

            lsIDs.Add(array[0]);

            foreach (string item in array)
            {
                int Count = 0;
                foreach (string Pr in lsIDs)
                {
                    if (item != Pr)
                    {
                        Count++;
                    }
                }
                if (Count == lsIDs.Count)
                {
                    lsIDs.Add(item);
                }
            }

            //��ȡ�б�
            try
            {
                ExtendBLL.ClassItemDelete ClassItemDelete = new ExtendBLL.ClassItemDelete();
                int result = ClassItemDelete.Delete(QueryString.ToString());
                if (result == 0)
                {
                    //LabMS.Common.JShelper.JSAlert(this, "error", "��ѯ�ַ�������");
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>window.location.href='~/err.aspx?Message=��ѯ�ַ�������';<script>");
                    return;
                }
                if (result == 2)
                {
                    LabMS.Common.JShelper.JSAlert(this, "error", "���´���");
                }
            }
            catch (Exception ex)
            {
                lb_Error.Text = ex.Message;
            }

            int CourseID = int.Parse(tb_CourseID.Text.Trim());
            LabMS.BLL.ClassItem ClassItem = new LabMS.BLL.ClassItem();
            LabMS.BLL.Class Class = new LabMS.BLL.Class();
            LabMS.Model.Class classModel;
            LabMS.Model.ClassItem classItemModel;
            for (int n = 0; n < lsIDs.Count; n++)
            {
                classModel = Class.GetModel(Convert.ToInt32(lsIDs[n]));
                classItemModel = new LabMS.Model.ClassItem();
                classItemModel.CourseID = CourseID;
                classItemModel.ClassItem_Code = classModel.Class_Code;
                classItemModel.ClassItem_Name = classModel.Class_Name;
                classItemModel.ClassItem_Num = classModel.Class_StudentNum;
                classItemModel.ClassItem_Degree = classModel.Class_Year;
                classItemModel.ClassID = Convert.ToInt32(lsIDs[n]);
                classItemModel.Time = DateTime.Now;
                classItemModel.TeachMissionID = QueryString;
                int classItemModelID = ClassItem.Add(classItemModel);
            }

            LabMS.BLL.TeacherCourse TC = new LabMS.BLL.TeacherCourse();
            LabMS.Model.TeacherCourse Model = new LabMS.Model.TeacherCourse();

            Model.CourseID = CourseID;
            Model.TeacherID = Convert.ToInt32(tb_TeacherID.Text.Trim());

            TC.Add(Model);

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�޸ijɹ�');window.location.href='TeachingMissionList.aspx';</script>");
        }