예제 #1
0
        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", "��ʼ�ܴδ��ڽ����ܴ�");
                    return;
                }
            }
            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;
            }

            LabMS.BLL.TeachMission TeachMission = new LabMS.BLL.TeachMission();
            LabMS.Model.TeachMission model = new LabMS.Model.TeachMission();
            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_Year = ddl_Year.SelectedValue;
            model.Ms_Term = ddl_Season.SelectedValue;
            int ID = TeachMission.Add(model);
            string[] array = tb_ClassIDs.Text.Split(',');
            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);
                }
            }

            ///�����༶��ѡ�ΰ༶ �Ϳγ̵�����
            ///\
            ///
            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 = ID;
                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());

            int temID = TC.Add(Model);

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('����ɹ���');if(window.confirm('�Ƿ񷵻��б�ҳ�棿')){window.location.href='TeachingMissionList.aspx'}else{window.location.href='TeachingMissionPreview.aspx?ID=" + temID + "'};</script>");
        }
        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>");
        }
        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;
                    }
                }

            }
        }
예제 #4
0
        //��ȡ�γ̰����б�
        protected List<LabMS.Model.TeachMission> GetCourseArrangeList()
        {
            LabMS.BLL.TeachMission teaMiss = new LabMS.BLL.TeachMission();
            List<LabMS.Model.TeachMission> teaMissModel = new List<LabMS.Model.TeachMission>();
            StringBuilder strWhere= new StringBuilder();

            strWhere.Append("Ms_Year='"+YearDDL.SelectedValue+"'");
            strWhere.Append(" and Ms_Term='"+TermDDL.SelectedValue+"'");
            if(IsConflictDDL.SelectedValue!="0")
            {
                strWhere.Append(" and Ms_Conflict='"+IsConflictDDL.SelectedValue+"'");
            }
            if(LabNameDDL.SelectedValue!="0")
            {
                strWhere.Append(" and LabID="+int.Parse(LabNameDDL.SelectedValue));
            }
            strWhere.Append(" and Ms_CourseCode like '%" + CouCodeTBX.Text.Trim() + "%' and Ms_CourseName like '%" + CouNameTBX.Text.Trim() + "%' and [ID] in (select distinct TeachMissionID from ClassItem)");
            teaMissModel = teaMiss.GetModelList(strWhere.ToString());
            return teaMissModel;
        }