//调整 protected void ReSet_OnCommand(object sender, CommandEventArgs e) { if (e.CommandName == "ReSet") { LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); List<LabMS.Model.Arrangement> arrModelList = new List<LabMS.Model.Arrangement>(); string[] strArray = e.CommandArgument.ToString().Split(','); string Week; int WeekDay, Lession, LocationID; IDHF.Value = e.CommandArgument.ToString(); Week = strArray[0]; WeekDay = int.Parse(strArray[1]); Lession = int.Parse(strArray[2]); LocationID = int.Parse(strArray[3]); arrModelList = arr.GetModelList("[Week]='" + Week + "' and [WeekDay]=" + WeekDay + " and Lession=" + Lession + " and LocationID=" + LocationID); LabDropdowlist();//绑定实验室 LabDDL.SelectedValue = arrModelList[0].LabID.ToString(); HouseDropDownList();//绑定用房 HouseDDL.SelectedValue = arrModelList[0].LocationID.ToString(); WeekDropDownList();//绑定周次 WeekSelectDDL.SelectedValue = arrModelList[0].Week; #region 绑定教课教师 DataSet teacherList = new DataSet(); teacherList = GetTeacherList(Week, WeekDay, Lession, LocationID); string strHTML = "<table id='studenlist' class='infoTable' border='1' style='border-collapse: collapse;'>"; strHTML += "<thead>"; strHTML += "<tr class='header'>"; strHTML += "<th style='display:none'>"; strHTML += "ID"; strHTML += "</th>"; strHTML += "<th>"; strHTML += "教师编号"; strHTML += "</th>"; strHTML += "<th>"; strHTML += "教师姓名"; strHTML += "</th>"; strHTML += "<th>"; strHTML += ""; strHTML += "</th>"; strHTML += "</tr>"; strHTML += "</thead>"; strHTML += "<tbody>"; tb_StudentIDs.Text = teacherList.Tables[0].Rows[0]["ID"].ToString(); tb_StudentNames.Value = teacherList.Tables[0].Rows[0]["Teacher_Name"].ToString(); strHTML += "<tr>"; strHTML += "<td style='display:none'>"; strHTML += teacherList.Tables[0].Rows[0]["ID"].ToString(); strHTML += "</td>"; strHTML += "<td>"; strHTML += teacherList.Tables[0].Rows[0]["Teacher_Code"].ToString(); strHTML += "</td>"; strHTML += "<td>"; strHTML += teacherList.Tables[0].Rows[0]["Teacher_Name"].ToString(); strHTML += "</td>"; strHTML += "<td>"; strHTML += "<a>删除</a>"; strHTML += "</td>"; strHTML += "</tr>"; strHTML += "</tbody>"; strHTML += "</table>"; tblistStudents.Value = strHTML; tblistEmpty.Value = "0"; #endregion #region 绑定上课班级 DataSet classList = new DataSet(); classList = GetClassList(Week, WeekDay, Lession, LocationID); string strHTML2 = "<table id='studenlist' class='infoTable' border='1' style='border-collapse: collapse;'>"; strHTML2 += "<thead>"; strHTML2 += "<tr class='header'>"; strHTML2 += "<th style='display:none'>"; strHTML2 += "ID"; strHTML2 += "</th>"; strHTML2 += "<th>"; strHTML2 += "班级编号"; strHTML2 += "</th>"; strHTML2 += "<th>"; strHTML2 += "班级名称"; strHTML2 += "</th>"; strHTML2 += "<th>"; strHTML2 += "专业"; strHTML2 += "</th>"; strHTML2 += "<th>"; strHTML2 += "班级人数"; strHTML2 += "</th>"; strHTML2 += "<th>"; strHTML2 += "删除"; strHTML2 += "</th>"; strHTML2 += "</tr>"; strHTML2 += "</thead>"; strHTML2 += "<tbody>"; tb_StudentIDs2.Value = ""; for (int i = 0; i < classList.Tables[0].Rows.Count; i++) { if (tb_StudentIDs2.Value == "") { tb_StudentIDs2.Value += classList.Tables[0].Rows[i]["ID"].ToString(); tb_StudentNames2.Value += classList.Tables[0].Rows[i]["Class_Name"].ToString(); } else { tb_StudentIDs2.Value += "," + classList.Tables[0].Rows[i]["ID"].ToString(); tb_StudentNames2.Value += "," + classList.Tables[0].Rows[i]["Class_Name"].ToString(); } strHTML2 += "<tr>"; strHTML2 += "<td style='display:none'>"; strHTML2 += classList.Tables[0].Rows[i]["ID"].ToString(); strHTML2 += "</td>"; strHTML2 += "<td>"; strHTML2 += classList.Tables[0].Rows[i]["Class_Code"].ToString(); strHTML2 += "</td>"; strHTML2 += "<td>"; strHTML2 += classList.Tables[0].Rows[i]["Class_Name"].ToString(); strHTML2 += "</td>"; strHTML2 += "<td>"; strHTML2 += classList.Tables[0].Rows[i]["Class_Professional"].ToString(); strHTML2 += "</td>"; strHTML2 += "<td>"; strHTML2 += classList.Tables[0].Rows[i]["Class_StudentNum"].ToString(); strHTML2 += "</td>"; strHTML2 += "<td>"; strHTML2 += "<a>删除</a>"; strHTML2 += "</td>"; strHTML2 += "</tr>"; } strHTML2 += "</tbody>"; strHTML2 += "</table>"; tblistEmpty2.Value = "0"; tblistStudents2.Value = strHTML2; #endregion IDUniq = GetTeaMissID(int.Parse(arrModelList[0].CourseID.ToString()), YearDDL.SelectedValue, TermDDL.SelectedValue); tboldcourse.Text = "chkDay" + WeekDay + "Class" + Lession; arrtable.Visible = true; YearDDL.Enabled = false; TermDDL.Enabled = false; CourseDDL.Enabled = false; DeleteBtn.Enabled = false; ArrangementGridView.Enabled = false; } }
//保存更改 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 string[] CheckArrangement(LabMS.Model.Arrangement arrModel) { LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); List<LabMS.Model.Arrangement> arrModelList = new List<LabMS.Model.Arrangement>(); string[] checkArrangement = new string[5]; checkArrangement[0] = ""; checkArrangement[1] = ""; checkArrangement[2] = ""; checkArrangement[3] = ""; checkArrangement[4] = ""; arrModelList = arr.GetModelList(" LocationID=" + arrModel.LocationID + " and [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//课程冲突 if (arrModelList.Count > 0) { checkArrangement[0] = arrModelList[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList2 = new List<LabMS.Model.Arrangement>(); arrModelList2 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and TeacherID=" + arrModel.TeacherID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//老师课程安排冲突(同时上2门课程) if (arrModelList2.Count > 0) { checkArrangement[1] = arrModelList2[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList4 = new List<LabMS.Model.Arrangement>(); arrModelList4 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and ClassID=" + arrModel.ClassID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//班级安排冲突 if (arrModelList4.Count > 0) { checkArrangement[3] = arrModelList4[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList5 = new List<LabMS.Model.Arrangement>(); arrModelList5 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and LocationID=" + arrModel.LocationID + " and TeacherID<>" + arrModel.TeacherID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//老师地点安排冲突(同一个地点2个老师上课) if (arrModelList5.Count > 0) { checkArrangement[4] = arrModelList5[0].TeacherName; } List<LabMS.Model.Arrangement> arrModelList3 = new List<LabMS.Model.Arrangement>(); arrModelList3 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID=" + arrModel.CourseID + " and TeacherID=" + arrModel.TeacherID + " and ClassID=" + arrModel.ClassID + " and LocationID=" + arrModel.LocationID);//不添加 if (arrModelList3.Count > 0) { checkArrangement[2] = arrModelList3[0].ID.ToString(); } return checkArrangement; }
//处理DS列表 protected List<LabMS.Model.Arrangement> HandleList(DataSet ds) { List<LabMS.Model.Arrangement> arrList = new List<LabMS.Model.Arrangement>(); LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { List<LabMS.Model.Arrangement> arrModelList = new List<LabMS.Model.Arrangement>(); string strClassName = ""; List<int> ClassID = new List<int>(); string strTeaName = ""; List<int> TeacherID = new List<int>(); arrModelList = arr.GetModelList("LocationID=" + int.Parse(ds.Tables[0].Rows[i]["LocationID"].ToString()) + " and [WeekDay]=" + int.Parse(ds.Tables[0].Rows[i]["WeekDay"].ToString()) + " and Lession=" + int.Parse(ds.Tables[0].Rows[i]["Lession"].ToString()) + " and CourseID=" + int.Parse(ds.Tables[0].Rows[i]["CourseID"].ToString()) + " and [Week]='" + ds.Tables[0].Rows[i]["Week"].ToString() + "' and ClassID is not null and TeacherID is not null and CourseID is not null and [Week] is not null"); for (int j = 0; j < arrModelList.Count; j++) { bool IsClassID = true; for (int m = 0; m < ClassID.Count; m++) { if (int.Parse(arrModelList[j].ClassID.ToString()) == ClassID[m]) { IsClassID = false; } } if (IsClassID) { ClassID.Add(int.Parse(arrModelList[j].ClassID.ToString())); strClassName += arrModelList[j].ClassName + " ";//班级名称 } bool IsTeacherID = true; for (int m = 0; m < TeacherID.Count; m++) { if (int.Parse(arrModelList[j].TeacherID.ToString()) == TeacherID[m]) { IsTeacherID = false; } } if (IsTeacherID) { TeacherID.Add(int.Parse(arrModelList[j].TeacherID.ToString())); strTeaName += arrModelList[j].TeacherName + " ";//教师名称 } } strClassName = strClassName.Trim(); strTeaName = strTeaName.Trim(); LabMS.Model.Arrangement arrModel = new LabMS.Model.Arrangement(); arrModel.LabName = ds.Tables[0].Rows[i]["ID"].ToString();//暂把实验室名称存储各ID arrModel.CourseID = int.Parse(ds.Tables[0].Rows[i]["CourseID"].ToString()); arrModel.CourseName = ds.Tables[0].Rows[i]["CourseName"].ToString(); arrModel.ClassName = strClassName; arrModel.TeacherName = strTeaName; arrModel.Week = ds.Tables[0].Rows[i]["Week"].ToString(); arrModel.WeekDay = int.Parse(ds.Tables[0].Rows[i]["WeekDay"].ToString()); arrModel.LocationName = ds.Tables[0].Rows[i]["LocationName"].ToString(); arrModel.Lession = int.Parse(ds.Tables[0].Rows[i]["Lession"].ToString()); arrList.Add(arrModel); } return arrList; }
//获取授课教师 通过项目ID 班级ID 课程ID protected string GetTeacherByClaIDAndProIDAndCouID(int CourseID,int ProjectID,int ClassID) { LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); List<LabMS.Model.Arrangement> arrModel = new List<LabMS.Model.Arrangement>(); int ProCouID,ClaCouID; string TeacherName; ProCouID = GetProCourseIDByProID(ProjectID, CourseID); ClaCouID = GetCouClaIDByClaID(ClassID, CourseID); arrModel = arr.GetModelList("ChoosenClassID=" + ClaCouID + " and CourseProjectID=" + ProCouID); TeacherName = HandTeaList(arrModel); return TeacherName; }
//����γ��Ƿ��г�ͻ protected string[] CheckArrangement(LabMS.Model.Arrangement arrModel) { LabMS.BLL.Arrangement arr=new LabMS.BLL.Arrangement(); List<LabMS.Model.Arrangement> arrModelList=new List<LabMS.Model.Arrangement>(); string[] checkArrangement = new string[5]; checkArrangement[0] = ""; checkArrangement[1] = ""; checkArrangement[2] = ""; checkArrangement[3] = ""; checkArrangement[4] = ""; arrModelList = arr.GetModelList(" LocationID=" + arrModel.LocationID + " and [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//�γ̳�ͻ if (arrModelList.Count > 0) { checkArrangement[0] = arrModelList[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList2 = new List<LabMS.Model.Arrangement>(); arrModelList2 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and TeacherID=" + arrModel.TeacherID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//��ʦ�γ̰��ų�ͻ(ͬʱ��2�ſγ�) if (arrModelList2.Count > 0) { checkArrangement[1] = arrModelList2[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList4 = new List<LabMS.Model.Arrangement>(); arrModelList4 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID<>" + arrModel.CourseID + " and ClassID=" + arrModel.ClassID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//�༶���ų�ͻ if (arrModelList4.Count > 0) { checkArrangement[3] = arrModelList4[0].CourseName; } List<LabMS.Model.Arrangement> arrModelList5 = new List<LabMS.Model.Arrangement>(); arrModelList5 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and LocationID=" + arrModel.LocationID + " and TeacherID<>" + arrModel.TeacherID + " and ScoreTerm='" + arrModel.ScoreTerm + "' and Year='" + arrModel.Year + "'");//��ʦ�ص㰲�ų�ͻ(ͬһ���ص�2����ʦ�Ͽ�) if (arrModelList5.Count > 0) { checkArrangement[4] = arrModelList5[0].TeacherName; } List<LabMS.Model.Arrangement> arrModelList3 = new List<LabMS.Model.Arrangement>(); arrModelList3 = arr.GetModelList(" [Week]='" + arrModel.Week + "' and Lession=" + arrModel.Lession + " and [WeekDay]=" + arrModel.WeekDay + " and CourseID=" + arrModel.CourseID + " and TeacherID=" + arrModel.TeacherID + " and ClassID=" + arrModel.ClassID + " and LocationID=" + arrModel.LocationID);//����� if (arrModelList3.Count > 0) { checkArrangement[2] = arrModelList3[0].ID.ToString(); } return checkArrangement; }
//���� 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(); }
//����DS�б� protected List<LabMS.Model.Arrangement> HandleList(DataSet ds) { List<LabMS.Model.Arrangement> arrList = new List<LabMS.Model.Arrangement>(); LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); for(int i=0;i<ds.Tables[0].Rows.Count;i++) { List<LabMS.Model.Arrangement> arrModelList=new List<LabMS.Model.Arrangement>(); string strClassName = ""; List<int> ClassID = new List<int>(); string strTeaName = ""; List<int> TeacherID = new List<int>(); string strWeek = ""; List<int> WeekList = new List<int>(); arrModelList = arr.GetModelList("LocationID=" + int.Parse(ds.Tables[0].Rows[i]["LocationID"].ToString()) + " and [WeekDay]=" + int.Parse(ds.Tables[0].Rows[i]["WeekDay"].ToString()) + " and Lession=" + int.Parse(ds.Tables[0].Rows[i]["Lession"].ToString()) + " and CourseID=" + int.Parse(ds.Tables[0].Rows[i]["CourseID"].ToString()) + " and ClassID is not null and TeacherID is not null and Week is not null"); for (int j = 0; j < arrModelList.Count; j++) { bool IsClassID=true; for (int m = 0; m < ClassID.Count; m++) { if (int.Parse(arrModelList[j].ClassID.ToString()) == ClassID[m]) { IsClassID = false; } } if (IsClassID) { ClassID.Add(int.Parse(arrModelList[j].ClassID.ToString())); strClassName += arrModelList[j].ClassName+" ";//�༶���� } bool IsTeacherID = true; for (int m = 0; m < TeacherID.Count; m++) { if (int.Parse(arrModelList[j].TeacherID.ToString()) == TeacherID[m]) { IsTeacherID = false; } } if (IsTeacherID) { TeacherID.Add(int.Parse(arrModelList[j].TeacherID.ToString())); strTeaName += arrModelList[j].TeacherName+" ";//��ʦ���� } bool IsWeek = true; for (int m = 0; m < WeekList.Count; m++) { if (int.Parse(arrModelList[j].Week) == WeekList[m]) { IsWeek = false; } } if (IsWeek) { WeekList.Add(int.Parse(arrModelList[j].Week)); //strWeek += arrModelList[j].Week;//�ܴ� } } strClassName = strClassName.Trim(); strTeaName = strTeaName.Trim(); strWeek = WeekSort(WeekList); LabMS.Model.Arrangement arrModel = new LabMS.Model.Arrangement(); arrModel.ClassName = strClassName; arrModel.TeacherName = strTeaName; arrModel.Week = strWeek; arrModel.WeekDay = int.Parse(ds.Tables[0].Rows[i]["WeekDay"].ToString()); arrModel.LocationName = ds.Tables[0].Rows[i]["LocationName"].ToString(); arrModel.Lession = int.Parse(ds.Tables[0].Rows[i]["Lession"].ToString()); arrList.Add(arrModel); } return arrList; }
//����γ̰����б� protected List<ExtendModule.CourseArrange> HandCouArrList(List<LabMS.Model.TeachMission> couArrList) { List<ExtendModule.CourseArrange> list=new List<ExtendModule.CourseArrange>(); if (couArrList.Count == 0) { return list; } LabMS.BLL.ClassItem claIte = new LabMS.BLL.ClassItem(); List<LabMS.Model.ClassItem> claIteModel = new List<LabMS.Model.ClassItem>(); LabMS.BLL.Arrangement arr = new LabMS.BLL.Arrangement(); List<LabMS.Model.Arrangement> arrModelList = new List<LabMS.Model.Arrangement>(); claIteModel = claIte.GetModelList("TeachMissionID is not null"); arrModelList = arr.GetModelList("ChoosenClassID is not null"); for (int i = 0; i < couArrList.Count; i++) { ExtendModule.CourseArrange listModel = new ExtendModule.CourseArrange(); listModel.ID = GetCourseID(int.Parse(couArrList[i].ID.ToString())); listModel.TeaMisID = couArrList[i].ID; listModel.Course_Code = couArrList[i].Ms_CourseCode; listModel.Course_Name = couArrList[i].Ms_CourseName; listModel.IsCheck = couArrList[i].Ms_Conflict; listModel.LabName = GetLabNameByID((int)couArrList[i].LabID); listModel.Course_ExprientHouse = couArrList[i].Ms_CourseHourse; listModel.Class = GetClassAndNum(claIteModel, couArrList[i].ID); listModel.ClassArrange = GetArrangedClass(arrModelList, claIteModel, couArrList[i].ID); list.Add(listModel); } return list; }