//安排教师列表 public ActionResult TeacherList(int trainingId) { PrepareTrainingApplyBLL bll = new PrepareTrainingApplyBLL(); Code.SiteCache cache = Code.SiteCache.Instance; int partitionId = cache.LoginInfo.PartitionId; int organId = cache.ManageOrganId; StringBuilder where = new StringBuilder(); string keyWords = ""; if (!string.IsNullOrEmpty(Request["KeyWords"])) keyWords = Request["KeyWords"].Trim(); ViewBag.KeyWords = keyWords; if (keyWords != "") where.Append("A.NickName like '%" + keyWords + "'"); DataTable dt = new UtilsBLL().GetRecursion("Organ_Detail", "Id", "ParentId", organId); StringBuilder organ = new StringBuilder(); foreach (DataRow row in dt.Rows) { organ.Append(row["Id"] + ","); } organ.Append("0"); int recordCount = bll.GetTeacherCount(partitionId, organ.ToString(), where.ToString()); int pageSize = 15, pageIndex; int pageCount = (int)Math.Ceiling((double)recordCount / pageSize); int.TryParse(Request["PageIndex"], out pageIndex); if (pageCount == 0) { pageIndex = 0; } else { if (pageIndex < 1) pageIndex = 1; else if (pageIndex > pageCount) pageIndex = pageCount; } ViewBag.RecordCount = recordCount; ViewBag.PageCount = pageCount; ViewBag.PageIndex = pageIndex; ViewBag.PageSize = pageSize; ViewBag.TrainingId = trainingId; List<Traning_Teacher> list = new Traning_TeacherBLL().GetList("Delflag=0 and TraningId=" + trainingId, ""); StringBuilder ids = new StringBuilder(); foreach (var item in list) { ids.Append(item.PlatformManagerId + ","); } if (ids.Length > 0) ids.Remove(ids.Length - 1, 1); ViewBag.SelectedTeacher = list; ViewData["SelectedIds"] = ids.ToString(); return View(bll.GetTeacherList(pageSize, pageIndex, "B.Id", partitionId, organ.ToString(), where.ToString()).Rows); }