示例#1
0
        // GET: Supplier
        public ActionResult Index(string SupplierName, int id = 1, int ModeId = 0)
        {
            var modes    = _modeService.ModeList().Where(m => m.ParentID > 0);
            var list     = _supplierService.GetSuppliers(id, ModeId, SupplierName);
            var modeName = modes.Where(m => m.Id == ModeId).Select(m => m.ModeName).SingleOrDefault();

            ViewBag.Modes    = modes;
            ViewBag.ModeName = modeName ?? "供应商类别";
            return(View(list));
        }
示例#2
0
        public ActionResult GetModeJson()
        {
            StringBuilder      build = new StringBuilder(5000);
            IEnumerable <Mode> list  = _modeService.ModeList();

            //var lt = list.Where(p => p.ParentID == -1).ToList();
            //int ltCount = lt.Count();
            //build.Append("{\"sb\":[");
            //for (int i = 0; i < ltCount; i++)
            //{
            //    build.Append("{");
            //    build.Append("\"name\":").Append("\"").Append(lt[i].ModeName).Append("\"").Append(",");
            //    build.Append("\"data\":").Append("[");
            //    var li = list.Where(p => p.ParentID == lt[i].ModeID).ToList();
            //    int liCount = li.Count();
            //    for (int m = 0; m < liCount; m++)
            //    {
            //        build.Append("{");
            //        build.Append("\"").Append("Id").Append("\":");
            //        build.Append("\"").Append(li[m].ModeID).Append("\"");
            //        build.Append(",");
            //        build.Append("\"").Append("Name").Append("\":");
            //        build.Append("\"").Append(li[m].ModeName).Append("\"");
            //        build.Append("}");
            //        if (m != liCount - 1)
            //        {
            //            build.Append(",");
            //        }
            //    }
            //    build.Append("]");
            //    build.Append("}");
            //    if (i != ltCount - 1)
            //    {
            //        build.Append(",");
            //    }
            //}
            //build.Append("]}");

            //IEnumerable<Mode> list = _modeService.ModeList();
            //var lt = list.Where(p => p.ParentID != -1).ToList();
            //build.Append("[");
            //for (int i = 0; i < lt.Count(); i++)
            //{
            //    build.Append("{");
            //    build.Append("").Append("Id").Append(":");
            //    build.Append("'").Append(lt[i].ModeID).Append("'");
            //    build.Append(",");
            //    build.Append("").Append("Name").Append(":");
            //    build.Append("'").Append(lt[i].ModeName).Append("'");
            //    build.Append("}");
            //    if (i != lt.Count() - 1)
            //    {
            //        build.Append(",");
            //    }
            //}
            //build.Append("]");
            return(Json(list));// Convert.ToString(build);
        }
示例#3
0
        public ActionResult GetModeJson(int uid = 0)
        {
            IEnumerable <Mode> list = _modeService.ModeList();

            return(Json(new { data = list.Where(p => p.ParentID == -1 && p.IsEnabled == true).Select(t => new { name = t.ModeName, data = list.Where(m => m.ParentID == t.Id && m.IsEnabled == true).Select(v => new { id = v.Id, name = v.ModeName }) }) }));
        }