protected void DataBinds() { LabMS.Model.Course model = new LabMS.Model.Course(); LabMS.BLL.Course Course = new LabMS.BLL.Course(); model = Course.GetModel(Convert.ToInt32(QueryString)); tb_CourseCode.Text = model.Course_Code; tb_CourseName.Text = model.Course_Name; tb_ExpHouse.Text = model.Course_ExprientHouse.ToString(); tb_EngName.Text = model.EnglishName; // List<LabMS.Model.Dictionary> ls = new List<LabMS.Model.Dictionary>(); LabMS.BLL.DictionaryClass DicClass = new LabMS.BLL.DictionaryClass(); LabMS.Model.DictionaryClass ds = new LabMS.Model.DictionaryClass(); LabMS.BLL.Dictionary Dic = new LabMS.BLL.Dictionary(); List<LabMS.Model.DictionaryClass> lsDic = new List<LabMS.Model.DictionaryClass>(); lsDic = DicClass.GetModelList("Code='CourseType'"); if (lsDic.Count != 0) { ds = lsDic[0]; ls = Dic.GetModelList("DClass='" + ds.Code + "'"); ddl_CourseType.DataSource = ls; ddl_CourseType.DataTextField = "Name"; ddl_CourseType.DataValueField = "Code"; ddl_CourseType.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { strPageUserType.Add("mana"); strPagePrivilege.Add("KCXYM"); if (!Page.IsPostBack) { DataBinds(); tb_Submitter.Attributes.Add("readOnly", "-1"); tb_Time.Attributes.Add("readOnly", "-1"); tb_CourseName.Attributes.Add("readOnly", "-1"); tb_CourseCode.Attributes.Add("readOnly", "-1"); if (Request.QueryString["ID"] != null) { int CourseID = int.Parse(Request.QueryString["ID"]); LabMS.BLL.Course course = new LabMS.BLL.Course(); LabMS.Model.Course courseinfo = new LabMS.Model.Course(); courseinfo = course.GetModel(CourseID); tb_CourseID.Text = CourseID.ToString(); tb_CourseName.Text = courseinfo.Course_Name; tb_CourseCode.Text = courseinfo.Course_Code; addcourse.Visible = false; } if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(UserID)) { tb_Submitter.Text = UserName; } } }
protected void DataBinds(int CourseID) { LabMS.BLL.Course Course = new LabMS.BLL.Course(); LabMS.Model.Course model = new LabMS.Model.Course(); model = Course.GetModel(CourseID); lb_CourseCode.Text = model.Course_Code; lb_CourseName.Text = model.Course_Name; lb_CourseType.Text = model.CourseType; lb_EnglishName.Text = model.EnglishName; }
/// <summary> /// 页面初始化 /// </summary> protected void InitBind(int ID) { LabMS.BLL.Course BCourse = new LabMS.BLL.Course(); LabMS.Model.Course MCourse = new LabMS.Model.Course(); MCourse = BCourse.GetModel(ID); tbCode.Text = MCourse.Course_Code; tbName.Text = MCourse.Course_Name; tbnEnglishName.Text = MCourse.EnglishName; courseID.Value = MCourse.ID.ToString(); if (MCourse.Course_ExprientHouse != null) { tbHour.Text = MCourse.Course_ExprientHouse.Value.ToString(); } tbCourseHouse.Text = MCourse.Course_House; }
//绑定数据 protected void BindData(int ID) { LabMS.Model.ClassItem model = new LabMS.Model.ClassItem(); LabMS.BLL.Course course = new LabMS.BLL.Course(); LabMS.Model.Course courseModel = new LabMS.Model.Course(); courseModel = course.GetModel(ID); model = GetClassName(ID); CourseCodeTBX.Text = courseModel.Course_Code; CourseNameTBX.Text = courseModel.Course_Name; ProjectName.Text = courseModel.Professional;//专业 ClassTBX.Text = model.ClassItem_Name;//班级 SumTBX.Text = model.ClassItem_Num.ToString();//总人数 if (SubjectDDL.SelectedValue != "") { ExprientHouseTBX.Text = GetExHourByProID(int.Parse(SubjectDDL.SelectedValue));//实验学时 TeacherTBX.Text = GetTeacherByClaIDAndProIDAndCouID(int.Parse(IDHF.Value), int.Parse(SubjectDDL.SelectedValue), int.Parse(ClassDDL.SelectedValue));//授课教师 } }
protected void DataBinds(int CourseID) { LabMS.BLL.Course Course = new LabMS.BLL.Course(); LabMS.Model.Course model = new LabMS.Model.Course(); model = Course.GetModel(CourseID); lb_CourseCode.Text = model.Course_Code; lb_CourseName.Text = model.Course_Name; lb_CourseType.Text = model.CourseType; lb_EnglishName.Text = model.EnglishName; #region ����Ŀ�б� LabMS.BLL.CourseAndProject courseproject = new LabMS.BLL.CourseAndProject(); List<LabMS.Model.CourseAndProject> courseprojectlist = new List<LabMS.Model.CourseAndProject>(); string strWhere1 = " CourseID=" + CourseID; courseprojectlist = courseproject.GetModelList(strWhere1); string strWhere2 = ""; foreach (LabMS.Model.CourseAndProject cp in courseprojectlist) { if (cp.ProjectID != null) { if (strWhere2.Equals("")) { strWhere2 += " Project.ID=" + cp.ProjectID; } else { strWhere2 += " or Project.ID=" + cp.ProjectID; } } } if (strWhere2 == "") { strWhere2 = "1<>1"; } ExtendBLL.ProjectAndOther project = new ExtendBLL.ProjectAndOther(); List<ExtendModule.ProjectAndOther> projectlist = new List<ExtendModule.ProjectAndOther>(); projectlist = project.GetModelList2(strWhere2); string strHTML = "<table id='studenlist' border='1' class='infoTable' style='border-collapse: collapse;'>"; strHTML += "<thead>"; strHTML += "<tr class='header'>"; strHTML += "<td class='none'>"; strHTML += "��ĿID"; strHTML += "</td>"; strHTML += "<td>"; strHTML += "ʵ���ұ���"; strHTML += "<td>"; strHTML += "ʵ��������"; strHTML += "</td>"; strHTML +="<td>"; strHTML +="��Ŀ����"; strHTML +="</td>"; strHTML += "<td>"; strHTML += "��Ŀ����"; strHTML += "</td>"; strHTML += "<td>"; strHTML += "����"; strHTML += "</td>"; strHTML += "</tr>"; strHTML += "</thead>"; strHTML += "<tbody>"; tb_ProjectIDs.Value = ""; foreach(ExtendModule.ProjectAndOther p in projectlist) { if(tb_ProjectIDs.Value == "") { tb_ProjectIDs.Value += p.ID.ToString(); } else { tb_ProjectIDs.Value += "," + p.ID.ToString(); } strHTML += "<tr>"; strHTML += "<td>"; strHTML += p.ID.ToString(); strHTML += "</td>"; strHTML += "<td>"; strHTML += p.Lab_Code; strHTML += "<td>"; strHTML += p.Lab_Name; strHTML += "</td>"; strHTML +="<td>"; strHTML += p.Project_Name; strHTML += "</td>"; strHTML += "<td>"; strHTML += p.Project_Code; strHTML += "</td>"; strHTML += "<td>"; strHTML += "<a>ɾ��</a>"; strHTML += "</td>"; strHTML += "</tr>"; } strHTML += "</tbody>"; strHTML += "</table>"; tbListProject.Value += strHTML; tblistEmpty.Value = "0"; #endregion }
//保存更改 protected void Save_OnClick(object sender, EventArgs e) { if (tb_StudentIDs.Text == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('请选择教师!')</script>"); return; } if (tb_StudentIDs2.Value == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('请选择班级!')</script>"); return; } string[] strArray = IDHF.Value.Split(','); ExtendBLL.Arrangement arrExBLL = new ExtendBLL.Arrangement(); string Week = strArray[0]; int WeekDay = int.Parse(strArray[1]); int Lession = int.Parse(strArray[2]); int LocationID = int.Parse(strArray[3]); arrExBLL.DeleteCouArr(" [Week]='" + Week + "' and Weekday=" + WeekDay + " and Lession=" + Lession + " and LocationID=" + LocationID + " and CourseID=" + int.Parse(CourseDDL.SelectedValue)); LabMS.BLL.Arrangement arrBLL = new LabMS.BLL.Arrangement(); LabMS.Model.Arrangement arr = new LabMS.Model.Arrangement(); LabMS.BLL.Course cou = new LabMS.BLL.Course(); LabMS.Model.Course couModel = new LabMS.Model.Course(); couModel = cou.GetModel(int.Parse(CourseDDL.SelectedValue)); arr.CourseID = couModel.ID;//课程ID arr.Year = couModel.CourseYear;//学年 arr.ScoreTerm = couModel.CourseSeason;//学期 arr.CourseName = couModel.Course_Name;//课程名称 arr.LocationID = int.Parse(HouseDDL.SelectedValue);//用房ID arr.LocationName = HouseDDL.SelectedItem.Text;//用房位置 arr.LabID = int.Parse(LabDDL.SelectedValue);//实验室ID arr.TeacherID = int.Parse(tb_StudentIDs.Text);//教师ID arr.TeacherName = tb_StudentNames.Value;//教师名称 string labName = LabDDL.Text; int index = labName.IndexOf("|-"); if (index == 0) { labName = labName.Substring(index, labName.Length - index - 1); } arr.LabName = labName;//实验室名称 String[] claListsID = tb_StudentIDs2.Value.Split(','); String[] claListsName = tb_StudentNames2.Value.Split(','); arr.CourseTeacherID = GetTeaCouID(int.Parse(tb_StudentIDs.Text), int.Parse(CourseDDL.SelectedValue)); for (int j = 0; j < claListsID.Length; j++) { arr.ClassID = int.Parse(claListsID[j]);//班级ID arr.ClassName = claListsName[j];//班级名称 arr.ChoosenClassID = GetClaCouID(int.Parse(CourseDDL.SelectedValue), int.Parse(claListsID[j]), GetTeaMissID(int.Parse(CourseDDL.SelectedValue), YearDDL.SelectedValue, TermDDL.SelectedValue));//选课班级ID arr.Week = WeekSelectDDL.SelectedValue;//授课周次 bool checkClassSelected = false; for (int n = 1; n < 8; n++) { arr.WeekDay = n;//授课天次 for (int p = 1; p < 6; p++) { CheckBox check2 = (CheckBox)lbDayAndClass.FindControl("chkDay" + n.ToString() + "Class" + p.ToString()); if (check2.Checked) { checkClassSelected = true; arr.Lession = p;//授课节次 string[] strCheckArrangement = new string[3]; strCheckArrangement = CheckArrangement(arr); if (strCheckArrangement[0] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('课程安排冲突!" + arr.LocationName + "在第" + arr.Week.ToString() + "周 星期" + arr.WeekDay.ToString() + " 第" + arr.Lession.ToString() + "大节已安排课程:" + strCheckArrangement[0] + "')</script>"); return; } if (strCheckArrangement[1] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('老师课程安排冲突!" + arr.TeacherName + "在第" + arr.Week.ToString() + "周 星期" + arr.WeekDay.ToString() + " 第" + arr.Lession.ToString() + "大节已安排课程:" + strCheckArrangement[1] + "')</script>"); return; } if (strCheckArrangement[3] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('班级安排冲突!" + arr.ClassName + "在第" + arr.Week.ToString() + "周 星期" + arr.WeekDay.ToString() + " 第" + arr.Lession.ToString() + "大节已安排课程:" + strCheckArrangement[3] + "')</script>"); return; } if (strCheckArrangement[4] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('老师地点安排冲突!在第" + arr.Week.ToString() + "周 星期" + arr.WeekDay.ToString() + " 第" + arr.Lession.ToString() + "大节已安排老师:" + strCheckArrangement[4] + "上课')</script>"); return; } if (strCheckArrangement[2] != "") { ; } else { arrBLL.Add(arr); } } } } if (!checkClassSelected) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('请选择上课节次!')</script>"); return; } } Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('修改成功!')</script>"); arrtable.Visible = false; YearDDL.Enabled = true; TermDDL.Enabled = true; CourseDDL.Enabled = true; DeleteBtn.Enabled = true; ArrangementGridView.Enabled = true; ArrangementGridView_DataBind(int.Parse(CourseDDL.SelectedValue), WeekDDL.SelectedValue, WeekDayDDL.SelectedValue, LocationBTX.Text.Trim(), TeacherTBX.Text.Trim()); }
//获取课程基本信息 protected void GetCourseInfo(int ID) { LabMS.BLL.Course course = new LabMS.BLL.Course(); LabMS.Model.Course courseModel = new LabMS.Model.Course(); courseModel = course.GetModel(ID); }
//���� protected void Save_OnClick(object sender, EventArgs e) { if (LabDDL.SelectedValue == "0") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ��ʵ���ң�')</script>"); return; } if (HouseDDL.SelectedValue == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ�䣡')</script>"); return; } if (tb_StudentIDs.Value == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ���ʦ��')</script>"); return; } if (tb_StudentIDs2.Value == "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ��༶��')</script>"); return; } LabMS.BLL.Arrangement arrBLL = new LabMS.BLL.Arrangement(); LabMS.Model.Arrangement arr = new LabMS.Model.Arrangement(); LabMS.BLL.Course cou = new LabMS.BLL.Course(); LabMS.Model.Course couModel = new LabMS.Model.Course(); couModel = cou.GetModel(int.Parse(CourseIDHF.Value)); arr.CourseID = couModel.ID;//�γ�ID arr.Year = couModel.CourseYear;//ѧ�� arr.ScoreTerm = couModel.CourseSeason;//ѧ�� arr.CourseName = couModel.Course_Name;//�γ����� arr.LocationID = int.Parse(HouseDDL.SelectedValue);//�÷�ID arr.LocationName = HouseDDL.SelectedItem.Text;//�÷�λ�� arr.LabID = int.Parse(LabDDL.SelectedValue);//ʵ����ID arr.TeacherID = int.Parse(tb_StudentIDs.Value);//��ʦID arr.TeacherName = tb_StudentNames.Value;//��ʦ���� string labName=LabDDL.Text; int index=labName.IndexOf("|-"); if (index == 0) { labName = labName.Substring(index, labName.Length - index-1); } arr.LabName = labName;//ʵ�������� //String[] teaListsID = tb_StudentIDs.Value.Split(','); //String[] teaListsName=tb_StudentNames.Value.Split(','); String[] claListsID = tb_StudentIDs2.Value.Split(','); String[] claListsName=tb_StudentNames2.Value.Split(','); //for (int i = 0; i < teaListsID.Length; i++) //{ //arr.TeacherName = teaListsName[i]; //arr.TeacherID = int.Parse(teaListsID[i]); //arr.CourseTeacherID = GetTeaCouID(int.Parse(teaListsID[i]), int.Parse(CourseIDHF.Value));//��ʦ�γ�ID arr.CourseTeacherID = GetTeaCouID(int.Parse(tb_StudentIDs.Value), int.Parse(CourseIDHF.Value)); for (int j = 0; j < claListsID.Length; j++) { arr.ClassID = int.Parse(claListsID[j]);//�༶ID arr.ClassName = claListsName[j];//�༶���� arr.ChoosenClassID = GetClaCouID(int.Parse(CourseIDHF.Value), int.Parse(claListsID[j]), int.Parse(TeaMisIDHF.Value));//ѡ�ΰ༶ID bool checkAllWeekSelected = false;//�ж��Ƿ�ѡ���ܴ� for (int m = 0; m < 20; m++) { CheckBox check=(CheckBox)lbWeeks.FindControl("chkWeek"+m.ToString()); if (check.Checked) { checkAllWeekSelected = true; int mm = m + 1; arr.Week = mm.ToString();//�ڿ��ܴ� bool checkClassSelected = false; for (int n = 1; n < 8; n++) { arr.WeekDay = n;//�ڿ���� for (int p = 1; p < 6; p++) { CheckBox check2 = (CheckBox)lbDayAndClass.FindControl("chkDay" + n.ToString() + "Class" + p.ToString()); if (check2.Checked) { checkClassSelected = true; arr.Lession = p;//�ڿνڴ� string[] strCheckArrangement = new string[5]; strCheckArrangement = CheckArrangement(arr); if (strCheckArrangement[0] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�γ̰��ų�ͻ��" + arr.LocationName + "�ڵ�" + arr.Week.ToString() + "�� ����" + arr.WeekDay.ToString() + " ��" + arr.Lession.ToString() + "����Ѱ��ſγ̣�" + strCheckArrangement[0]+ "')</script>"); return; } if (strCheckArrangement[1] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ʦ�γ̰��ų�ͻ��" + arr.TeacherName + "�ڵ�" + arr.Week.ToString() + "�� ����" + arr.WeekDay.ToString() + " ��" + arr.Lession.ToString() + "����Ѱ��ſγ̣�" + strCheckArrangement[1] + "')</script>"); return; } if (strCheckArrangement[3] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('�༶���ų�ͻ��" + arr.ClassName + "�ڵ�" + arr.Week.ToString() + "�� ����" + arr.WeekDay.ToString() + " ��" + arr.Lession.ToString() + "����Ѱ��ſγ̣�" + strCheckArrangement[3] + "')</script>"); return; } if (strCheckArrangement[4] != "") { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ʦ�ص㰲�ų�ͻ���ڵ�" + arr.Week.ToString() + "�� ����" + arr.WeekDay.ToString() + " ��" + arr.Lession.ToString() + "����Ѱ�����ʦ��" + strCheckArrangement[4] + "�Ͽ�')</script>"); return; } if (strCheckArrangement[2] != "") { ; } else { arrBLL.Add(arr); } } } } if (!checkClassSelected) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ���ϿνڴΣ�')</script>"); return; } } } if (!checkAllWeekSelected) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('��ѡ���ܴΣ�')</script>"); return; } } // } Page.ClientScript.RegisterClientScriptBlock(GetType(), "script", "<script type='text/javascript'>alert('����ɹ���');refreshParent() </script>"); ArrangementGridView_DataBind(); }