public Models.MenuSubCategoryResultDo GetMenuSubCategoryList(Models.MenuCriteriaDo criteria) { Models.MenuSubCategoryResultDo result = new Models.MenuSubCategoryResultDo(); db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) => { command.CommandText = "[dbo].[sp_Get_MenuSubCategoryList]"; command.CommandType = System.Data.CommandType.StoredProcedure; command.AddParameter(typeof(int), "GroupID", criteria.GroupID); command.AddParameter(typeof(int), "CategoryID", criteria.CategoryID); command.AddParameter(typeof(int), "SubCategoryID", criteria.SubCategoryID); System.Collections.IList[] dbls = command.ToList( typeof(Models.MenuSubCategoryDo), typeof(Models.MenuDo), typeof(Models.MenuBrandDo)); if (dbls != null) { List <Models.MenuSubCategoryDo> dbmscs = dbls[0] as List <Models.MenuSubCategoryDo>; List <Models.MenuDo> dbms = dbls[1] as List <Models.MenuDo>; List <Models.MenuBrandDo> dbmbs = dbls[2] as List <Models.MenuBrandDo>; if (dbmscs != null) { result.Rows = dbmscs; result.TotalRecords = result.Rows.Count; if (dbms != null) { foreach (Models.MenuSubCategoryDo subCategory in result.Rows) { subCategory.Menus = dbms.FindAll(x => x.GroupID == subCategory.GroupID && x.CategoryID == subCategory.CategoryID && x.SubCategoryID == subCategory.SubCategoryID); if (subCategory.Menus == null) { subCategory.Menus = new List <Models.MenuDo>(); } if (dbmbs != null) { foreach (Models.MenuDo menu in subCategory.Menus) { menu.Brands = dbmbs.FindAll(x => x.GroupID == menu.GroupID && x.CategoryID == menu.CategoryID && x.SubCategoryID == menu.SubCategoryID && x.MenuID == menu.MenuID); if (menu.Brands == null) { menu.Brands = new List <Models.MenuBrandDo>(); } } } } } } } })); return(result); }
public Models.MenuGroupResultDo GetMenuGroupList(Models.MenuCriteriaDo criteria) { Models.MenuGroupResultDo result = new Models.MenuGroupResultDo(); db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) => { command.CommandText = "[dbo].[sp_Get_MenuGroupList]"; command.CommandType = System.Data.CommandType.StoredProcedure; command.AddParameter(typeof(int), "GroupID", criteria.GroupID); command.AddParameter(typeof(string), "Code", criteria.Code); result.Rows = command.ToList <Models.MenuGroupDo>(); if (result.Rows != null) { result.TotalRecords = result.Rows.Count; } })); return(result); }