public ActionResult OrganDel(int id) { SysOrganizationBll bll = new SysOrganizationBll(); SYS_ORGANIZATION model = bll.Query(t => t.ORG_ID == id).FirstOrDefault(); if (model != null) { bll.Delete(model, true); } return(Json(BaseModels.OK("成功!"))); }
/// <summary> /// /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult OrganEdit(int?Id) { SysOrganizationBll bll = new SysOrganizationBll(); SYS_ORGANIZATION model = new SYS_ORGANIZATION(); if (Id.ToInt() > 0) { model = bll.Query(t => t.ORG_ID == Id).FirstOrDefault(); } ViewBag.Parent = bll.Query(t => t.ORG_PARENT_ID == "-1").ToDictionary(t => t.ORG_ID, t => t.ORG_NAME); return(View(model)); }
public ActionResult OrganEdit(SYS_ORGANIZATION model) { SysOrganizationBll bll = new SysOrganizationBll(); ViewBag.Parent = bll.Query(t => t.ORG_PARENT_ID == "-1").ToDictionary(t => t.ORG_ID, t => t.ORG_NAME); if (model.ORG_ID > 0) { bll.Update(model); } else { bll.Add(model); } ViewBag.Success = true; ViewBag.Message = "修改成功!"; return(View(model)); }
/// <summary> /// 组织机构 /// </summary> /// <returns></returns> public ActionResult OrganList() { string keyword = Request["keyword"]; int page = string.IsNullOrEmpty(Request["page"]) ? 1 : Request["page"].ToInt(); int count = string.IsNullOrEmpty(Request["count"]) ? 10 : Request["count"].ToInt(); SysOrganizationBll bll = new SysOrganizationBll(); List <SYS_ORGANIZATION> allOrgan = bll.Query(t => string.IsNullOrEmpty(keyword) ? true : t.ORG_NAME.Contains(keyword)).ToList(); ViewBag.Total = allOrgan.Count; ViewBag.PageIndex = page; ViewBag.PageCount = count; ViewBag.Keyword = keyword; ViewBag.Parent = bll.Query(t => t.ORG_PARENT_ID == "-1").ToDictionary(t => t.ORG_ID, t => t.ORG_NAME); //分页 allOrgan = allOrgan.Take(count * page).Skip(count * (page - 1)).ToList(); return(View(allOrgan)); }