protected void GridViewBind(int CourseID) { 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); gvProjectList.DataSource = projectlist; gvProjectList.DataBind(); }
protected string GetProjectList(object CourseID) { string ProjectList = ""; if (CourseID != null) { int ID = 0; if (int.TryParse(CourseID.ToString(), out ID)) { LabMS.BLL.CourseAndProject CourseProject = new LabMS.BLL.CourseAndProject(); List<LabMS.Model.CourseAndProject> lsCourseProject = CourseProject.GetModelList("CourseID=" + ID.ToString()); string strWhere = ""; if (lsCourseProject.Count != 0) { for (int n = 0; n < lsCourseProject.Count; n++) { if (lsCourseProject[n].ProjectID != null) { if (strWhere == "") { strWhere += "ID=" + lsCourseProject[n].ProjectID; } else { strWhere += "or ID=" + lsCourseProject[n].ProjectID; } } } } List<LabMS.Model.Project> ls = new List<LabMS.Model.Project>(); if (strWhere != "") { LabMS.BLL.Project Project = new LabMS.BLL.Project(); ls = Project.GetModelList(strWhere); } if (ls.Count != 0) { for (int i = 0; i < ls.Count-1; i++) { ProjectList += ls[i].Project_Name; ProjectList += "<br/>"; } ProjectList += ls[ls.Count - 1].Project_Name; } } } return ProjectList; }
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 }
//通过项目ID和课程ID获取课程项目ID protected int GetProCourseIDByProID(int PID,int CID) { LabMS.BLL.CourseAndProject proCou = new LabMS.BLL.CourseAndProject(); List<LabMS.Model.CourseAndProject> proCouModel = new List<LabMS.Model.CourseAndProject>(); int PCID=0; proCouModel = proCou.GetModelList("ProjectID=" + PID + " and CourseID=" + CID); if (proCouModel.Count != 0) { PCID = proCouModel[0].ID; } return PCID; }