public JsonResult Editorganization(FormCollection form) { Common.Json json = new Common.Json(); B_Organization b_org = new B_Organization(); B_Organization_type b_orgtype = new B_Organization_type(); B_Manager b_manager = new B_Manager(); Domain.Organization model = b_org.Get(Convert.ToInt32(form["id"])); model.name = form["txt_name"]; model.parent_id = Convert.ToInt32(form["txt_parent_id"]); if (model.parent_id != 0) { var m = b_org.Get(model.parent_id); if (string.IsNullOrEmpty(model.parent_ids)) { model.parent_ids = model.parent_id + ","; } else { model.parent_ids = m.parent_ids + m.parent_id + ","; } model.levels = m.levels + 1; } else { model.levels = 0; } model.orgtype = b_orgtype.Get(Convert.ToInt32(form["txt_orgtype_id"])); model.sort_id = Convert.ToInt32(form["txt_sort_id"]); model.status = Convert.ToInt32(form["txt_status"]); b_org.Update(model); json.msg = "修改成功!"; return(Json(json)); }
public JsonResult GetOrganization_type(int id) { B_Organization_type b_orgtype = new B_Organization_type(); var res = b_orgtype.Get(id); return(Json(res)); }
public static string select_org_type(this HtmlHelper helper) { B_Organization_type b_orgtype = new B_Organization_type(); List <Order> order = new List <Order>() { Order.Asc("sort_id") }; var list_orgtype = b_orgtype.GetList(null, order); StringBuilder sb = new StringBuilder(); sb.Append("<select id=\"txt_orgtype_id\" name=\"txt_orgtype_id\" class=\"selectpicker show-tick form-control\" data-live-search=\"true\">"); for (int i = 0; i < list_orgtype.Count; i++) { if (i == 0) { sb.Append("<option selected = \"selected\" data-subtext=" + list_orgtype[i].orgtype_name + ">" + list_orgtype[i].id + "</option>"); } else { sb.Append("<option data-subtext=" + list_orgtype[i].orgtype_name + ">" + list_orgtype[i].id + "</option>"); } } sb.Append("</select>"); return(sb.ToString()); }
public JsonResult DelOrganization_type(string ids) { Common.Json json = new Common.Json(); B_Organization_type b_orgtype = new B_Organization_type(); foreach (var id in ids.Split(new char[] { ',' })) { b_orgtype.Delete(Convert.ToInt32(id)); } json.msg = "成功删除" + ids.Split(new char[] { ',' }).Length + "条记录!"; return(Json(json)); }
public JsonResult EditOrganization_type(FormCollection form) { Common.Json json = new Common.Json(); B_Organization_type b_orgtype = new B_Organization_type(); Domain.Organization_type m_orgtype = b_orgtype.Get(Convert.ToInt32(form["id"])); m_orgtype.orgtype_name = form["txt_name"]; m_orgtype.sort_id = Convert.ToInt32(form["txt_sort_id"]); m_orgtype.remark = form["txt_remark"]; b_orgtype.Update(m_orgtype); json.msg = "修改成功!"; return(Json(json)); }
public JsonResult AddOrganization(FormCollection form) { Common.Json json = new Common.Json(); B_Organization b_org = new B_Organization(); B_Organization_type b_orgtype = new B_Organization_type(); B_Manager b_manager = new B_Manager(); Domain.Organization model = new Domain.Organization(); model.name = form["txt_name"]; model.parent_id = Convert.ToInt32(form["txt_parent_id"]); if (model.parent_id != 0) { var m = b_org.Get(model.parent_id); if (string.IsNullOrEmpty(model.parent_ids)) { model.parent_ids = model.parent_id + ","; } else { model.parent_ids = m.parent_ids + m.parent_id + ","; } model.levels = m.levels + 1; } else { model.levels = 0; } model.orgtype = b_orgtype.Get(Convert.ToInt32(form["txt_orgtype_id"])); model.sort_id = Convert.ToInt32(form["txt_sort_id"]); model.add_manager = b_manager.Get(Convert.ToInt32(base.User.Identity.Name)); model.add_time = DateTime.Now; model.status = Convert.ToInt32(form["txt_status"]); var res = b_org.Save(model); if (res <= 0) { json.status = -1; json.msg = "添加失败!"; return(Json(json)); } json.msg = "添加成功!"; return(Json(json)); }
public JsonResult AddOrganization_type(FormCollection form) { Common.Json json = new Common.Json(); B_Organization_type b_orgtype = new B_Organization_type(); Domain.Organization_type m_orgtype = new Domain.Organization_type(); m_orgtype.orgtype_name = form["txt_name"]; m_orgtype.sort_id = Convert.ToInt32(form["txt_sort_id"]); m_orgtype.remark = form["txt_remark"]; var res = b_orgtype.Save(m_orgtype); if (res <= 0) { json.status = -1; json.msg = "添加失败!"; return(Json(json)); } json.msg = "添加成功!"; return(Json(json)); }
public JsonResult GetOrganization_typeList(int limit = 10, int offset = 1) { B_Organization_type b_orgtype = new B_Organization_type(); List <Order> order = new List <Order>() { Order.Asc("sort_id") }; List <SearchTemplate> st = new List <SearchTemplate>() { new SearchTemplate() { key = "", value = new int[] { offset, limit }, searchType = Common.EnumBase.SearchType.Paging } }; var list_user = b_orgtype.GetList(st, order); var total = b_orgtype.GetCount(st); return(Json(new { total = total, rows = list_user }, JsonRequestBehavior.AllowGet)); }