public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); CourseItemEntity para = new CourseItemEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); //类型 if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { var condition = queryParam["condition"].ToString().ToLower(); switch (condition) { case "name": para.Name = queryParam["keyword"].ToString(); break; } } if (!queryParam["courseid"].IsEmpty()) { para.CourseId = queryParam["courseid"].ToString(); } } var pageList = CourseItemBLL.Instance.GetPageList(para, ref pagination); pageList.ForEach((o) => { if (o.CourseId != null) { var coursemodel = CourseBLL.Instance.GetEntity(o.CourseId); if (coursemodel != null) { o.CourseName = coursemodel.CourseName; } } }); var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public ActionResult GetListJson(string queryJson) { var watch = CommonHelper.TimerStart(); CourseItemEntity para = new CourseItemEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); if (!queryParam["courseid"].IsEmpty()) { para.CourseId = queryParam["courseid"].ToString(); } } var list = CourseItemBLL.Instance.GetList(para); return(Content(list.ToJson())); }
protected void ReadFromControls(CourseContainer c, List <CourseItemEntity> cis) { string subjectStr = Page.Request.QueryString["s"]; if (subjectStr != null) { int subjectId; bool isNum = int.TryParse(subjectStr, out subjectId); if (isNum) { c.TheCourse.SubjectId = subjectId; } } c.SetTitle(txtTitle.Text); c.CultureCode = DDLanguage.SelectedValue; c.TheCourse.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdbtnWhoCanEdit.SelectedValue); c.TheCourse.CreatedOnDate = DateTime.Now; c.TheCourse.CreatedByUserId = this.UserId; c.TheCourse.ModifiedOnDate = DateTime.Now;; c.TheCourse.ModifiedByUserId = this.UserId; c.SetDescription(txtHtmlText.Text); // string is in form "44,45,48,52" holding PluggIDs string pluggtext = txtPluggs.Text.Trim(); // Todo: Check that pluggtext is in the correct format before creating the Course CourseItemEntity ci; if (!string.IsNullOrEmpty(pluggtext)) { string[] itempluggs = pluggtext.Split(','); for (int i = 0; i < itempluggs.Length; i++) { ci = new CourseItemEntity(); ci.ItemId = Convert.ToInt32(itempluggs[i]); ci.CIOrder = i + 1; ci.ItemType = ECourseItemType.Plugg; ci.MotherId = 0; cis.Add(ci); } } }
public JsonResult List(string courseid) { var result = new ReturnMessage(false) { Message = "获取失败!" }; try { CourseItemEntity para = new CourseItemEntity(); para.CourseId = courseid; var list = CourseItemBLL.Instance.GetList(para).OrderBy(o => o.SortNum); result.IsSuccess = true; result.Message = "获取成功!"; result.ResultData["List"] = list; } catch (Exception ex) { ex.Data["Method"] = "CourseItemController>>List"; new ExceptionHelper().LogException(ex); } return(Json(result, JsonRequestBehavior.AllowGet)); }