public ActionResult Category(string id) { ViewBag.isok = "OK"; ViewBag.Appid = WeChatConfig.GetKeyValue("appid"); ViewBag.Uri = WeChatConfig.GetKeyValue("shareurl"); noncestr = CommonMethod.GetCode(16); string jsapi_ticket = Js_sdk_Signature.IsExistjsapi_ticket(token.IsExistAccess_Token()); timestamp = DateTime.Now.Ticks.ToString().Substring(0, 10);; string url = Request.Url.ToString().Replace("#", ""); JssdkSignature = Js_sdk_Signature.GetjsSDK_Signature(noncestr, jsapi_ticket, timestamp, url); ViewBag.noncestr = noncestr; ViewBag.jsapi_ticket = jsapi_ticket; ViewBag.timestamp = timestamp; ViewBag.JssdkSignature = JssdkSignature; ViewBag.PageFlag = id; var sid = TypeParser.ToInt32(Request["sid"]); if (sid <= 0) { sid = 2; } ViewBag.SupplierID = sid; ViewBag.SupplierName = supplierB.Get(s => s.SUPPLIER_ID == sid).SUPPLIER_NAME; ViewBag.ProductList = VIEW_MST_PRD.ToListViewModel(prdB.GetListBy(p => p.CATE_ID == id && p.STATUS == true && p.ISCHECK == true, p => p.SEQ_NO)); var model = VIEW_MST_CATEGORY.ToViewModel(categoryB.Get(c => c.CATE_CD == id)); return(View(model)); }
public MODEL.DataTableModel.DataTableGrid GetCategoryGridTree(MODEL.DataTableModel.DataTableRequest treeData) { int count = 0; var data = base.GetListBy(sc => true).OrderBy(sc => sc.CATE_CD); count = data.Count(); //GetPermission(request, out count); List <VIEW_MST_CATEGORY> listCategory = new List <VIEW_MST_CATEGORY>(); //查找所有的一级权限 var ParentCatalog = data.Where(con => con.SYNCOPERATION != "D"); foreach (var parent in ParentCatalog) { //实体转化 VIEW_MST_CATEGORY parentItem = VIEW_MST_CATEGORY.ToViewModel(parent); //获取子级 GetCategoryChildren(ref parentItem, data.ToList()); listCategory.Add(parentItem); } return(new MODEL.DataTableModel.DataTableGrid() { data = listCategory, total = count }); }
public ActionResult PrdCateDetail(string cd) { ViewBag.TYPE = "Add"; ViewBag.CATE_IDS = DataSelect.ToListViewModel(VIEW_MST_CATEGORY.ToListViewModel(CategoryB.GetListBy(m => m.ACTIVE == true))); var model = CategoryB.Get(m => m.CATE_CD == cd); if (model == null) { return(View(new VIEW_MST_CATEGORY())); } ViewBag.TYPE = "Update"; model.VERSION = model.VERSION + 1; return(View(VIEW_MST_CATEGORY.ToViewModel(model))); }
// <summary> /// 获取子集 /// </summary> /// <param name="parent"></param> /// <param name="allList"></param> public void GetCategoryChildren(ref VIEW_MST_CATEGORY parent, List <MST_CATEGORY> allList) { foreach (MST_CATEGORY category in allList) { if (category.PARENT_CD == parent.CATE_CD && category.SYNCOPERATION != "D") { //实体转化 VIEW_MST_CATEGORY child = VIEW_MST_CATEGORY.ToViewModel(category); if (parent.children == null) { parent.children = new List <VIEW_MST_CATEGORY>(); } //添加到父级的Children中 parent.children.Add(child); GetCategoryChildren(ref child, allList);//递归添加子树 } } }
public IEnumerable <DataTree> GetCategoryTree(MODEL.DataTableModel.DataTreeRequest request) { //返回ui层的菜单 IEnumerable <DataTree> rootRole = new List <DataTree>(); var data = base.GetListBy(sc => true).OrderBy(sc => sc.CATE_CD); //GetPermission(request, out count); List <VIEW_MST_CATEGORY> listCategory = new List <VIEW_MST_CATEGORY>(); //查找所有的一级权限 var ParentCatalog = data.Where(con => con.PARENT_CD == "" && con.SYNCOPERATION != "D"); foreach (var parent in ParentCatalog) { //实体转化 VIEW_MST_CATEGORY parentItem = VIEW_MST_CATEGORY.ToViewModel(parent); //获取子级 GetCategoryChildren(ref parentItem, data.ToList()); listCategory.Add(parentItem); } rootRole = DataTree.ToListViewModel(listCategory); return(rootRole); }