/// <summary> /// 获得下拉接口 /// </summary> /// <returns>The list.</returns> public ActionResult List(int id) { SysChain.Model.SysUser user = (SysChain.Model.SysUser)Session["UserInfo"]; string strWhere = string.Empty; if (id > 0) { strWhere = "Layer=" + id + " and UserID=" + user.UserID; } else { strWhere = "UserID = " + user.UserID; } return(Json(Opr.GetList(strWhere, "OrderCode"), JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int?pid, int?index) { int ParentID = pid == null ? 0 : (int)pid; int PageIndex = index == null ? 1 : (int)index; ViewBag.ParentID = ParentID; ViewBag.PageIndex = PageIndex; SysChain.Model.SysUser user = (SysChain.Model.SysUser)Session["UserInfo"]; int PageSize = 5; string strWhere = "ParentID=" + ParentID + " and UserID=" + user.UserID.ToString(); ViewBag.Totalcount = Opr.GetCount(strWhere); List <Model.SysGroup> list = Opr.GetListByPage(strWhere, "", "OrderCode", (PageIndex - 1) * PageSize + 1, PageIndex * PageSize); return(View(list)); }
public ActionResult New(Model.SysGroup model) { Helper.ResultInfo <int> rs = new Helper.ResultInfo <int>(); if (ModelState.IsValid) { if (model.GroupID > 0) { rs.Data = Opr.ModifyModel(model); if (rs.Data > 0) { rs.Msg = "修改成功."; rs.Result = true; } else { rs.Msg = "修改失败."; rs.Result = false; } JsonResult jr = new JsonResult(); jr.Data = rs; return(jr); } else { model.OrderCode = Opr.GetNewOrderCode(model.ParentID, model.Layer); SysChain.Model.SysUser user = (SysChain.Model.SysUser)Session["UserInfo"]; model.UserID = user.UserID; rs.Data = Opr.Insert(model); if (rs.Data > 0) { rs.Msg = "新增成功."; rs.Result = true; } else { rs.Msg = "新增失败."; rs.Result = false; } JsonResult jr = new JsonResult(); jr.Data = rs; return(jr); } } else { System.Text.StringBuilder sbErrors = new System.Text.StringBuilder(); foreach (var item in ModelState.Values) { if (item.Errors.Count > 0) { for (int i = item.Errors.Count - 1; i >= 0; i--) { sbErrors.Append(item.Errors[i].ErrorMessage); sbErrors.Append("<br/>"); } } } rs.Data = 0; rs.Msg = sbErrors.ToString(); rs.Result = false; rs.Url = ""; JsonResult jr = new JsonResult(); jr.Data = rs; return(jr); } }
public JsonResult SelectGroup() { SysChain.Model.SysUser user = (SysChain.Model.SysUser)Session["UserInfo"]; return(Json(Opr.GetModelList("State>0 and UserID=" + user.UserID.ToString()), JsonRequestBehavior.AllowGet)); }